From: Andy Russell Date: Mon, 14 Feb 2022 17:43:07 +0000 (-0500) Subject: gdk: fix reversed and sluggish scrolling on MacOS X-Git-Tag: archive/raspbian/4.6.5+ds-1+rpi1~1^2~19^2~3^2~98^2 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=37702af22b2991e8004c18531c809881bac8ed7f;p=gtk4.git gdk: fix reversed and sluggish scrolling on MacOS When using an external mouse on MacOS, the scrolling behavior is reversed from the user's scrolling preference. Additionally, it is noticeably sluggish. This commit fixes both issues by negating the deltas and multiplying them by 32 before constructing a new scroll event. 32 seems to be the "traditional" scaling factor according to [Druid], but I'm not sure where that value actually comes from. Regardless, scaling the deltas by this amount makes scrolling feel a lot more responsive in the GTK demos. Scrolling with a trackpad is not affected by either issue because it triggers a different code path that uses more precise deltas, and already negates them. [Druid]: https://linebender.gitbook.io/linebender-graphics-wiki/mouse-wheel#external-mouse-wheel-vs-trackpad --- diff --git a/gdk/macos/gdkmacosdisplay-translate.c b/gdk/macos/gdkmacosdisplay-translate.c index ef73d7c866..4eac28a8af 100644 --- a/gdk/macos/gdkmacosdisplay-translate.c +++ b/gdk/macos/gdkmacosdisplay-translate.c @@ -688,8 +688,8 @@ fill_scroll_event (GdkMacosDisplay *self, NULL, get_time_from_ns_event (nsevent), state, - dx, - dy, + -dx * 32, + -dy * 32, FALSE); } }