[gtk/present-toplevel-2: 48/59] Drop root coordinates from _gdk_device_query_state



commit 3246099b26e82b715168e19aa90740e3a2349bce
Author: Matthias Clasen <mclasen redhat com>
Date:   Mon Mar 9 12:16:01 2020 -0700

    Drop root coordinates from _gdk_device_query_state
    
    Callers are not using them anyway. Update all callers.

 gdk/broadway/gdkdevice-broadway.c  | 26 +++++++++-----------------
 gdk/broadway/gdksurface-broadway.c |  1 -
 gdk/gdkdevice.c                    |  6 +-----
 gdk/gdkdeviceprivate.h             |  4 ----
 gdk/wayland/gdkdevice-wayland.c    | 21 ---------------------
 gdk/wayland/gdksurface-wayland.c   |  1 -
 gdk/win32/gdkdevice-virtual.c      |  3 ---
 gdk/win32/gdkdrag-win32.c          |  2 +-
 gdk/x11/gdkdevice-xi2.c            | 13 +------------
 gdk/x11/gdkdrag-x11.c              |  4 ++--
 gdk/x11/gdksurface-x11.c           |  1 -
 11 files changed, 14 insertions(+), 68 deletions(-)
---
diff --git a/gdk/broadway/gdkdevice-broadway.c b/gdk/broadway/gdkdevice-broadway.c
index 52ffa719db..837b48b4f0 100644
--- a/gdk/broadway/gdkdevice-broadway.c
+++ b/gdk/broadway/gdkdevice-broadway.c
@@ -37,12 +37,10 @@ static void gdk_broadway_device_set_surface_cursor (GdkDevice *device,
                                                     GdkSurface *surface,
                                                     GdkCursor *cursor);
 static void gdk_broadway_device_query_state (GdkDevice        *device,
-                                             GdkSurface        *surface,
-                                             GdkSurface       **child_surface,
-                                             gdouble          *root_x,
-                                             gdouble          *root_y,
-                                             gdouble          *win_x,
-                                             gdouble          *win_y,
+                                             GdkSurface       *surface,
+                                             GdkSurface      **child_surface,
+                                             double           *win_x,
+                                             double           *win_y,
                                              GdkModifierType  *mask);
 static GdkGrabStatus gdk_broadway_device_grab   (GdkDevice     *device,
                                                  GdkSurface     *surface,
@@ -123,14 +121,12 @@ gdk_broadway_device_set_surface_cursor (GdkDevice *device,
 }
 
 static void
-gdk_broadway_device_query_state (GdkDevice        *device,
+gdk_broadway_device_query_state (GdkDevice         *device,
                                  GdkSurface        *surface,
                                  GdkSurface       **child_surface,
-                                 gdouble          *root_x,
-                                 gdouble          *root_y,
-                                 gdouble          *win_x,
-                                 gdouble          *win_y,
-                                 GdkModifierType  *mask)
+                                 double            *win_x,
+                                 double            *win_y,
+                                 GdkModifierType   *mask)
 {
   GdkDisplay *display;
   GdkBroadwayDisplay *broadway_display;
@@ -150,10 +146,6 @@ gdk_broadway_device_query_state (GdkDevice        *device,
                                     &device_root_y,
                                     &mask32);
 
-  if (root_x)
-    *root_x = device_root_x;
-  if (root_y)
-    *root_y = device_root_y;
   if (win_x)
     *win_x = device_root_x;
   if (win_y)
@@ -305,7 +297,7 @@ gdk_broadway_device_surface_at_position (GdkDevice       *device,
 {
   GdkSurface *surface = NULL;
 
-  gdk_broadway_device_query_state (device, NULL, &surface, NULL, NULL, win_x, win_y, mask);
+  gdk_broadway_device_query_state (device, NULL, &surface, win_x, win_y, mask);
 
   return surface;
 }
diff --git a/gdk/broadway/gdksurface-broadway.c b/gdk/broadway/gdksurface-broadway.c
index b3ced7cf67..ed377a3ca3 100644
--- a/gdk/broadway/gdksurface-broadway.c
+++ b/gdk/broadway/gdksurface-broadway.c
@@ -667,7 +667,6 @@ gdk_broadway_surface_get_device_state (GdkSurface      *surface,
 
   GDK_DEVICE_GET_CLASS (device)->query_state (device, surface,
                                               &child,
-                                              NULL, NULL,
                                               x, y, mask);
   return child != NULL;
 }
diff --git a/gdk/gdkdevice.c b/gdk/gdkdevice.c
index ac15dd6499..2123dc1dd7 100644
--- a/gdk/gdkdevice.c
+++ b/gdk/gdkdevice.c
@@ -526,7 +526,7 @@ gdk_device_get_position (GdkDevice *device,
   g_return_if_fail (gdk_device_get_device_type (device) != GDK_DEVICE_TYPE_SLAVE ||
                     gdk_display_device_is_grabbed (gdk_device_get_display (device), device));
 
-  _gdk_device_query_state (device, NULL, NULL, x, y, NULL, NULL, NULL);
+  _gdk_device_query_state (device, NULL, NULL, x, y, NULL);
 }
 
 /**
@@ -1508,8 +1508,6 @@ void
 _gdk_device_query_state (GdkDevice        *device,
                          GdkSurface        *surface,
                          GdkSurface       **child_surface,
-                         gdouble          *root_x,
-                         gdouble          *root_y,
                          gdouble          *win_x,
                          gdouble          *win_y,
                          GdkModifierType  *mask)
@@ -1517,8 +1515,6 @@ _gdk_device_query_state (GdkDevice        *device,
   GDK_DEVICE_GET_CLASS (device)->query_state (device,
                                               surface,
                                               child_surface,
-                                              root_x,
-                                              root_y,
                                               win_x,
                                               win_y,
                                               mask);
diff --git a/gdk/gdkdeviceprivate.h b/gdk/gdkdeviceprivate.h
index 9135edaac2..7e74d38d3e 100644
--- a/gdk/gdkdeviceprivate.h
+++ b/gdk/gdkdeviceprivate.h
@@ -88,8 +88,6 @@ struct _GdkDeviceClass
   void (* query_state)       (GdkDevice       *device,
                               GdkSurface       *surface,
                               GdkSurface      **child_surface,
-                              gdouble          *root_x,
-                              gdouble          *root_y,
                               gdouble          *win_x,
                               gdouble          *win_y,
                               GdkModifierType  *mask);
@@ -162,8 +160,6 @@ void _gdk_device_remove_slave (GdkDevice *device,
 void _gdk_device_query_state                  (GdkDevice        *device,
                                                GdkSurface        *surface,
                                                GdkSurface       **child_surface,
-                                               gdouble          *root_x,
-                                               gdouble          *root_y,
                                                gdouble          *win_x,
                                                gdouble          *win_y,
                                                GdkModifierType  *mask);
diff --git a/gdk/wayland/gdkdevice-wayland.c b/gdk/wayland/gdkdevice-wayland.c
index f063563aae..0c850147f4 100644
--- a/gdk/wayland/gdkdevice-wayland.c
+++ b/gdk/wayland/gdkdevice-wayland.c
@@ -551,15 +551,12 @@ static void
 gdk_wayland_device_query_state (GdkDevice        *device,
                                 GdkSurface       *surface,
                                 GdkSurface      **child_surface,
-                                gdouble          *root_x,
-                                gdouble          *root_y,
                                 gdouble          *win_x,
                                 gdouble          *win_y,
                                 GdkModifierType  *mask)
 {
   GdkWaylandPointerData *pointer;
   GList *children = NULL;
-  int x_root, y_root;
 
   if (surface == NULL)
     children = gdk_wayland_display_get_toplevel_surfaces (gdk_device_get_display (device));
@@ -576,24 +573,6 @@ gdk_wayland_device_query_state (GdkDevice        *device,
     *win_x = pointer->surface_x;
   if (win_y)
     *win_y = pointer->surface_y;
-
-  if (pointer->focus)
-    {
-      gdk_surface_get_root_coords (pointer->focus,
-                                  pointer->surface_x,
-                                  pointer->surface_y,
-                                  &x_root, &y_root);
-    }
-  else
-    {
-      x_root = pointer->surface_x;
-      y_root = pointer->surface_y;
-    }
-
-  if (root_x)
-    *root_x = x_root;
-  if (root_y)
-    *root_y = y_root;
 }
 
 static void
diff --git a/gdk/wayland/gdksurface-wayland.c b/gdk/wayland/gdksurface-wayland.c
index 166a139913..d7bfbfb5ef 100644
--- a/gdk/wayland/gdksurface-wayland.c
+++ b/gdk/wayland/gdksurface-wayland.c
@@ -2859,7 +2859,6 @@ gdk_wayland_surface_get_device_state (GdkSurface       *surface,
 
       GDK_DEVICE_GET_CLASS (device)->query_state (device, surface,
                                                   &child,
-                                                  NULL, NULL,
                                                   x, y, mask);
       return_val = (child != NULL);
     }
diff --git a/gdk/win32/gdkdevice-virtual.c b/gdk/win32/gdkdevice-virtual.c
index d876e2608b..4435cf5a20 100644
--- a/gdk/win32/gdkdevice-virtual.c
+++ b/gdk/win32/gdkdevice-virtual.c
@@ -116,8 +116,6 @@ static void
 gdk_device_virtual_query_state (GdkDevice        *device,
                                GdkSurface        *window,
                                GdkSurface       **child_window,
-                               gdouble          *root_x,
-                               gdouble          *root_y,
                                gdouble          *win_x,
                                gdouble          *win_y,
                                GdkModifierType  *mask)
@@ -126,7 +124,6 @@ gdk_device_virtual_query_state (GdkDevice        *device,
 
   _gdk_device_query_state (virtual->active_device,
                           window, child_window,
-                          root_x, root_y,
                           win_x, win_y,
                           mask);
 }
diff --git a/gdk/win32/gdkdrag-win32.c b/gdk/win32/gdkdrag-win32.c
index 59b749add4..e4084e0b6b 100644
--- a/gdk/win32/gdkdrag-win32.c
+++ b/gdk/win32/gdkdrag-win32.c
@@ -2440,7 +2440,7 @@ gdk_dnd_handle_key_event (GdkDrag  *drag,
   /* The state is not yet updated in the event, so we need
    * to query it here.
    */
-  _gdk_device_query_state (pointer, NULL, NULL, NULL, NULL, NULL, NULL, &state);
+  _gdk_device_query_state (pointer, NULL, NULL, NULL, NULL, &state);
 
   if (dx != 0 || dy != 0)
     {
diff --git a/gdk/x11/gdkdevice-xi2.c b/gdk/x11/gdkdevice-xi2.c
index 40c0e8bb07..8ec598f311 100644
--- a/gdk/x11/gdkdevice-xi2.c
+++ b/gdk/x11/gdkdevice-xi2.c
@@ -80,8 +80,6 @@ static void gdk_x11_device_xi2_set_surface_cursor (GdkDevice *device,
 static void gdk_x11_device_xi2_query_state (GdkDevice        *device,
                                             GdkSurface        *surface,
                                             GdkSurface       **child_surface,
-                                            gdouble          *root_x,
-                                            gdouble          *root_y,
                                             gdouble          *win_x,
                                             gdouble          *win_y,
                                             GdkModifierType  *mask);
@@ -259,7 +257,6 @@ gdk_x11_device_xi2_get_state (GdkDevice       *device,
     gdk_x11_device_xi2_query_state (device, surface,
                                     NULL,
                                     NULL, NULL,
-                                    NULL, NULL,
                                     mask);
 }
 
@@ -289,8 +286,6 @@ static void
 gdk_x11_device_xi2_query_state (GdkDevice        *device,
                                 GdkSurface        *surface,
                                 GdkSurface       **child_surface,
-                                gdouble          *root_x,
-                                gdouble          *root_y,
                                 gdouble          *win_x,
                                 gdouble          *win_y,
                                 GdkModifierType  *mask)
@@ -324,7 +319,7 @@ gdk_x11_device_xi2_query_state (GdkDevice        *device,
 
       if (master)
         _gdk_device_query_state (master, surface, child_surface,
-                                 root_x, root_y, win_x, win_y, mask);
+                                 win_x, win_y, mask);
       return;
     }
 
@@ -366,12 +361,6 @@ gdk_x11_device_xi2_query_state (GdkDevice        *device,
   if (child_surface)
     *child_surface = gdk_x11_surface_lookup_for_display (display, xchild_window);
 
-  if (root_x)
-    *root_x = xroot_x / scale;
-
-  if (root_y)
-    *root_y = xroot_y / scale;
-
   if (win_x)
     *win_x = xwin_x / scale;
 
diff --git a/gdk/x11/gdkdrag-x11.c b/gdk/x11/gdkdrag-x11.c
index b336cecc59..f2856b891b 100644
--- a/gdk/x11/gdkdrag-x11.c
+++ b/gdk/x11/gdkdrag-x11.c
@@ -2010,7 +2010,7 @@ _gdk_x11_surface_drag_begin (GdkSurface         *surface,
 
   precache_target_list (drag);
 
-  gdk_device_get_position (device, &px, &py);
+  _gdk_device_query_state (device, surface, NULL, &px, &py, NULL);
 
   gdk_x11_surface_get_root_coords (surface,
                                    round (px) + dx,
@@ -2264,7 +2264,7 @@ gdk_dnd_handle_key_event (GdkDrag           *drag,
    * to query it here. We could use XGetModifierMapping, but
    * that would be overkill.
    */
-  _gdk_device_query_state (pointer, NULL, NULL, NULL, NULL, NULL, NULL, &state);
+  _gdk_device_query_state (pointer, NULL, NULL, NULL, NULL, &state);
 
   if (dx != 0 || dy != 0)
     {
diff --git a/gdk/x11/gdksurface-x11.c b/gdk/x11/gdksurface-x11.c
index 1be2f82acc..7276196f63 100644
--- a/gdk/x11/gdksurface-x11.c
+++ b/gdk/x11/gdksurface-x11.c
@@ -2589,7 +2589,6 @@ gdk_x11_surface_get_device_state (GdkSurface       *surface,
   /*HIDPI: handle coords here?*/
   GDK_DEVICE_GET_CLASS (device)->query_state (device, surface,
                                               &child,
-                                              NULL, NULL,
                                               x, y, mask);
   return child != NULL;
 }


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