GNOME Bugzilla – Bug 758197
Mouse zooming not possible on Ubuntu 15.10
Last modified: 2018-05-22 12:59:22 UTC
After trying libchamplain on Ubuntu 15.10 I realized that zooming with mouse is not possible any more. After investigating a bit it seems that inside scroll_event() the mouse wheel event is always CLUTTER_SCROLL_SMOOTH and not CLUTTER_SCROLL_UP/CLUTTER_SCROLL_DOWN any more. Moreover, the deltas from clutter_event_get_scroll_delta() are always 0. This might be an issue of clutter 1.22.4 or clutter-gtk 1.6.2 shipped in Ubuntu 15.10 or caused by some backwards-incompatible change in clutter.
AFAICT the bug was introduced by commit 1a34b284750, although I don't get 0 deltas, but a small fraction of 1 most usually. I don't think that patch is completely alright, in my experience it's better to accumulate deltas until those trigger an effect in order to behave like directional scroll events used to do. I'm attaching a patch going along the lines suggested above, it fixes the scrolling issues I see here. Hopefully we're seeing the same issue :).
Created attachment 315931 [details] [review] view: Accumulate smooth scroll dy in order to trigger zoom The way scroll is triggered is somewhat unreliable, it is better to accumulate the scroll value, until enough delta is accumulated to trigger a "tick" (1 scroll unit is equivalent to one traditional scroll event).
Thanks Carlos, accumulating deltas definitely makes sense. I have some notes though: 1. Simply casting to int for the steps might cause that value 0.99999999 in dy is interpreted as 0 for the steps and the "click" is missed. I don't know what clutter does internally but if there are some floating point calculations, this can easily happen. I think there should be some threshold checks to trigger the click for anything inside e.g. +-0.05 around the value. 2. I'm not sure the leave-event is the right one to zero the accumulated value. IMO the value should be zeroed in gesture-begin (or gesture-end) for gesture-based events. In addition, I don't know how clutter handles mouse wheel events with "fluid" mouse wheel (without clicks). Is there anything like mouse-wheel-rotation-started event? Such an event would be also a good place to zero the accumulated value. If clutter/X11/wayland (whatever is responsible for it) accumulates the values internally changes the value in +-1 increments, this is not needed. The thing I want to avoid is that e.g. the accumulated value becomes 0.9, the user stops scrolling because he's at the right zoom level but then even a slight wheel movement causes zoom-in. 3. I'm afraid the dx, dy values are really 0 on Ubuntu 15.10 (testing on Parallels desktop VM under OS X but mouse works everywhere else so I'm not sure if this is a problem here). So while something like this is definitely good to have in, it doesn't fix the issue for me.
Created attachment 316429 [details] [review] Accumulate scroll dy
Carlos, I've just modified your patch to address the issues (1) and (2). I just used a simple timer to clear dy if scroll event doesn't happen for 1s. Does it look good to you? I'd have to install some different distribution to be able to test it here so it's kind of untested.
(In reply to Jiri Techet from comment #5) > Carlos, I've just modified your patch to address the issues (1) and (2). I > just used a simple timer to clear dy if scroll event doesn't happen for 1s. > Does it look good to you? I'd have to install some different distribution to > be able to test it here so it's kind of untested. Sorry I lost track of this :(. The patch looks good indeed to me, testing also comes out positive. As for your original issue, I'm kind of clueless... what gtk+ version are you using? I wonder if it's due to my last activity in bug #750994, but that's getting old... I would appreciate some excerpt of XI_Motion events from "xinput test-xi2" as you scroll, smooth scroll events usually change the valuators 2 and 3. To check at the GTK+ level, you could maybe run launcher-gtk with GDK_DEBUG=events, debug output should show you the deltas seen in GdkEventScroll events. It might also help if you compiled gtk+, clutter and clutter-gtk master in your development environment one by one and checked whether the issue is gone. It might also be an interoperation issue with Parallels that's still unresolved, but I guess it'd show up somewhere else... Oh, and one last question... does the problem also appear in the pure Clutter demo?
(In reply to Carlos Garnacho from comment #6) > Sorry I lost track of this :(. The patch looks good indeed to me, testing > also comes out positive. Great, thanks. > As for your original issue, I'm kind of clueless... what gtk+ version are > you using? I wonder if it's due to my last activity in bug #750994, but > that's getting old... It doesn't seem to be caused by this: Ubuntu ships with Gtk 3.16.7 but I also tried 3.14.2 with the same result. Also tried some older clutter version but I can reproduce the issue with clutter 1.18.4 and clutter-gtk 1.6 (didn't try older ones). > > I would appreciate some excerpt of XI_Motion events from "xinput test-xi2" > as you scroll, smooth scroll events usually change the valuators 2 and 3. For scroll up I get repeated EVENT type 15 (RawButtonPress) device: 2 (9) detail: 4 valuators: flags: EVENT type 16 (RawButtonRelease) device: 2 (9) detail: 4 valuators: flags: and for scroll down EVENT type 15 (RawButtonPress) device: 2 (9) detail: 5 valuators: flags: EVENT type 16 (RawButtonRelease) device: 2 (9) detail: 5 valuators: flags: It seems the valuators are missing completely. > To > check at the GTK+ level, you could maybe run launcher-gtk with > GDK_DEBUG=events, debug output should show you the deltas seen in > GdkEventScroll events. This corresponds to the above: up: Gdk-Message: property notify: window: 52428825, atom(289): "_NET_WM_USER_TIME" Gdk-Message: button press: window 52428834 device:2 source device:9 button number: 4 x,y: 95.00 130.00 Gdk-Message: button release: window 52428834 device:2 source device:9 button number: 4 x,y: 95.00 130.00 down: Gdk-Message: property notify: window: 52428825, atom(289): "_NET_WM_USER_TIME" Gdk-Message: button press: window 52428834 device:2 source device:9 button number: 5 x,y: 130.00 36.00 Gdk-Message: button release: window 52428834 device:2 source device:9 button number: 5 x,y: 130.00 36.00 > It might also help if you compiled gtk+, clutter and clutter-gtk master in > your development environment one by one and checked whether the issue is > gone. It might also be an interoperation issue with Parallels that's still > unresolved, but I guess it'd show up somewhere else... > > Oh, and one last question... does the problem also appear in the pure > Clutter demo? Yes, the problem is present there too. Finally, I tried with an "old" Linux Mint distro with Gtk 3.10.8, clutter 1.16.4, clutter-gtk 1.4.4 which works. I get the same result from "xinput test-xi2" here but this time the events aren't delivered as SMOOTH but UP/DOWN instead which works. So to me it looks like some problem with the SMOOTH event implementation (maybe if valuators value is missing, UP/DOWN event should be generated instead of SMOOTH?).
-- GitLab Migration Automatic Message -- This bug has been migrated to GNOME's GitLab instance and has been closed from further activity. You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.gnome.org/GNOME/libchamplain/issues/26.