GNU bug report logs - #27647
26.0.50; Line numbers implemented natively disappear momentarily when frame out of focus

Previous Next

Package: emacs;

Reported by: Kaushal Modi <kaushal.modi <at> gmail.com>

Date: Mon, 10 Jul 2017 20:55:02 UTC

Severity: normal

Tags: patch

Found in version 26.0.50

Done: Eli Zaretskii <eliz <at> gnu.org>

Bug is archived. No further changes may be made.

Full log


Message #136 received at 27647 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Noam Postavsky <npostavs <at> users.sourceforge.net>
Cc: 27647 <at> debbugs.gnu.org, agrambot <at> gmail.com, kaushal.modi <at> gmail.com
Subject: Re: bug#27647: 26.0.50;
 Line numbers implemented natively disappear momentarily when frame
 out of focus
Date: Thu, 09 Nov 2017 18:12:02 +0200
> From: Noam Postavsky <npostavs <at> users.sourceforge.net>
> Cc: Eli Zaretskii <eliz <at> gnu.org>,  27647 <at> debbugs.gnu.org,  Kaushal Modi <kaushal.modi <at> gmail.com>
> Date: Wed, 08 Nov 2017 21:49:31 -0500
> 
> Aha, the problem is this condition in should_produce_line_number:
> 
>     static bool
>     should_produce_line_number (struct it *it)
>     {
>       ...
>       /* Don't display line number in tooltip frames.  */
>       if (FRAMEP (tip_frame) && EQ (WINDOW_FRAME (it->w), tip_frame))
>         return false;
> 
> Which sounds like it would be correct, except that the meaning of
> tip_frame is different for GTK tooltips, as explained in x_hide_tip:
> 
>     static Lisp_Object
>     x_hide_tip (bool delete)
>     {
>     ...
>     #ifdef USE_GTK
>           {
>         /* When using system tooltip, tip_frame is the Emacs frame on
>            which the tip is shown.  */
>         struct frame *f = XFRAME (tip_frame);

Thanks for the diagnose.  I hate these tricks.

> Leading to the following patch:

Thanks, but this patch won't compile in any non-X build (because
x_gtk_use_system_tooltips is only defined in xfns.c).  Also,
x_gtk_use_system_tooltips is non-zero by default in all X builds, even
those without GTK, so I guess under this patch non-GTK builds will
show line numbers in tooltip frames, is that right?

I propose a slightly different patch below; could you try it?

diff --git a/src/dispextern.h b/src/dispextern.h
index 2f55d8c..430afbf 100644
--- a/src/dispextern.h
+++ b/src/dispextern.h
@@ -3452,7 +3452,14 @@ void gamma_correct (struct frame *, COLORREF *);
 void x_implicitly_set_name (struct frame *, Lisp_Object, Lisp_Object);
 void x_change_tool_bar_height (struct frame *f, int);
 
+/* The frame used to display a tooltip.
+
+   Note: In a GTK build with non-zero x_gtk_use_system_tooltips, this
+   variable holds the frame that shows the tooltip, not the frame of
+   the tooltip itself, so checking whether a frame is a tooltip frame
+   cannot just compare the frame to what this variable holds.  */
 extern Lisp_Object tip_frame;
+
 extern Window tip_window;
 extern frame_parm_handler x_frame_parm_handlers[];
 
diff --git a/src/xdisp.c b/src/xdisp.c
index 69b74dc..d4a0261 100644
--- a/src/xdisp.c
+++ b/src/xdisp.c
@@ -21126,7 +21126,13 @@ should_produce_line_number (struct it *it)
 
 #ifdef HAVE_WINDOW_SYSTEM
   /* Don't display line number in tooltip frames.  */
-  if (FRAMEP (tip_frame) && EQ (WINDOW_FRAME (it->w), tip_frame))
+  if (FRAMEP (tip_frame) && EQ (WINDOW_FRAME (it->w), tip_frame)
+#ifdef USE_GTK
+      /* GTK builds store in tip_frame the frame that shows the tip,
+	 so we need an additional test.  */
+      && !NILP (Fframe_parameter (tip_frame, Qtooltip))
+#endif
+      )
     return false;
 #endif
 




This bug report was last modified 7 years and 243 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.