[gtk: 1/2] gdk: fix reversed and sluggish scrolling on MacOS
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk: 1/2] gdk: fix reversed and sluggish scrolling on MacOS
- Date: Mon, 14 Feb 2022 23:00:28 +0000 (UTC)
commit 37702af22b2991e8004c18531c809881bac8ed7f
Author: Andy Russell <arussell123 gmail com>
Date: Mon Feb 14 12:43:07 2022 -0500
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
gdk/macos/gdkmacosdisplay-translate.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
---
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);
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]