summaryrefslogtreecommitdiff
path: root/gdk/gdkdevice.c
diff options
context:
space:
mode:
authorBenjamin Otte <otte@redhat.com>2010-12-20 15:05:47 +0100
committerMatthias Clasen <mclasen@redhat.com>2010-12-21 12:07:06 -0500
commit66f7c3a5622e5eacafa70b076bbfa7457f2c0345 (patch)
tree9d30fda9dd661404e655467bab41798fac19aaf6 /gdk/gdkdevice.c
parent7a3359223179468b42fa0130457ec60694ce6ec1 (diff)
downloadgtk+-66f7c3a5622e5eacafa70b076bbfa7457f2c0345.tar.gz
API: gdk: gdk_display_warp_device() => gdk_device_warp()
warping devices has nothing to do with displays, so putting it there seems weird.
Diffstat (limited to 'gdk/gdkdevice.c')
-rw-r--r--gdk/gdkdevice.c34
1 files changed, 34 insertions, 0 deletions
diff --git a/gdk/gdkdevice.c b/gdk/gdkdevice.c
index 6b9c693e34..cc375d7b54 100644
--- a/gdk/gdkdevice.c
+++ b/gdk/gdkdevice.c
@@ -1171,6 +1171,40 @@ gdk_device_ungrab (GdkDevice *device,
GDK_DEVICE_GET_CLASS (device)->ungrab (device, time_);
}
+/**
+ * gdk_device_warp:
+ * @device: the device to warp.
+ * @screen: the screen to warp @device to.
+ * @x: the X coordinate of the destination.
+ * @y: the Y coordinate of the destination.
+ *
+ * Warps @device in @display to the point @x,@y on
+ * the screen @screen, unless the device is confined
+ * to a window by a grab, in which case it will be moved
+ * as far as allowed by the grab. Warping the pointer
+ * creates events as if the user had moved the mouse
+ * instantaneously to the destination.
+ *
+ * Note that the pointer should normally be under the
+ * control of the user. This function was added to cover
+ * some rare use cases like keyboard navigation support
+ * for the color picker in the #GtkColorSelectionDialog.
+ *
+ * Since: 3.0
+ **/
+void
+gdk_device_warp (GdkDevice *device,
+ GdkScreen *screen,
+ gint x,
+ gint y)
+{
+ g_return_if_fail (GDK_IS_DEVICE (device));
+ g_return_if_fail (GDK_IS_SCREEN (screen));
+ g_return_if_fail (gdk_device_get_display (device) == gdk_screen_get_display (screen));
+
+ GDK_DEVICE_GET_CLASS (device)->warp (device, screen, x, y);
+}
+
/* Private API */
void
_gdk_device_reset_axes (GdkDevice *device)