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 #124 received at control <at> debbugs.gnu.org (full text, mbox):

From: Noam Postavsky <npostavs <at> users.sourceforge.net>
To: Alex <agrambot <at> gmail.com>
Cc: 27647 <at> debbugs.gnu.org, Eli Zaretskii <eliz <at> gnu.org>,
 Kaushal Modi <kaushal.modi <at> gmail.com>
Subject: Re: bug#27647: 26.0.50;
 Line numbers implemented natively disappear momentarily when frame
 out of focus
Date: Wed, 08 Nov 2017 21:49:31 -0500
[Message part 1 (text/plain, inline)]
tags 27647 + patch
quit

Alex <agrambot <at> gmail.com> writes:

> Alex <agrambot <at> gmail.com> writes:
>
>> I coincidentally stumbled across an easy recipe for this bug (or at
>> least a similar bug):
>>
>> M-: (setq display-line-numbers t)
>> M-: (setq mouse-drag-and-drop-region t)
>>
>> Then select a region, click on it (mouse-1), and drag the mouse. The
>> line numbers will disappear until you release the mouse.
>>
>> Hopefully you can reproduce this on your end this time, Eli. To be
>> clear, this is with a GTK build.
>
> Sorry, I should have also mentioned that this is indeed only the case
> when x-gtk-use-system-tooltips is non-nil.

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);

Implemented in Fx_show_tip:

    DEFUN ("x-show-tip", Fx_show_tip, Sx_show_tip, 1, 6, 0,
    ...
      f = decode_window_system_frame (frame);
    ...
    #ifdef USE_GTK
      if (x_gtk_use_system_tooltips)
        {
              ...
               /* This is used in Fx_hide_tip.  */
              XSETFRAME (tip_frame, f);

Leading to the following patch:

[v1-0001-Fix-line-number-display-when-using-gtk-tooltips-B.patch (text/x-diff, inline)]
From de99bf6af06aba4659740b8f3d892ff5db5bce03 Mon Sep 17 00:00:00 2001
From: Noam Postavsky <npostavs <at> gmail.com>
Date: Wed, 8 Nov 2017 21:45:28 -0500
Subject: [PATCH v1] Fix line number display when using gtk tooltips
 (Bug#27647)

* src/xdisp.c (should_produce_line_number): Don't check tip_frame when
using gtk tooltips.
---
 src/xdisp.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/xdisp.c b/src/xdisp.c
index 69b74dc629..3b75811cc3 100644
--- a/src/xdisp.c
+++ b/src/xdisp.c
@@ -21126,7 +21126,8 @@ 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 (!x_gtk_use_system_tooltips
+      && FRAMEP (tip_frame) && EQ (WINDOW_FRAME (it->w), tip_frame))
     return false;
 #endif
 
-- 
2.11.0


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

Previous Next


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