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
This commit is contained in:
Andy Russell
2022-02-14 12:43:07 -05:00
parent 4cb599f378
commit 37702af22b

View File

@@ -688,8 +688,8 @@ fill_scroll_event (GdkMacosDisplay *self,
NULL,
get_time_from_ns_event (nsevent),
state,
dx,
dy,
-dx * 32,
-dy * 32,
FALSE);
}
}