[mutter/wip/carlosg/input-thread: 12/65] backends: Drop GDK device querying code from MetaCursorTracker




commit abb33df0bd6203c2e458215906722477a9d4f16f
Author: Carlos Garnacho <carlosg gnome org>
Date:   Sat Jun 6 13:04:32 2020 +0200

    backends: Drop GDK device querying code from MetaCursorTracker
    
    Clutter behavior is now equivalent to GDK's on X11, avoid poking to
    GDK here.
    
    https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1403

 src/backends/meta-cursor-tracker.c | 58 ++++----------------------------------
 1 file changed, 5 insertions(+), 53 deletions(-)
---
diff --git a/src/backends/meta-cursor-tracker.c b/src/backends/meta-cursor-tracker.c
index caac5827da..f90fd768b0 100644
--- a/src/backends/meta-cursor-tracker.c
+++ b/src/backends/meta-cursor-tracker.c
@@ -31,8 +31,6 @@
 
 #include "backends/meta-cursor-tracker-private.h"
 
-#include <gdk/gdk.h>
-#include <gdk/gdkx.h>
 #include <string.h>
 
 #include "backends/meta-backend-private.h"
@@ -464,36 +462,10 @@ meta_cursor_tracker_update_position (MetaCursorTracker *tracker,
     g_signal_emit (tracker, signals[CURSOR_MOVED], 0, new_x, new_y);
 }
 
-static void
-get_pointer_position_gdk (graphene_point_t *point,
-                          int              *mods)
-{
-  GdkSeat *gseat;
-  GdkDevice *gdevice;
-  GdkScreen *gscreen;
-  double x, y;
-
-  gseat = gdk_display_get_default_seat (gdk_display_get_default ());
-  gdevice = gdk_seat_get_pointer (gseat);
-
-  /* Even if point is NULL we need this to get gscreen */
-  gdk_device_get_position_double (gdevice, &gscreen, &x, &y);
-
-  if (point)
-    {
-      point->x = x;
-      point->y = y;
-    }
-
-  if (mods)
-    gdk_device_get_state (gdevice,
-                          gdk_screen_get_root_window (gscreen),
-                          NULL, (GdkModifierType*)mods);
-}
-
-static void
-get_pointer_position_clutter (graphene_point_t *point,
-                              int              *mods)
+void
+meta_cursor_tracker_get_pointer (MetaCursorTracker   *tracker,
+                                 graphene_point_t    *coords,
+                                 ClutterModifierType *mods)
 {
   ClutterSeat *seat;
   ClutterInputDevice *cdevice;
@@ -501,27 +473,7 @@ get_pointer_position_clutter (graphene_point_t *point,
   seat = clutter_backend_get_default_seat (clutter_get_default_backend ());
   cdevice = clutter_seat_get_pointer (seat);
 
-  if (point)
-    clutter_input_device_get_coords (cdevice, NULL, point);
-
-  if (mods)
-    *mods = clutter_input_device_get_modifier_state (cdevice);
-}
-
-void
-meta_cursor_tracker_get_pointer (MetaCursorTracker   *tracker,
-                                 graphene_point_t    *coords,
-                                 ClutterModifierType *mods)
-{
-  /* We can't use the clutter interface when not running as a wayland compositor,
-     because we need to query the server, rather than using the last cached value.
-     OTOH, on wayland we can't use GDK, because that only sees the events
-     we forward to xwayland.
-  */
-  if (meta_is_wayland_compositor ())
-    get_pointer_position_clutter (coords, (int *) mods);
-  else
-    get_pointer_position_gdk (coords, (int *) mods);
+  clutter_seat_query_state (seat, cdevice, NULL, coords, mods);
 }
 
 void


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