[gtk+] API: gdk: Make gdk_display_get_window_at_device_position() a device API



commit 97469915489704d28a9d85c3e6ad698f73b203f3
Author: Benjamin Otte <otte redhat com>
Date:   Mon Dec 27 18:45:39 2010 +0100

    API: gdk: Make gdk_display_get_window_at_device_position() a device API
    
    It's now called gdk_device_get_window_at_position(). It doesn't make
    sense to keep device-specific API part of the display.

 docs/reference/gdk/gdk3-sections.txt |    2 +-
 gdk/gdk.symbols                      |    2 +-
 gdk/gdkdevice.c                      |   39 ++++++++++++++++++++++++++++++
 gdk/gdkdevice.h                      |    5 ++++
 gdk/gdkdisplay.c                     |   43 +--------------------------------
 gdk/gdkdisplay.h                     |    5 ----
 gdk/gdkwindow.c                      |    5 +--
 gtk/gtkcolorsel.c                    |    3 +-
 gtk/gtktooltip.c                     |    4 +--
 9 files changed, 52 insertions(+), 56 deletions(-)
---
diff --git a/docs/reference/gdk/gdk3-sections.txt b/docs/reference/gdk/gdk3-sections.txt
index b1141d6..121e6fc 100644
--- a/docs/reference/gdk/gdk3-sections.txt
+++ b/docs/reference/gdk/gdk3-sections.txt
@@ -126,7 +126,6 @@ gdk_display_set_double_click_distance
 gdk_display_get_pointer
 gdk_display_list_devices
 gdk_display_get_window_at_pointer
-gdk_display_get_window_at_device_position
 GdkDisplayPointerHooks
 gdk_display_set_pointer_hooks
 GdkDisplayDeviceHooks
@@ -705,6 +704,7 @@ gdk_device_ungrab
 <SUBSECTION>
 gdk_device_get_state
 gdk_device_get_position
+gdk_device_get_window_at_position
 gdk_device_get_history
 gdk_device_free_history
 GdkTimeCoord
diff --git a/gdk/gdk.symbols b/gdk/gdk.symbols
index 7545fe2..d23f753 100644
--- a/gdk/gdk.symbols
+++ b/gdk/gdk.symbols
@@ -63,6 +63,7 @@ gdk_device_get_position
 gdk_device_get_source
 gdk_device_get_state
 gdk_device_get_type G_GNUC_CONST
+gdk_device_get_window_at_position
 gdk_device_grab
 gdk_device_grab_info_libgtk_only
 gdk_device_list_axes
@@ -97,7 +98,6 @@ gdk_display_get_n_screens
 gdk_display_get_pointer
 gdk_display_get_screen
 gdk_display_get_type G_GNUC_CONST
-gdk_display_get_window_at_device_position
 gdk_display_get_window_at_pointer
 gdk_display_has_pending
 gdk_display_is_closed
