bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#42406: Mouse-wheel scrolling can be flickering


From: Stefan Monnier
Subject: bug#42406: Mouse-wheel scrolling can be flickering
Date: Thu, 17 Dec 2020 12:47:17 -0500
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux)

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






reply via email to

[Prev in Thread] Current Thread [Next in Thread]