diff options
author | Benjamin Otte <otte@redhat.com> | 2010-12-20 15:05:47 +0100 |
---|---|---|
committer | Matthias Clasen <mclasen@redhat.com> | 2010-12-21 12:07:06 -0500 |
commit | 66f7c3a5622e5eacafa70b076bbfa7457f2c0345 (patch) | |
tree | 9d30fda9dd661404e655467bab41798fac19aaf6 | |
parent | 7a3359223179468b42fa0130457ec60694ce6ec1 (diff) | |
download | gtk+-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.
-rw-r--r-- | docs/reference/gdk/gdk3-sections.txt | 2 | ||||
-rw-r--r-- | gdk/gdk.symbols | 2 | ||||
-rw-r--r-- | gdk/gdkdevice.c | 34 | ||||
-rw-r--r-- | gdk/gdkdevice.h | 5 | ||||
-rw-r--r-- | gdk/gdkdisplay.c | 46 | ||||
-rw-r--r-- | gdk/gdkdisplay.h | 5 | ||||
-rw-r--r-- | gtk/gtkcolorsel.c | 2 | ||||
-rw-r--r-- | gtk/gtkdnd.c | 6 |
8 files changed, 49 insertions, 53 deletions
diff --git a/docs/reference/gdk/gdk3-sections.txt b/docs/reference/gdk/gdk3-sections.txt index 90cf828c5f..5f2c0d8cc9 100644 --- a/docs/reference/gdk/gdk3-sections.txt +++ b/docs/reference/gdk/gdk3-sections.txt @@ -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 diff --git a/gdk/gdk.symbols b/gdk/gdk.symbols index 77db64cb2c..42e42521f5 100644 --- a/gdk/gdk.symbols +++ b/gdk/gdk.symbols @@ -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 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) diff --git a/gdk/gdkdevice.h b/gdk/gdkdevice.h index 8cb705a47a..d65dae8f18 100644 --- a/gdk/gdkdevice.h +++ b/gdk/gdkdevice.h @@ -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, diff --git a/gdk/gdkdisplay.c b/gdk/gdkdisplay.c index 335f7d98dc..3374ff405e 100644 --- a/gdk/gdkdisplay.c +++ b/gdk/gdkdisplay.c @@ -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 diff --git a/gdk/gdkdisplay.h b/gdk/gdkdisplay.h index 9bb1ba962d..8a4b3e55d1 100644 --- a/gdk/gdkdisplay.h +++ b/gdk/gdkdisplay.h @@ -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, diff --git a/gtk/gtkcolorsel.c b/gtk/gtkcolorsel.c index 9948090afd..8f90a8911e 100644 --- a/gtk/gtkcolorsel.c +++ b/gtk/gtkcolorsel.c @@ -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; diff --git a/gtk/gtkdnd.c b/gtk/gtkdnd.c index e9f0cc1b15..8efbacd39f 100644 --- a/gtk/gtkdnd.c +++ b/gtk/gtkdnd.c @@ -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); |