[gtk+/events-refactor: 323/1085] Hook up GdkDeviceManager into current event translation.



commit c09ea067fef9e749feedd455a5cd573c27340adf
Author: Carlos Garnacho <carlosg gnome org>
Date:   Thu May 28 01:50:39 2009 +0200

    Hook up GdkDeviceManager into current event translation.

 gdk/x11/gdkevents-x11.c |   45 ++++++++++++++++++++++++++++-----------------
 1 files changed, 28 insertions(+), 17 deletions(-)
---
diff --git a/gdk/x11/gdkevents-x11.c b/gdk/x11/gdkevents-x11.c
index 359471d..0f3b174 100644
--- a/gdk/x11/gdkevents-x11.c
+++ b/gdk/x11/gdkevents-x11.c
@@ -34,6 +34,7 @@
 #include "gdkscreen-x11.h"
 #include "gdkdisplay-x11.h"
 #include "gdkasync.h"
+#include "gdkeventtranslator.h"
 
 #include "gdkkeysyms.h"
 
@@ -2274,6 +2275,7 @@ _gdk_events_queue (GdkDisplay *display)
   GdkEvent *event;
   XEvent xevent;
   Display *xdisplay = GDK_DISPLAY_XDISPLAY (display);
+  GdkDeviceManager *device_manager;
 
   while (!_gdk_event_queue_find_first(display) && XPending (xdisplay))
     {
@@ -2288,26 +2290,35 @@ _gdk_events_queue (GdkDisplay *display)
 	  if (XFilterEvent (&xevent, None))
 	    continue;
 	}
-      
-      event = gdk_event_new (GDK_NOTHING);
-      
-      event->any.window = NULL;
-      event->any.send_event = xevent.xany.send_event ? TRUE : FALSE;
-
-      ((GdkEventPrivate *)event)->flags |= GDK_EVENT_PENDING;
 
-      node = _gdk_event_queue_append (display, event);
+      device_manager = gdk_device_manager_get_for_display (display);
+      event = gdk_event_translator_translate (GDK_EVENT_TRANSLATOR (device_manager),
+                                              display, &xevent);
 
-      if (gdk_event_translate (display, event, &xevent, FALSE))
-	{
-	  ((GdkEventPrivate *)event)->flags &= ~GDK_EVENT_PENDING;
-	}
+      if (event)
+        node = _gdk_event_queue_append (display, event);
       else
-	{
-	  _gdk_event_queue_remove_link (display, node);
-	  g_list_free_1 (node);
-	  gdk_event_free (event);
-	}
+        {
+          event = gdk_event_new (GDK_NOTHING);
+
+          event->any.window = NULL;
+          event->any.send_event = xevent.xany.send_event ? TRUE : FALSE;
+
+          ((GdkEventPrivate *)event)->flags |= GDK_EVENT_PENDING;
+
+          node = _gdk_event_queue_append (display, event);
+
+          if (gdk_event_translate (display, event, &xevent, FALSE))
+            {
+              ((GdkEventPrivate *)event)->flags &= ~GDK_EVENT_PENDING;
+            }
+          else
+            {
+              _gdk_event_queue_remove_link (display, node);
+              g_list_free_1 (node);
+              gdk_event_free (event);
+            }
+        }
     }
 }
 



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