[gtk+/wip/frame-synchronization: 848/857] GdkX11DeviceManagerXI2: handle focus events not on a known window



commit b9837bb8f9e04a52eeef229761c548e6afe4afd3
Author: Owen W. Taylor <otaylor fishsoup net>
Date:   Wed Jan 30 15:11:59 2013 -0500

    GdkX11DeviceManagerXI2: handle focus events not on a known window
    
    If we get a focus event for a X window we don't recognize, just
    ignore it and avoid a g-critical when
    _gdk_device_manager_core_handle_focus() is called with a NULL window.

 gdk/x11/gdkdevicemanager-xi2.c |   29 ++++++++++++++++-------------
 1 files changed, 16 insertions(+), 13 deletions(-)
---
diff --git a/gdk/x11/gdkdevicemanager-xi2.c b/gdk/x11/gdkdevicemanager-xi2.c
index a0fba5f..62c108e 100644
--- a/gdk/x11/gdkdevicemanager-xi2.c
+++ b/gdk/x11/gdkdevicemanager-xi2.c
@@ -1569,22 +1569,25 @@ gdk_x11_device_manager_xi2_translate_event (GdkEventTranslator *translator,
     case XI_FocusIn:
     case XI_FocusOut:
       {
-        XIEnterEvent *xev = (XIEnterEvent *) ev;
-        GdkDevice *device, *source_device;
+        if (window)
+          {
+            XIEnterEvent *xev = (XIEnterEvent *) ev;
+            GdkDevice *device, *source_device;
 
-        device = g_hash_table_lookup (device_manager->id_table,
-                                      GINT_TO_POINTER (xev->deviceid));
+            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));
+            source_device = g_hash_table_lookup (device_manager->id_table,
+                                                 GUINT_TO_POINTER (xev->sourceid));
 
-        _gdk_device_manager_core_handle_focus (window,
-                                               xev->event,
-                                               device,
-                                               source_device,
-                                               (ev->evtype == XI_FocusIn) ? TRUE : FALSE,
-                                               xev->detail,
-                                               xev->mode);
+            _gdk_device_manager_core_handle_focus (window,
+                                                   xev->event,
+                                                   device,
+                                                   source_device,
+                                                   (ev->evtype == XI_FocusIn) ? TRUE : FALSE,
+                                                   xev->detail,
+                                                   xev->mode);
+          }
 
         return_val = FALSE;
       }


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