From 12da0a6db1ea7d146a3aa71e33bfae95a13f35d9 Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Wed, 29 May 2019 07:44:17 -0400 Subject: [PATCH] Drop gdk_device_get_position Root coordinates are going away, so this api does not make sense anymore. Use gdk_surface_get_device_position instead. We still keep this as internal api for root-coordinate using backends. --- docs/reference/gdk/gdk4-sections.txt | 1 - gdk/gdkdevice.c | 25 ++++++------------------- gdk/gdkdevice.h | 4 ---- gdk/gdkinternals.h | 5 +++++ 4 files changed, 11 insertions(+), 24 deletions(-) diff --git a/docs/reference/gdk/gdk4-sections.txt b/docs/reference/gdk/gdk4-sections.txt index 3aa9caa9ca..c2b2598989 100644 --- a/docs/reference/gdk/gdk4-sections.txt +++ b/docs/reference/gdk/gdk4-sections.txt @@ -479,7 +479,6 @@ gdk_device_get_seat gdk_device_get_state -gdk_device_get_position gdk_device_get_surface_at_position gdk_device_get_history gdk_device_free_history diff --git a/gdk/gdkdevice.c b/gdk/gdkdevice.c index b352a84411..532d5c519c 100644 --- a/gdk/gdkdevice.c +++ b/gdk/gdkdevice.c @@ -528,24 +528,20 @@ gdk_device_get_state (GdkDevice *device, GDK_DEVICE_GET_CLASS (device)->get_state (device, surface, axes, mask); } -/** +/* * gdk_device_get_position: * @device: pointer device to query status about. - * @x: (out) (allow-none): location to store root window X coordinate of @device, or %NULL. - * @y: (out) (allow-none): location to store root window Y coordinate of @device, or %NULL. + * @x: (out): location to store root window X coordinate of @device + * @y: (out): location to store root window Y coordinate of @device * - * Gets the current location of @device in double precision. As a slave device's - * coordinates are those of its master pointer, this function - * may not be called on devices of type %GDK_DEVICE_TYPE_SLAVE, - * unless there is an ongoing grab on them. See gdk_seat_grab(). - **/ + * Gets the current location of @device in double precision. + */ void gdk_device_get_position (GdkDevice *device, double *x, double *y) { GdkDisplay *display; - gdouble tmp_x, tmp_y; g_return_if_fail (GDK_IS_DEVICE (device)); g_return_if_fail (gdk_device_get_source (device) != GDK_SOURCE_KEYBOARD); @@ -555,16 +551,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 (display, device)); - _gdk_device_query_state (device, - NULL, - NULL, - &tmp_x, &tmp_y, - NULL, NULL, NULL); - - if (x) - *x = tmp_x; - if (y) - *y = tmp_y; + _gdk_device_query_state (device, NULL, NULL, x, y, NULL, NULL, NULL); } /** diff --git a/gdk/gdkdevice.h b/gdk/gdkdevice.h index 1e65d6c0ea..27242a8c29 100644 --- a/gdk/gdkdevice.h +++ b/gdk/gdkdevice.h @@ -167,10 +167,6 @@ void gdk_device_get_state (GdkDevice *device, gdouble *axes, GdkModifierType *mask); GDK_AVAILABLE_IN_ALL -void gdk_device_get_position (GdkDevice *device, - double *x, - double *y); -GDK_AVAILABLE_IN_ALL GdkSurface * gdk_device_get_surface_at_position (GdkDevice *device, double *win_x, double *win_y); diff --git a/gdk/gdkinternals.h b/gdk/gdkinternals.h index ad9ca06e05..e23a33338f 100644 --- a/gdk/gdkinternals.h +++ b/gdk/gdkinternals.h @@ -245,6 +245,11 @@ GdkGrabStatus gdk_device_grab (GdkDevice *device, guint32 time_); void gdk_device_ungrab (GdkDevice *device, guint32 time_); +void gdk_device_get_position (GdkDevice *device, + double *x, + double *y); + + void gdk_surface_get_root_coords (GdkSurface *surface, gint x, gint y,