[gtk/matthiasc/for-master: 1/18] win32: Stop using _gdk_device_query_state




commit 9e06e830b7945283fb0851e438c48679c1a8b83e
Author: Matthias Clasen <mclasen redhat com>
Date:   Wed Aug 26 15:31:45 2020 -0400

    win32: Stop using _gdk_device_query_state
    
    Directly use the backend implementation.

 gdk/win32/gdkdevice-virtual.c | 10 +++++-----
 gdk/win32/gdkdevice-virtual.h |  9 +++++++++
 gdk/win32/gdkdevice-win32.c   | 18 ++++++++++++++++++
 gdk/win32/gdkdevice-win32.h   |  7 +++++++
 gdk/win32/gdkdevice-wintab.c  |  4 ++--
 gdk/win32/gdkdevice-wintab.h  |  8 ++++++++
 gdk/win32/gdkdrag-win32.c     |  5 +++--
 7 files changed, 52 insertions(+), 9 deletions(-)
---
diff --git a/gdk/win32/gdkdevice-virtual.c b/gdk/win32/gdkdevice-virtual.c
index cff071de1b..ee852a9cd0 100644
--- a/gdk/win32/gdkdevice-virtual.c
+++ b/gdk/win32/gdkdevice-virtual.c
@@ -83,7 +83,7 @@ gdk_device_virtual_set_surface_cursor (GdkDevice  *device,
   g_set_object (&GDK_WIN32_SURFACE (window)->cursor, win32_hcursor);
 }
 
