[gtk/wip/carlosg/more-device-api-cleanup: 1/13] gdk: Avoid gdk_device_get_associated_device()




commit 94982dbab7189eab96c2f2a6e91427efd7e68b1f
Author: Carlos Garnacho <carlosg gnome org>
Date:   Thu Jul 30 14:26:51 2020 +0200

    gdk: Avoid gdk_device_get_associated_device()
    
    Query the seat for that.

 gdk/gdkdisplay.c | 10 ++++++++--
 gdk/gdksurface.c |  2 +-
 2 files changed, 9 insertions(+), 3 deletions(-)
---
diff --git a/gdk/gdkdisplay.c b/gdk/gdkdisplay.c
index 7d8d7cb9ac..14abf69c73 100644
--- a/gdk/gdkdisplay.c
+++ b/gdk/gdkdisplay.c
@@ -816,9 +816,15 @@ _gdk_display_get_pointer_info (GdkDisplay *display,
                                GdkDevice  *device)
 {
   GdkPointerSurfaceInfo *info;
+  GdkSeat *seat;
 
-  if (device && gdk_device_get_source (device) == GDK_SOURCE_KEYBOARD)
-    device = gdk_device_get_associated_device (device);
+  if (device)
+    {
+      seat = gdk_device_get_seat (device);
+
+      if (device == gdk_seat_get_keyboard (seat))
+        device = gdk_seat_get_pointer (seat);
+    }
 
   if (G_UNLIKELY (!device))
     return NULL;
diff --git a/gdk/gdksurface.c b/gdk/gdksurface.c
index bf313c9204..944b34ab4d 100644
--- a/gdk/gdksurface.c
+++ b/gdk/gdksurface.c
@@ -1807,7 +1807,7 @@ gdk_surface_set_cursor (GdkSurface *surface,
           devices = gdk_seat_get_physical_devices (s->data, GDK_SEAT_CAPABILITY_TABLET_STYLUS);
           for (d = devices; d; d = d->next)
             {
-              device = gdk_device_get_associated_device (d->data);
+              device = d->data;
               gdk_surface_set_cursor_internal (surface, device, surface->cursor);
             }
           g_list_free (devices);


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