diff --git a/gdk/gdkdevice.c b/gdk/gdkdevice.c
index 39af300..8d23314 100644
--- a/gdk/gdkdevice.c
+++ b/gdk/gdkdevice.c
@@ -436,6 +436,45 @@ gdk_device_get_position (GdkDevice        *device,
 }
 
 /**
+ * gdk_device_get_window_at_position:
+ * @device: pointer #GdkDevice to query info to.
+ * @win_x: (out) (allow-none): return location for the X coordinate of the device location,
+ *         relative to the window origin, or %NULL.
+ * @win_y: (out) (allow-none): return location for the Y coordinate of the device location,
+ *         relative to the window origin, or %NULL.
+ *
+ * Obtains the window underneath @device, returning the location of the device in @win_x and @win_y. Returns
+ * %NULL if the window tree under @device is not known to GDK (for example, belongs to another application).
+ *
+ * Returns: (transfer none): the #GdkWindow under the device position, or %NULL.
+ *
+ * Since: 3.0
+ **/
+GdkWindow *
+gdk_device_get_window_at_position (GdkDevice  *device,
+                                   gint       *win_x,
+                                   gint       *win_y)
+{
+  GdkDisplay *display;
+  gint tmp_x, tmp_y;
+  GdkWindow *window;
+
+  g_return_val_if_fail (GDK_IS_DEVICE (device), NULL);
+  g_return_val_if_fail (gdk_device_get_source (device) != GDK_SOURCE_KEYBOARD, NULL);
+
+  display = gdk_device_get_display (device);
+
+  window = display->device_hooks->window_at_device_position (display, device, &tmp_x, &tmp_y);
+
+  if (win_x)
+    *win_x = tmp_x;
+  if (win_y)
+    *win_y = tmp_y;
+
+  return window;
+}
+
+/**
  * gdk_device_get_history:
  * @device: a #GdkDevice
  * @window: the window with respect to which which the event coordinates will be reported
diff --git a/gdk/gdkdevice.h b/gdk/gdkdevice.h
index ecce89a..3cc15e3 100644
--- a/gdk/gdkdevice.h
+++ b/gdk/gdkdevice.h
@@ -193,6 +193,11 @@ void     gdk_device_get_position (GdkDevice         *device,
                                   GdkScreen        **screen,
                                   gint              *x,
                                   gint              *y);
+GdkWindow *
+         gdk_device_get_window_at_position
+                                 (GdkDevice         *device,
+                                  gint              *win_x,
+                                  gint              *win_y);
 gboolean gdk_device_get_history  (GdkDevice         *device,
                                   GdkWindow         *window,
                                   guint32            start,
diff --git a/gdk/gdkdisplay.c b/gdk/gdkdisplay.c
index e7f7fc5..fdd9860 100644
--- a/gdk/gdkdisplay.c
+++ b/gdk/gdkdisplay.c
@@ -697,45 +697,6 @@ _gdk_display_enable_motion_hints (GdkDisplay *display,
 }
 
 /**
- * gdk_display_get_window_at_device_position:
- * @display: a #GdkDisplay.
- * @device: pointer #GdkDevice to query info to.
- * @win_x: (out) (allow-none): return location for the X coordinate of the device location,
- *         relative to the window origin, or %NULL.
- * @win_y: (out) (allow-none): return location for the Y coordinate of the device location,
- *         relative to the window origin, or %NULL.
- *
- * Obtains the window underneath @device, returning the location of the device in @win_x and @win_y. Returns
- * %NULL if the window tree under @device is not known to GDK (for example, belongs to another application).
- *
- * Returns: (transfer none): the #GdkWindow under the device position, or %NULL.
- *
- * Since: 3.0
- **/
-GdkWindow *
-gdk_display_get_window_at_device_position (GdkDisplay *display,
-                                           GdkDevice  *device,
-                                           gint       *win_x,
-                                           gint       *win_y)
-{
-  gint tmp_x, tmp_y;
-  GdkWindow *window;
-
-  g_return_val_if_fail (GDK_IS_DISPLAY (display), NULL);
-  g_return_val_if_fail (GDK_IS_DEVICE (device), NULL);
-  g_return_val_if_fail (gdk_device_get_source (device) != GDK_SOURCE_KEYBOARD, NULL);
-
-  window = display->device_hooks->window_at_device_position (display, device, &tmp_x, &tmp_y);
-
-  if (win_x)
-    *win_x = tmp_x;
-  if (win_y)
-    *win_y = tmp_y;
-
-  return window;
-}
-
-/**
  * gdk_display_set_device_hooks:
  * @display: a #GdkDisplay.
  * @new_hooks: (allow-none): a table of pointers to functions for getting quantities related
@@ -890,7 +851,7 @@ gdk_window_real_window_get_device_position (GdkDisplay       *display,
  *
  * Since: 2.2
  *
- * Deprecated: 3.0: Use gdk_display_get_window_at_device_position() instead.
+ * Deprecated: 3.0: Use gdk_device_get_window_at_position() instead.
  **/
 GdkWindow *
 gdk_display_get_window_at_pointer (GdkDisplay *display,
@@ -899,7 +860,7 @@ gdk_display_get_window_at_pointer (GdkDisplay *display,
 {
   g_return_val_if_fail (GDK_IS_DISPLAY (display), NULL);
 
-  return gdk_display_get_window_at_device_position (display, display->core_pointer, win_x, win_y);
+  return gdk_device_get_window_at_position (display->core_pointer, win_x, win_y);
 }
 
 static void
diff --git a/gdk/gdkdisplay.h b/gdk/gdkdisplay.h
index 100b9c3..c782c24 100644
--- a/gdk/gdkdisplay.h
+++ b/gdk/gdkdisplay.h
@@ -191,11 +191,6 @@ GdkDisplayPointerHooks *gdk_display_set_pointer_hooks (GdkDisplay
 #endif /* GDK_DISABLE_DEPRECATED */
 #endif /* GDK_MULTIDEVICE_SAFE */
 
-GdkWindow *      gdk_display_get_window_at_device_position (GdkDisplay            *display,
-                                                            GdkDevice             *device,
-                                                            gint                  *win_x,
-                                                            gint                  *win_y);
-
 GdkDisplayDeviceHooks *gdk_display_set_device_hooks (GdkDisplay                  *display,
                                                      const GdkDisplayDeviceHooks *new_hooks);
 
diff --git a/gdk/gdkwindow.c b/gdk/gdkwindow.c
index 359706b..260746c 100644
--- a/gdk/gdkwindow.c
+++ b/gdk/gdkwindow.c
@@ -4951,8 +4951,7 @@ gdk_window_get_pointer (GdkWindow	  *window,
  * corner of @window.
  *
  * Return value: (transfer none): The window underneath @device (as with
- * gdk_display_get_window_at_device_position()), or %NULL if the
- * window is not known to GDK.
+ * gdk_device_get_window_at_position()), or %NULL if the window is not known to GDK.
  *
  * Since: 3.0
  **/
@@ -5007,7 +5006,7 @@ gdk_window_get_device_position (GdkWindow       *window,
  *
  * Return value: (transfer none): window under the mouse pointer
  *
- * Deprecated: 3.0: Use gdk_display_get_window_at_device_position() instead.
+ * Deprecated: 3.0: Use gdk_device_get_window_at_position() instead.
  **/
 GdkWindow*
 gdk_window_at_pointer (gint *win_x,
diff --git a/gtk/gtkcolorsel.c b/gtk/gtkcolorsel.c
index b6a4e4e..9831506 100644
--- a/gtk/gtkcolorsel.c
+++ b/gtk/gtkcolorsel.c
@@ -1710,8 +1710,7 @@ grab_color_at_pointer (GdkScreen *screen,
   if (!pixbuf)
     {
       gint x, y;
-      GdkDisplay *display = gdk_screen_get_display (screen);
-      GdkWindow *window = gdk_display_get_window_at_device_position (display, device, &x, &y);
+      GdkWindow *window = gdk_device_get_window_at_position (device, &x, &y);
       if (!window)
 	return;
       pixbuf = gdk_pixbuf_get_from_window (window,
diff --git a/gtk/gtktooltip.c b/gtk/gtktooltip.c
index 3520128..8c4ef89 100644
--- a/gtk/gtktooltip.c
+++ b/gtk/gtktooltip.c
@@ -536,9 +536,7 @@ gtk_tooltip_trigger_tooltip_query (GdkDisplay *display)
 
   /* Trigger logic as if the mouse moved */
   device = gdk_device_manager_get_client_pointer (gdk_display_get_device_manager (display));
-  window = gdk_display_get_window_at_device_position (display,
-                                                      device,
-                                                      &x, &y);
+  window = gdk_device_get_window_at_position (device, &x, &y);
   if (!window)
     return;
 



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