[gtk+/gdk-backend] API: gdk: gdk_display_warp_device() => gdk_device_warp()



commit 310c1dae1d6d02ba19c0117654aa9ac853e6aeb6
Author: Benjamin Otte <otte redhat com>
Date:   Mon Dec 20 15:05:47 2010 +0100

    API: gdk: gdk_display_warp_device() => gdk_device_warp()
    
    warping devices has nothing to do with displays, so putting it there
    seems weird.

 docs/reference/gdk/gdk3-sections.txt |    2 +-
 gdk/gdk.symbols                      |    2 +-
 gdk/gdkdevice.c                      |   34 +++++++++++++++++++++++++
 gdk/gdkdevice.h                      |    5 +++
 gdk/gdkdisplay.c                     |   46 +++-------------------------------
 gdk/gdkdisplay.h                     |    5 ---
 gtk/gtkcolorsel.c                    |    2 +-
 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 90cf828..5f2c0d8 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 fd50e8a..85eeed0 100644
--- a/gdk/gdk.symbols
+++ b/gdk/gdk.symbols
@@ -78,6 +78,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
@@ -128,7 +129,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 704946e..3c531bc 100644
--- a/gdk/gdkdevice.c
+++ b/gdk/gdkdevice.c
@@ -1160,6 +1160,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 8cb705a..d65dae8 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 20777f8..88115fe 100644
--- a/gdk/gdkdisplay.c
+++ b/gdk/gdkdisplay.c
@@ -2391,7 +2391,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,
@@ -2399,47 +2399,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 9bb1ba9..8a4b3e5 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 9948090..8f90a89 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 e865047..8585af0 100644
--- a/gtk/gtkdnd.c
+++ b/gtk/gtkdnd.c
@@ -4254,9 +4254,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);



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]