Subject: bug#42406: Mouse-wheel scrolling can be flickering

From: Alan Third <[email-masked]>
Date: Thu, 10 Dec 2020 22:10:28 +0000

On Thu, Dec 10, 2020 at 06:14:30PM +0100, Konrad Podczeck wrote:
> I still see a problem with mouse wheel scrolling, for emacs from the
> 27 branch as well as for emacs from the master branch, when there
> are multiple frames open.
> 
> To reproduce: Start Emacs (from any of the two mentioned branches)
> with an init-file just containing:
> 
> (setq mouse-wheel-progressive-speed nil)
> 
> (setq default-frame-alist '((tool-bar-lines . 1)(width . 82)(height . 46)(left . 1)(top . 0)(font . "SF Mono-15")(line-spacing . 3)))
> 
> Open any longer file. Mouse wheel scrolling performance is fine (at
> least for the master branch). Now do C-x 5 2, to get a second frame.
> Using the mouse wheel, scroll up and down. Repeat C-x 5 2, about six
> times, and the scrolling performance becomes worse and worse.
> 
> Remark: If one uses the menu to turn off the toolbar, then the problem disappears.

OK, I can see this. Turning off the menu doesn't actually make it go
away, it just makes the redraw more efficient, so you need more frames
open to see the effect.

What appears to be happening is that scrolling with the mouse, and
also using C-v or M-v causes every frame to update the cursor and
clear the internal border, which in turn causes them all to be drawn
to the screen at once, which is pretty slow.

(It also appears to do something with scrollbars which helped me find a
subtle redrawing bug.)

Scrolling through the buffer by using C-n to move down line by line
only updates the frame being displayed. I'm not sure what's going on,
it appears to be system independent code doing this.
-- 
Alan Third