[gtk/event-source-device] x11: Don't pass the same device twice when creating events



commit 2bf8faf2a08fb005d5abb664ce6e20df894abe90
Author: Matthias Clasen <mclasen redhat com>
Date:   Tue May 19 16:41:17 2020 -0400

    x11: Don't pass the same device twice when creating events
    
    I did not expect XI2, where this slave device idea
    originated, to do this. But it does.

 gdk/x11/gdkdevicemanager-xi2.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)
---
diff --git a/gdk/x11/gdkdevicemanager-xi2.c b/gdk/x11/gdkdevicemanager-xi2.c
index 2fa6a749c5..505f6ab7ef 100644
--- a/gdk/x11/gdkdevicemanager-xi2.c
+++ b/gdk/x11/gdkdevicemanager-xi2.c
@@ -1936,8 +1936,11 @@ gdk_x11_device_manager_xi2_translate_event (GdkEventTranslator *translator,
             device = g_hash_table_lookup (device_manager->id_table,
                                           GINT_TO_POINTER (xev->deviceid));
 
-            source_device = g_hash_table_lookup (device_manager->id_table,
-                                                 GUINT_TO_POINTER (xev->sourceid));
+            if (xev->sourceid != xev->deviceid)
+              source_device = g_hash_table_lookup (device_manager->id_table,
+                                                   GUINT_TO_POINTER (xev->sourceid));
+            else
+              source_device = NULL;
 
             _gdk_device_manager_xi2_handle_focus (surface,
                                                   xev->event,


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]