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

warping devices has nothing to do with displays, so putting it there
seems weird.
This commit is contained in:
Benjamin Otte
2010-12-20 15:05:47 +01:00
committed by Matthias Clasen
parent 7a33592231
commit 66f7c3a562
8 changed files with 49 additions and 53 deletions

View File

@ -135,7 +135,6 @@ gdk_display_set_pointer_hooks
GdkDisplayDeviceHooks GdkDisplayDeviceHooks
gdk_display_set_device_hooks gdk_display_set_device_hooks
gdk_display_warp_pointer gdk_display_warp_pointer
gdk_display_warp_device
gdk_display_supports_cursor_color gdk_display_supports_cursor_color
gdk_display_supports_cursor_alpha gdk_display_supports_cursor_alpha
gdk_display_get_default_cursor_size gdk_display_get_default_cursor_size
@ -716,6 +715,7 @@ gdk_device_get_display
gdk_device_get_has_cursor gdk_device_get_has_cursor
gdk_device_get_n_axes gdk_device_get_n_axes
gdk_device_get_n_keys gdk_device_get_n_keys
gdk_device_warp
<SUBSECTION> <SUBSECTION>
gdk_device_grab gdk_device_grab

View File

@ -79,6 +79,7 @@ gdk_device_set_mode
gdk_device_set_source gdk_device_set_source
gdk_device_type_get_type G_GNUC_CONST gdk_device_type_get_type G_GNUC_CONST
gdk_device_ungrab gdk_device_ungrab
gdk_device_warp
gdk_disable_multidevice gdk_disable_multidevice
gdk_display_add_client_message_filter gdk_display_add_client_message_filter
gdk_display_beep gdk_display_beep
@ -130,7 +131,6 @@ gdk_display_supports_input_shapes
gdk_display_supports_selection_notification gdk_display_supports_selection_notification
gdk_display_supports_shapes gdk_display_supports_shapes
gdk_display_sync gdk_display_sync
gdk_display_warp_device
gdk_display_warp_pointer gdk_display_warp_pointer
gdk_drag_abort gdk_drag_abort
gdk_drag_action_get_type G_GNUC_CONST gdk_drag_action_get_type G_GNUC_CONST

View File

@ -1171,6 +1171,40 @@ gdk_device_ungrab (GdkDevice *device,
GDK_DEVICE_GET_CLASS (device)->ungrab (device, time_); 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 */ /* Private API */
void void
_gdk_device_reset_axes (GdkDevice *device) _gdk_device_reset_axes (GdkDevice *device)

View File

@ -229,6 +229,11 @@ GdkGrabStatus gdk_device_grab (GdkDevice *device,
void gdk_device_ungrab (GdkDevice *device, void gdk_device_ungrab (GdkDevice *device,
guint32 time_); guint32 time_);
void gdk_device_warp (GdkDevice *device,
GdkScreen *screen,
gint x,
gint y);
gboolean gdk_device_grab_info_libgtk_only (GdkDisplay *display, gboolean gdk_device_grab_info_libgtk_only (GdkDisplay *display,
GdkDevice *device, GdkDevice *device,
GdkWindow **grab_window, GdkWindow **grab_window,

View File

@ -2393,7 +2393,7 @@ gdk_display_get_maximal_cursor_size (GdkDisplay *display,
* *
* Since: 2.8 * Since: 2.8
* *
* Deprecated: 3.0: Use gdk_display_warp_device() instead. * Deprecated: 3.0: Use gdk_device_warp() instead.
*/ */
void void
gdk_display_warp_pointer (GdkDisplay *display, gdk_display_warp_pointer (GdkDisplay *display,
@ -2401,47 +2401,9 @@ gdk_display_warp_pointer (GdkDisplay *display,
gint x, gint x,
gint y) gint y)
{ {
gdk_display_warp_device (display, gdk_device_warp (display->core_pointer,
display->core_pointer, screen,
screen, x, y);
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);
} }
gulong gulong

View File

@ -196,11 +196,6 @@ GdkWindow * gdk_display_get_window_at_device_position (GdkDisplay
GdkDevice *device, GdkDevice *device,
gint *win_x, gint *win_x,
gint *win_y); gint *win_y);
void gdk_display_warp_device (GdkDisplay *display,
GdkDevice *device,
GdkScreen *screen,
gint x,
gint y);
#ifndef GDK_MULTIDEVICE_SAFE #ifndef GDK_MULTIDEVICE_SAFE
GdkDisplayPointerHooks *gdk_display_set_pointer_hooks (GdkDisplay *display, GdkDisplayPointerHooks *gdk_display_set_pointer_hooks (GdkDisplay *display,

View File

@ -1866,7 +1866,7 @@ key_press (GtkWidget *invisible,
return FALSE; 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; return TRUE;

View File

@ -4255,9 +4255,9 @@ gtk_drag_key_cb (GtkWidget *widget,
{ {
info->cur_x += dx; info->cur_x += dx;
info->cur_y += dy; info->cur_y += dy;
gdk_display_warp_device (gtk_widget_get_display (widget), pointer, gdk_device_warp (pointer,
gtk_widget_get_screen (widget), gtk_widget_get_screen (widget),
info->cur_x, info->cur_y); info->cur_x, info->cur_y);
} }
gtk_drag_update (info, info->cur_screen, info->cur_x, info->cur_y, (GdkEvent *)event); gtk_drag_update (info, info->cur_screen, info->cur_x, info->cur_y, (GdkEvent *)event);