summaryrefslogtreecommitdiff
path: root/gdk
diff options
context:
space:
mode:
authorMatthias Clasen <mclasen@redhat.com>2020-08-26 18:02:18 +0000
committerMatthias Clasen <mclasen@redhat.com>2020-08-26 18:02:18 +0000
commit1e4c6cde100f4a3052b340cc1f40eaa85d58fd60 (patch)
treea5c33d033013079610a78965eda4ba17cab65cec /gdk
parent372db8d239844ade457c62e33fa83ff2f806b06a (diff)
parent74a452df6c04c6c9bff82d96c63c90c4f0ad47fd (diff)
downloadgtk+-1e4c6cde100f4a3052b340cc1f40eaa85d58fd60.tar.gz
Merge branch 'matthiasc/for-master' into 'master'
Matthiasc/for master Closes #3090 See merge request GNOME/gtk!2485
Diffstat (limited to 'gdk')
-rw-r--r--gdk/gdksurface.c25
-rw-r--r--gdk/gdksurface.h2
2 files changed, 17 insertions, 10 deletions
diff --git a/gdk/gdksurface.c b/gdk/gdksurface.c
index cf471d49c6..f89061a002 100644
--- a/gdk/gdksurface.c
+++ b/gdk/gdksurface.c
@@ -1627,8 +1627,10 @@ gdk_surface_constrain_size (GdkGeometry *geometry,
* Obtains the current device position in doubles and modifier state.
* The position is given in coordinates relative to the upper left
* corner of @surface.
+ *
+ * Return: %TRUE if the device is over the surface
**/
-void
+gboolean
gdk_surface_get_device_position (GdkSurface *surface,
GdkDevice *device,
double *x,
@@ -1637,17 +1639,20 @@ gdk_surface_get_device_position (GdkSurface *surface,
{
double tmp_x, tmp_y;
GdkModifierType tmp_mask;
+ gboolean ret;
- g_return_if_fail (GDK_IS_SURFACE (surface));
- g_return_if_fail (GDK_IS_DEVICE (device));
- g_return_if_fail (gdk_device_get_source (device) != GDK_SOURCE_KEYBOARD);
+ g_return_val_if_fail (GDK_IS_SURFACE (surface), FALSE);
+ g_return_val_if_fail (GDK_IS_DEVICE (device), FALSE);
+ g_return_val_if_fail (gdk_device_get_source (device) != GDK_SOURCE_KEYBOARD, FALSE);
- tmp_x = tmp_y = 0;
+ tmp_x = 0;
+ tmp_y = 0;
tmp_mask = 0;
- GDK_SURFACE_GET_CLASS (surface)->get_device_state (surface,
- device,
- &tmp_x, &tmp_y,
- &tmp_mask);
+
+ ret = GDK_SURFACE_GET_CLASS (surface)->get_device_state (surface,
+ device,
+ &tmp_x, &tmp_y,
+ &tmp_mask);
if (x)
*x = tmp_x;
@@ -1655,6 +1660,8 @@ gdk_surface_get_device_position (GdkSurface *surface,
*y = tmp_y;
if (mask)
*mask = tmp_mask;
+
+ return ret;
}
/**
diff --git a/gdk/gdksurface.h b/gdk/gdksurface.h
index 9b1613147f..a03b02a4e3 100644
--- a/gdk/gdksurface.h
+++ b/gdk/gdksurface.h
@@ -187,7 +187,7 @@ GDK_AVAILABLE_IN_ALL
int gdk_surface_get_scale_factor (GdkSurface *surface);
GDK_AVAILABLE_IN_ALL
-void gdk_surface_get_device_position (GdkSurface *surface,
+gboolean gdk_surface_get_device_position (GdkSurface *surface,
GdkDevice *device,
double *x,
double *y,