[gtk+] gdk/x11: Avoid delivering emulated scroll events
- From: Carlos Garnacho <carlosg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+] gdk/x11: Avoid delivering emulated scroll events
- Date: Tue, 19 Sep 2017 17:19:37 +0000 (UTC)
commit 2985bf33137eef8f6c0105e682a373b363983661
Author: Carlos Garnacho <carlosg gnome org>
Date: Fri Sep 15 13:21:25 2017 +0200
gdk/x11: Avoid delivering emulated scroll events
We now just propagate the real event, and let the caller deal
with smooth vs discrete.
gdk/x11/gdkdevicemanager-xi2.c | 31 +++++++++++--------------------
1 files changed, 11 insertions(+), 20 deletions(-)
---
diff --git a/gdk/x11/gdkdevicemanager-xi2.c b/gdk/x11/gdkdevicemanager-xi2.c
index 36e3e02..787da0c 100644
--- a/gdk/x11/gdkdevicemanager-xi2.c
+++ b/gdk/x11/gdkdevicemanager-xi2.c
@@ -1537,6 +1537,11 @@ gdk_x11_device_manager_xi2_translate_event (GdkEventTranslator *translator,
xev->detail,
xev->event_x, xev->event_y));
+#ifdef XINPUT_2_2
+ if (xev->flags & XIPointerEmulated)
+ return FALSE;
+#endif
+
if (ev->evtype == XI_ButtonRelease &&
(xev->detail >= 4 && xev->detail <= 7))
return FALSE;
@@ -1574,18 +1579,9 @@ gdk_x11_device_manager_xi2_translate_event (GdkEventTranslator *translator,
gdk_event_set_seat (event, gdk_device_get_seat (device));
event->scroll.state = _gdk_x11_device_xi2_translate_state (&xev->mods, &xev->buttons,
&xev->group);
-
-#ifdef XINPUT_2_2
- if (xev->flags & XIPointerEmulated)
- gdk_event_set_pointer_emulated (event, TRUE);
-#endif
}
else
{
-#ifdef XINPUT_2_2
- if (xev->flags & XIPointerEmulated)
- return FALSE;
-#endif
event->button.type = (ev->evtype == XI_ButtonPress) ? GDK_BUTTON_PRESS : GDK_BUTTON_RELEASE;
event->button.window = window;
@@ -1645,6 +1641,11 @@ gdk_x11_device_manager_xi2_translate_event (GdkEventTranslator *translator,
XIDeviceEvent *xev = (XIDeviceEvent *) ev;
gdouble delta_x, delta_y;
+#ifdef XINPUT_2_2
+ if (xev->flags & XIPointerEmulated)
+ return FALSE;
+#endif
+
source_device = g_hash_table_lookup (device_manager->id_table,
GUINT_TO_POINTER (xev->sourceid));
device = g_hash_table_lookup (device_manager->id_table,
@@ -1669,12 +1670,7 @@ gdk_x11_device_manager_xi2_translate_event (GdkEventTranslator *translator,
event->scroll.is_stop = TRUE;
GDK_NOTE(EVENTS,
- g_message ("smooth scroll: %s\n\tdevice: %u\n\tsource device: %u\n\twindow
%ld\n\tdeltas: %f %f",
-#ifdef XINPUT_2_2
- (xev->flags & XIPointerEmulated) ? "emulated" : "",
-#else
- "",
-#endif
+ g_message ("smooth scroll: \n\tdevice: %u\n\tsource device: %u\n\twindow %ld\n\tdeltas:
%f %f",
xev->deviceid, xev->sourceid,
xev->event, delta_x, delta_y));
@@ -1696,11 +1692,6 @@ gdk_x11_device_manager_xi2_translate_event (GdkEventTranslator *translator,
break;
}
-#ifdef XINPUT_2_2
- if (xev->flags & XIPointerEmulated)
- return FALSE;
-#endif
-
event->motion.type = GDK_MOTION_NOTIFY;
event->motion.window = window;
event->motion.time = xev->time;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]