-static void
+void
 gdk_device_virtual_query_state (GdkDevice        *device,
                                GdkSurface        *window,
                                GdkSurface       **child_window,
@@ -93,10 +93,10 @@ gdk_device_virtual_query_state (GdkDevice        *device,
 {
   GdkDeviceVirtual *virtual = GDK_DEVICE_VIRTUAL (device);
 
-  _gdk_device_query_state (virtual->active_device,
-                          window, child_window,
-                          win_x, win_y,
-                          mask);
+  _gdk_device_win32_query_state (virtual->active_device,
+                                 window, child_window,
+                                 win_x, win_y,
+                                 mask);
 }
 
 static GdkGrabStatus
diff --git a/gdk/win32/gdkdevice-virtual.h b/gdk/win32/gdkdevice-virtual.h
index e44e7339b8..3a98dd05c1 100644
--- a/gdk/win32/gdkdevice-virtual.h
+++ b/gdk/win32/gdkdevice-virtual.h
@@ -48,6 +48,15 @@ GType gdk_device_virtual_get_type (void) G_GNUC_CONST;
 void _gdk_device_virtual_set_active (GdkDevice *device,
                                     GdkDevice *new_active);
 
+void
+gdk_device_virtual_query_state (GdkDevice        *device,
+                                GdkSurface       *window,
+                                GdkSurface      **child_window,
+                                double           *win_x,
+                                double           *win_y,
+                                GdkModifierType  *mask);
+
+
 
 G_END_DECLS
 
diff --git a/gdk/win32/gdkdevice-win32.c b/gdk/win32/gdkdevice-win32.c
index bf74f608e7..c94ae9f731 100644
--- a/gdk/win32/gdkdevice-win32.c
+++ b/gdk/win32/gdkdevice-win32.c
@@ -26,6 +26,8 @@
 #include "gdkdevice-win32.h"
 #include "gdkwin32.h"
 #include "gdkdisplay-win32.h"
+#include "gdkdevice-virtual.h"
+#include "gdkdevice-wintab.h"
 
 G_DEFINE_TYPE (GdkDeviceWin32, gdk_device_win32, GDK_TYPE_DEVICE)
 
@@ -121,6 +123,22 @@ gdk_device_win32_query_state (GdkDevice        *device,
     *mask = get_current_mask ();
 }
 
+void
+_gdk_device_win32_query_state (GdkDevice        *device,
+                               GdkSurface       *window,
+                               GdkSurface      **child_window,
+                               double           *win_x,
+                               double           *win_y,
+                               GdkModifierType  *mask)
+{
+  if (GDK_IS_DEVICE_VIRTUAL (device))
+    gdk_device_virtual_query_state (device, window, child_window, win_x, win_y, mask);
+  else if (GDK_IS_DEVICE_WINTAB (device))
+    gdk_device_wintab_query_state (device, window, child_window, win_x, win_y, mask);
+  else
+    gdk_device_win32_query_state (device, window, child_window, win_x, win_y, mask);
+}
+
 static GdkGrabStatus
 gdk_device_win32_grab (GdkDevice    *device,
                        GdkSurface    *window,
diff --git a/gdk/win32/gdkdevice-win32.h b/gdk/win32/gdkdevice-win32.h
index 2559412426..478afb15bd 100644
--- a/gdk/win32/gdkdevice-win32.h
+++ b/gdk/win32/gdkdevice-win32.h
@@ -48,6 +48,13 @@ GdkSurface *_gdk_device_win32_surface_at_position (GdkDevice       *device,
                                                    double          *win_x,
                                                    double          *win_y,
                                                    GdkModifierType *mask);
+void _gdk_device_win32_query_state             (GdkDevice        *device,
+                                                GdkSurface        *surface,
+                                                GdkSurface       **child_surface,
+                                                double           *win_x,
+                                                double           *win_y,
+                                                GdkModifierType  *mask);
+
 
 G_END_DECLS
 
diff --git a/gdk/win32/gdkdevice-wintab.c b/gdk/win32/gdkdevice-wintab.c
index 50fc2c2e87..498fb2e1d6 100644
--- a/gdk/win32/gdkdevice-wintab.c
+++ b/gdk/win32/gdkdevice-wintab.c
@@ -61,7 +61,7 @@ gdk_device_wintab_set_surface_cursor (GdkDevice *device,
 {
 }
 
-static void
+void
 gdk_device_wintab_query_state (GdkDevice        *device,
                                GdkSurface       *window,
                                GdkSurface      **child_window,
@@ -230,7 +230,7 @@ gdk_device_wintab_class_init (GdkDeviceWintabClass *klass)
   GdkDeviceClass *device_class = GDK_DEVICE_CLASS (klass);
 
   device_class->set_surface_cursor = gdk_device_wintab_set_surface_cursor;
-  device_class->query_state = gdk_device_wintab_query_state;
+  device_class->query_state = gdk_x11_device_xi2_query_state;
   device_class->grab = gdk_device_wintab_grab;
   device_class->ungrab = gdk_device_wintab_ungrab;
   device_class->surface_at_position = gdk_device_wintab_surface_at_position;
diff --git a/gdk/win32/gdkdevice-wintab.h b/gdk/win32/gdkdevice-wintab.h
index 088a84e7f4..bac77b5cd3 100644
--- a/gdk/win32/gdkdevice-wintab.h
+++ b/gdk/win32/gdkdevice-wintab.h
@@ -66,6 +66,14 @@ void         _gdk_device_wintab_translate_axes (GdkDeviceWintab *device,
                                                 double          *x,
                                                 double          *y);
 
+void
+gdk_device_wintab_query_state (GdkDevice        *device,
+                               GdkSurface       *window,
+                               GdkSurface      **child_window,
+                               double           *win_x,
+                               double           *win_y,
+                               GdkModifierType  *mask);
+
 G_END_DECLS
 
 #endif /* __GDK_DEVICE_WINTAB_H__ */
diff --git a/gdk/win32/gdkdrag-win32.c b/gdk/win32/gdkdrag-win32.c
index 53a949b851..c21ac6a476 100644
--- a/gdk/win32/gdkdrag-win32.c
+++ b/gdk/win32/gdkdrag-win32.c
@@ -205,6 +205,7 @@
 #include "gdk/gdkdragprivate.h"
 #include "gdkwin32dnd-private.h"
 #include "gdkdisplay-win32.h"
+#include "gdkdevice-win32.h"
 #include "gdkdeviceprivate.h"
 #include "gdkhdataoutputstream-win32.h"
 
@@ -1730,7 +1731,7 @@ _gdk_win32_surface_drag_begin (GdkSurface         *surface,
 
   GDK_NOTE (DND, g_print ("_gdk_win32_surface_drag_begin\n"));
 
-  _gdk_device_query_state (device, NULL, NULL, &px, &py, NULL);
+  _gdk_device_win32_query_state (device, NULL, NULL, &px, &py, NULL);
   x_root = round (px + dx);
   y_root = round (py + dy);
 
@@ -2440,7 +2441,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, &state);
+  _gdk_device_win32_query_state (pointer, NULL, NULL, NULL, NULL, &state);
 
   if (dx != 0 || dy != 0)
     {


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