[gtk+] gdk: Get the right filter window for XI2 events



commit a529568f795c803d1fb579232fc9b0c65193237a
Author: Carlos Garnacho <carlosg gnome org>
Date:   Wed May 18 21:32:22 2011 +0200

    gdk: Get the right filter window for XI2 events
    
    GdkDeviceManagerXI2 now implements GdkEventTranslator::get_window,
    retrieving the right window from the contained XIEvent.

 gdk/x11/gdkdevicemanager-xi2.c |   22 +++++++++++++++++++++-
 1 files changed, 21 insertions(+), 1 deletions(-)
---
diff --git a/gdk/x11/gdkdevicemanager-xi2.c b/gdk/x11/gdkdevicemanager-xi2.c
index f8d5e70..64d0f59 100644
--- a/gdk/x11/gdkdevicemanager-xi2.c
+++ b/gdk/x11/gdkdevicemanager-xi2.c
@@ -91,7 +91,8 @@ static GdkEventMask gdk_x11_device_manager_xi2_get_handled_events   (GdkEventTra
 static void         gdk_x11_device_manager_xi2_select_window_events (GdkEventTranslator *translator,
                                                                      Window              window,
                                                                      GdkEventMask        event_mask);
-
+static GdkWindow *  gdk_x11_device_manager_xi2_get_window           (GdkEventTranslator *translator,
+                                                                     XEvent             *xevent);
 
 enum {
   PROP_0,
@@ -561,6 +562,7 @@ gdk_x11_device_manager_xi2_event_translator_init (GdkEventTranslatorIface *iface
   iface->translate_event = gdk_x11_device_manager_xi2_translate_event;
   iface->get_handled_events = gdk_x11_device_manager_xi2_get_handled_events;
   iface->select_window_events = gdk_x11_device_manager_xi2_select_window_events;
+  iface->get_window = gdk_x11_device_manager_xi2_get_window;
 }
 
 static void
@@ -1348,6 +1350,24 @@ gdk_x11_device_manager_xi2_select_window_events (GdkEventTranslator *translator,
   g_free (event_mask.mask);
 }
 
+static GdkWindow *
+gdk_x11_device_manager_xi2_get_window (GdkEventTranslator *translator,
+                                       XEvent             *xevent)
+{
+  GdkX11DeviceManagerXI2 *device_manager;
+  XIEvent *ev;
+
+  device_manager = (GdkX11DeviceManagerXI2 *) translator;
+
+  if (xevent->type != GenericEvent ||
+      xevent->xcookie.extension != device_manager->opcode)
+    return NULL;
+
+  ev = (XIEvent *) xevent->xcookie.data;
+
+  return get_event_window (translator, ev);
+}
+
 #else /* XINPUT_2 */
 
 static void



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