summaryrefslogtreecommitdiff
path: root/gdk/win32
diff options
context:
space:
mode:
authorMatthias Clasen <mclasen@redhat.com>2020-08-26 22:34:08 +0000
committerMatthias Clasen <mclasen@redhat.com>2020-08-26 22:34:08 +0000
commit70ae073394caf836fc48bc964740a9ba5c28e052 (patch)
treead81cb49b25d4c95042118ba57be3cc829016f11 /gdk/win32
parent1e4c6cde100f4a3052b340cc1f40eaa85d58fd60 (diff)
parent1c44910dfee8d4b81e9f69fa6b80001d7009e2c4 (diff)
downloadgtk+-70ae073394caf836fc48bc964740a9ba5c28e052.tar.gz
Merge branch 'matthiasc/for-master' into 'master'
Matthiasc/for master See merge request GNOME/gtk!2488
Diffstat (limited to 'gdk/win32')
-rw-r--r--gdk/win32/gdkdevice-virtual.c11
-rw-r--r--gdk/win32/gdkdevice-virtual.h9
-rw-r--r--gdk/win32/gdkdevice-win32.c19
-rw-r--r--gdk/win32/gdkdevice-win32.h7
-rw-r--r--gdk/win32/gdkdevice-wintab.c3
-rw-r--r--gdk/win32/gdkdevice-wintab.h8
-rw-r--r--gdk/win32/gdkdrag-win32.c5
-rw-r--r--gdk/win32/gdksurface-win32.c18
8 files changed, 58 insertions, 22 deletions
diff --git a/gdk/win32/gdkdevice-virtual.c b/gdk/win32/gdkdevice-virtual.c
index cff071de1b..83742c7763 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
@@ -160,7 +160,6 @@ gdk_device_virtual_class_init (GdkDeviceVirtualClass *klass)
GdkDeviceClass *device_class = GDK_DEVICE_CLASS (klass);
device_class->set_surface_cursor = gdk_device_virtual_set_surface_cursor;
- device_class->query_state = gdk_device_virtual_query_state;
device_class->grab = gdk_device_virtual_grab;
device_class->ungrab = gdk_device_virtual_ungrab;
device_class->surface_at_position = _gdk_device_win32_surface_at_position;
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..90fae48ac1 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,
@@ -208,7 +226,6 @@ gdk_device_win32_class_init (GdkDeviceWin32Class *klass)
GdkDeviceClass *device_class = GDK_DEVICE_CLASS (klass);
device_class->set_surface_cursor = gdk_device_win32_set_surface_cursor;
- device_class->query_state = gdk_device_win32_query_state;
device_class->grab = gdk_device_win32_grab;
device_class->ungrab = gdk_device_win32_ungrab;
device_class->surface_at_position = _gdk_device_win32_surface_at_position;
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..6e94545767 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,6 @@ 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->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)
{
diff --git a/gdk/win32/gdksurface-win32.c b/gdk/win32/gdksurface-win32.c
index 4078635148..33a279f8e1 100644
--- a/gdk/win32/gdksurface-win32.c
+++ b/gdk/win32/gdksurface-win32.c
@@ -1724,20 +1724,16 @@ gdk_win32_surface_get_root_coords (GdkSurface *window,
}
static gboolean
-gdk_surface_win32_get_device_state (GdkSurface *window,
- GdkDevice *device,
- double *x,
- double *y,
- GdkModifierType *mask)
+gdk_surface_win32_get_device_state (GdkSurface *window,
+ GdkDevice *device,
+ double *x,
+ double *y,
+ GdkModifierType *mask)
{
- GdkSurface *child;
+ _gdk_device_win32_query_state (device, window, NULL, x, y, mask);
- g_return_val_if_fail (window == NULL || GDK_IS_SURFACE (window), FALSE);
+ return *x >= 0 && *y >= 0 && *x < window->width && *y < window->height;
- GDK_DEVICE_GET_CLASS (device)->query_state (device, window,
- &child,
- x, y, mask);
- return (child != NULL);
}
static void