[gtk+] Use the client pointer for events with no device.



commit b1dec866e595818f80532004064b5e1d399f2eb5
Author: Carlos Garnacho <carlosg gnome org>
Date:   Thu Oct 28 23:01:16 2010 +0200

    Use the client pointer for events with no device.
    
    The core pointer is sort of meaningless in a multidevice environment,
    the client pointer is used instead to fake a GdkDevice on events that
    don't have one.

 gdk/gdkevents.c |   10 ++++++----
 1 files changed, 6 insertions(+), 4 deletions(-)
---
diff --git a/gdk/gdkevents.c b/gdk/gdkevents.c
index 7d7a7db..920245d 100644
--- a/gdk/gdkevents.c
+++ b/gdk/gdkevents.c
@@ -1032,20 +1032,22 @@ gdk_event_get_device (const GdkEvent *event)
     case GDK_KEY_RELEASE:
       {
         GdkDisplay *display;
-        GdkDevice *core_pointer;
+        GdkDeviceManager *device_manager;
+        GdkDevice *client_pointer;
 
         g_warning ("Event with type %d not holding a GdkDevice. "
                    "It is most likely synthesized outside Gdk/GTK+\n",
                    event->type);
 
         display = gdk_window_get_display (event->any.window);
-        core_pointer = gdk_display_get_core_pointer (display);
+        device_manager = gdk_display_get_device_manager (display);
+        client_pointer = gdk_device_manager_get_client_pointer (device_manager);
 
         if (event->type == GDK_KEY_PRESS ||
             event->type == GDK_KEY_RELEASE)
-          return gdk_device_get_associated_device (core_pointer);
+          return gdk_device_get_associated_device (client_pointer);
         else
-          return core_pointer;
+          return client_pointer;
       }
       break;
     default:



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