[gtk/wip/chergert/for-4-6: 12/56] macos: send stop event when fingers touch
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk/wip/chergert/for-4-6: 12/56] macos: send stop event when fingers touch
- Date: Wed, 16 Mar 2022 19:25:44 +0000 (UTC)
commit 48c650c1021fc263f7ac9d00e84bfba19b789c05
Author: Christian Hergert <christian hergert me>
Date: Sat Feb 26 13:31:18 2022 -0800
macos: send stop event when fingers touch
When the fingers are placed on the touchpad, we get a scroll event with
the phase NSEventPhaseMayBegin. We can use this to synthesize an is_stop
event. This results in the scrolledwindow stopping scroll with stop
gestures.
This can cause another warning as well, however, which should be addressed
from #4730.
Fixes #4733
gdk/macos/gdkmacosdisplay-translate.c | 14 ++++++++++++++
1 file changed, 14 insertions(+)
---
diff --git a/gdk/macos/gdkmacosdisplay-translate.c b/gdk/macos/gdkmacosdisplay-translate.c
index db1cfa2527..e261b8a4ae 100644
--- a/gdk/macos/gdkmacosdisplay-translate.c
+++ b/gdk/macos/gdkmacosdisplay-translate.c
@@ -635,6 +635,20 @@ fill_scroll_event (GdkMacosDisplay *self,
state = _gdk_macos_display_get_current_mouse_modifiers (self) |
_gdk_macos_display_get_current_keyboard_modifiers (self);
+ /* If we are starting a new phase, send a stop so any previous
+ * scrolling immediately stops.
+ */
+ if (phase == NSEventPhaseMayBegin)
+ {
+ ret = gdk_scroll_event_new (GDK_SURFACE (surface),
+ pointer,
+ NULL,
+ get_time_from_ns_event (nsevent),
+ state,
+ 0.0, 0.0, TRUE);
+ _gdk_event_queue_append (GDK_DISPLAY (self), g_steal_pointer (&ret));
+ }
+
dx = [nsevent deltaX];
dy = [nsevent deltaY];
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]