win32: Stop using _gdk_device_query_state

Directly use the backend implementation.
This commit is contained in:
Matthias Clasen 2020-08-26 15:31:45 -04:00
parent 62a4a356c9
commit 9e06e830b7
7 changed files with 52 additions and 9 deletions

View File

@ -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,7 +93,7 @@ gdk_device_virtual_query_state (GdkDevice *device,
{
GdkDeviceVirtual *virtual = GDK_DEVICE_VIRTUAL (device);
_gdk_device_query_state (virtual->active_device,
_gdk_device_win32_query_state (virtual->active_device,
window, child_window,
win_x, win_y,
mask);

View File

@ -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

View File

@ -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,

View File

@ -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

View File

@ -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;

View File

@ -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__ */

View File

@ -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)
{