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

From: Konrad Podczeck <[email-masked]>
Date: Thu, 10 Dec 2020 18:14:30 +0100

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.

Remark: Instead of customizing default-frame-alist, one can also put the following code in the init-file

(custom-set-variables
 '(display-buffer-base-action
   '((display-buffer-reuse-window display-buffer-pop-up-frame)
    (reusable-frames . t)))
 '(display-buffer-alist
   '(
    ("[.]"
     (display-buffer-reuse-window display-buffer-pop-up-frame)
     (pop-up-frame-parameters
       (tool-bar-lines . 1)
       (left . 1)
       (top . 0)
       (height . 46)
       (width . 82)
       (font . "SF Mono-15")
       (line-spacing . 3)
      ))))
)

to get the the same problem with different buffers.

Konrad

> Am 10.10.2020 um 16:07 schrieb Konrad Podczeck <[email-masked]>:
> 
> 
> 
>> Am 10.10.2020 um 11:51 schrieb Alan Third <[email-masked]>:
>> 
>> On Thu, Jul 30, 2020 at 12:30:27PM +0200, Konrad Podczeck wrote:
>>> Having taken a closer look, it seems to me now that what I called "flickering" is the following:
>>> 
>>> Mouse-wheel scroll downwards, so that the cursor becomes positioned
>>> at the top row of the frame. Then release the mouse-wheel, but so
>>> that inertia scrolling continues for a short time. After the
>>> scrolling comes to rest, which is probably determined by the window
>>> manager, there is an extra movement, governed probably by Emacs, to
>>> make sure that it is not the case that only, say, half of a row is
>>> visible at the top of the frame. It seems to me that it is this
>>> extra movement which leads to what I called "flickering."
>> 
>> Sorry for the long delay. In standard Emacs usage you shouldn't ever
>> see half a line displayed at the top of the screen. Are you using
>> pixel scroll mode or something?
> 
> No
> 
>> 
>> The only alternative I can think of is that the inertia just pushes it
>> over the edge to scroll one more line, but I don't think you would see
>> that as "flickering", just an extra scroll.
> 
> Yes, maybe “flickering” is saying to much, but I see a “light tremor”, at least with the customizations:
> 
> (setq mouse-wheel-progressive-speed nil)
> (setq mouse-wheel-scroll-amount '(1 ((shift) . 1)))
> 
> Konrad
> 
>> 
>> To disable inertia in Emacs do:
>> 
>>   (setq ns-use-mwheel-momentum nil)
>> 
>> -- 
>> Alan Third