summaryrefslogtreecommitdiff
path: root/gdk/gdkdevice.c
diff options
context:
space:
mode:
authorBenjamin Otte <otte@redhat.com>2010-12-27 18:45:39 +0100
committerBenjamin Otte <otte@redhat.com>2010-12-27 18:46:41 +0100
commit97469915489704d28a9d85c3e6ad698f73b203f3 (patch)
tree24552c5f090cea3d92e5bb4dfa301090559162f9 /gdk/gdkdevice.c
parent0c285341a959ddbaad4ecc75e5f1a1ad66c5274e (diff)
downloadgtk+-97469915489704d28a9d85c3e6ad698f73b203f3.tar.gz
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.
Diffstat (limited to 'gdk/gdkdevice.c')
-rw-r--r--gdk/gdkdevice.c39
1 files changed, 39 insertions, 0 deletions
diff --git a/gdk/gdkdevice.c b/gdk/gdkdevice.c
index 39af300213..8d23314f38 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