Commit 66f7c3a5 authored by Benjamin Otte's avatar Benjamin Otte Committed by Matthias Clasen

API: gdk: gdk_display_warp_device() => gdk_device_warp()

warping devices has nothing to do with displays, so putting it there
seems weird.
parent 7a335922
......@@ -135,7 +135,6 @@ gdk_display_set_pointer_hooks
GdkDisplayDeviceHooks
gdk_display_set_device_hooks
gdk_display_warp_pointer
gdk_display_warp_device
gdk_display_supports_cursor_color
gdk_display_supports_cursor_alpha
gdk_display_get_default_cursor_size
......@@ -716,6 +715,7 @@ gdk_device_get_display
gdk_device_get_has_cursor
gdk_device_get_n_axes
gdk_device_get_n_keys
gdk_device_warp
<SUBSECTION>
gdk_device_grab
......
......@@ -79,6 +79,7 @@ gdk_device_set_mode
gdk_device_set_source
gdk_device_type_get_type G_GNUC_CONST
gdk_device_ungrab
gdk_device_warp
gdk_disable_multidevice
gdk_display_add_client_message_filter
gdk_display_beep
......@@ -130,7 +131,6 @@ gdk_display_supports_input_shapes
gdk_display_supports_selection_notification
gdk_display_supports_shapes
gdk_display_sync
gdk_display_warp_device
gdk_display_warp_pointer
gdk_drag_abort
gdk_drag_action_get_type G_GNUC_CONST
......
......@@ -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)
......
......@@ -229,6 +229,11 @@ GdkGrabStatus gdk_device_grab (GdkDevice *device,
void gdk_device_ungrab (GdkDevice *device,
guint32 time_);
void gdk_device_warp (GdkDevice *device,
GdkScreen *screen,
gint x,
gint y);
gboolean gdk_device_grab_info_libgtk_only (GdkDisplay *display,
GdkDevice *device,
GdkWindow **grab_window,
......
......@@ -2393,7 +2393,7 @@ gdk_display_get_maximal_cursor_size (GdkDisplay *display,
*
* Since: 2.8
*
* Deprecated: 3.0: Use gdk_display_warp_device() instead.
* Deprecated: 3.0: Use gdk_device_warp() instead.
*/
void
gdk_display_warp_pointer (GdkDisplay *display,
......@@ -2401,47 +2401,9 @@ gdk_display_warp_pointer (GdkDisplay *display,
gint x,
gint y)
{
gdk_display_warp_device (display,
display->core_pointer,
screen,
x, y);
}
/**
* gdk_display_warp_device:
* @display: a #GdkDisplay.
* @device: a #GdkDevice.
* @screen: the screen of @display 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_display_warp_device (GdkDisplay *display,
GdkDevice *device,
GdkScreen *screen,
gint x,
gint y)
{
g_return_if_fail (GDK_IS_DISPLAY (display));
g_return_if_fail (GDK_IS_DEVICE (device));
g_return_if_fail (GDK_IS_SCREEN (screen));
g_return_if_fail (display == gdk_device_get_display (device));
GDK_DEVICE_GET_CLASS (device)->warp (device, screen, x, y);
gdk_device_warp (display->core_pointer,
screen,
x, y);
}
gulong
......
......@@ -196,11 +196,6 @@ GdkWindow * gdk_display_get_window_at_device_position (GdkDisplay
GdkDevice *device,
gint *win_x,
gint *win_y);
void gdk_display_warp_device (GdkDisplay *display,
GdkDevice *device,
GdkScreen *screen,
gint x,
gint y);
#ifndef GDK_MULTIDEVICE_SAFE
GdkDisplayPointerHooks *gdk_display_set_pointer_hooks (GdkDisplay *display,
......
......@@ -1866,7 +1866,7 @@ key_press (GtkWidget *invisible,
return FALSE;
}
gdk_display_warp_device (display, pointer_device, screen, x + dx, y + dy);
gdk_device_warp (pointer_device, screen, x + dx, y + dy);
return TRUE;
......
......@@ -4255,9 +4255,9 @@ gtk_drag_key_cb (GtkWidget *widget,
{
info->cur_x += dx;
info->cur_y += dy;
gdk_display_warp_device (gtk_widget_get_display (widget), pointer,
gtk_widget_get_screen (widget),
info->cur_x, info->cur_y);
gdk_device_warp (pointer,
gtk_widget_get_screen (widget),
info->cur_x, info->cur_y);
}
gtk_drag_update (info, info->cur_screen, info->cur_x, info->cur_y, (GdkEvent *)event);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment