GNU bug report logs - #42406
Mouse-wheel scrolling can be flickering

Previous Next

Package: emacs;

Reported by: Konrad Podczeck <konrad.podczeck <at> univie.ac.at>

Date: Fri, 17 Jul 2020 15:37:02 UTC

Severity: normal

Full log


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

From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: Alan Third <alan <at> idiocy.org>, konrad.podczeck <at> univie.ac.at,
 42406 <at> debbugs.gnu.org
Subject: Re: bug#42406: Mouse-wheel scrolling can be flickering
Date: Thu, 17 Dec 2020 12:47:17 -0500
> I think the issue is clear: mouse-scroll calls scrolling commands, and
> all of the scrolling commands set update_mode_lines.  Why they do that
> is explained by the comment in wset_update_mode_line:
>
>   /* If this window is the selected window on its frame, set the
>      global variable update_mode_lines, so that gui_consider_frame_title
>      will consider this frame's title for redisplay.  */

This comment makes sense in `wset_update_mode_line` because that
function is for all cases where the "mode line / frame title" might need
to be updated.

But in the present case, the only change is the w->start
an the position of point: these are important enough to need to update
the mode line (for the column&line number), but I don't think these are
important enough to justify setting `update_mode_lines` to 42:
not only other frames can't be affected, but even the current frame's
title should basically never be affected either because it would be very
unusual to have the line/column number as part of the frame title.

The redisplay code does not guarantee that the mode-lines and
frame-titles will always be fully automatically kept up to date: we do
a good effort to keep it updated automatically, but there are various
cases where we give up and require ELisp code to call
`force-mode-line-update` explicitly.

We could decide that line/column numbers in frame titles fall
into that category of things we won't always automatically update.

This said, a better fix would be to make it so `wset_update_mode_line`
only causes the affected frame to be redrawn rather than all frames.
The patch below should do that.
Could you test it and see if the performance is good?

[ It can't be installed as-is: instead of `2` it should use the constant
  `REDISPLAY_SOME`, but that requires moving the code around.  ]


        Stefan


diff --git a/src/window.c b/src/window.c
index bcc989b5a7..1e9f137cd6 100644
--- a/src/window.c
+++ b/src/window.c
@@ -224,7 +224,10 @@ wset_update_mode_line (struct window *w)
   Lisp_Object fselected_window = XFRAME (WINDOW_FRAME (w))->selected_window;
 
   if (WINDOWP (fselected_window) && XWINDOW (fselected_window) == w)
-    update_mode_lines = 42;
+    {
+      update_mode_lines = 2;
+      fset_redisplay (XFRAME (WINDOW_FRAME (w)));
+    }
   else
     w->update_mode_line = true;
 }





This bug report was last modified 4 years and 26 days ago.

Previous Next


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