[GTK4] EventControllerScroll: scroll-begin emitted without a corresponding scroll-end on a discrete scrolling device after scrolling in another window or application
Steps to reproduce
All steps require a mouse wheel other other discrete scrolling device.
- Open a window with an attached
EventControllerScroll
that allows continuous scrolling. - Scroll in the first window (this seems to be necessary to "initialize" it in some way). Observe a pair of
scroll-begin
andscroll-end
events. - Using a discrete device, scroll in another window. There has to be a net total scroll, so I recommend scrolling down just one line.
- Return to the first window and scroll again. Once again, if the net scrolling is zero the bug won't reproduce, so scrolling down here will reproduce the bug but scrolling up (after scrolling down in step 3) won't. Observe a
scroll-begin
event. - Now, no matter how much the user scrolls with their mouse wheel on the original window, the
scroll-end
event is never emitted.
Current behavior
A scroll-begin
event is sent without a corresponding scroll-end
event on a discrete device. For applications that care about differentiating between continuous and discrete scrolling this locks them into the state where they believe a device with continuous scrolling is being used. This happens even on devices with no capability for continuous scrolling, and it is difficult to exit that state without a separate device that is capable of continuous scrolling.
Expected outcome
Discrete devices should not remain in the "continuous scrolling" state without sending a scroll-end
event.
Version information
Fedora 34, GTK 4.2.1. WM: x11/i3
Additional information
The requirement for net scrolling in steps 3 and 4 of the reproduction results in two slightly different behaviours if you ignore it. If you scroll up and down one line (0 net scrolling) in step 3, then at step 4 neither scroll-begin
nor scroll-end
will be emitted. If you scroll down in step 3 and up in step 4, the controller emits both a scroll-begin
and scroll-end
, avoiding the bug.
When the bug does get triggered I observe multiple scroll events being sent as a single event, even if those events happened on a separate window. So I see one single (Filed #4160 (closed))scroll
event with 2 or more lines scrolled even though I only scrolled a single time on the original window.
Once a scroll-begin
event is emitted without a paired scroll-end the only way to trigger a scroll-end
without a separate continuous scrolling device is to scroll on another window until there's no net scrolling again. This could only realistically happen by luck.