+ * gdk_device_get_position:
+ * @device: pointer device to query status about.
+ * @screen: (out) (transfer none) (allow-none): location to store the #GdkScreen
+ * the @device is on, or %NULL.
+ * @x: (out) (allow-none): location to store root window X coordinate of @device, or %NULL.
+ * @y: (out) (allow-none): location to store root window Y coordinate of @device, or %NULL.
+ *
+ * Gets the current location of @device. As a slave device
+ * coordinates are those of its master pointer, This function
+ * may not be called on devices of type %GDK_DEVICE_TYPE_SLAVE,
+ * unless there is an ongoing grab on them, see gdk_device_grab().
+ *
+ * Since: 3.0
+ **/
+void
+gdk_device_get_position (GdkDevice *device,
+ GdkScreen **screen,
+ gint *x,
+ gint *y)
+{
+ GdkDisplay *display;
+ gint tmp_x, tmp_y;
+ GdkScreen *default_screen;
+ GdkWindow *root;
+
+ g_return_if_fail (GDK_IS_DEVICE (device));
+ g_return_if_fail (gdk_device_get_source (device) != GDK_SOURCE_KEYBOARD);
+
+ display = gdk_device_get_display (device);
+
+ g_return_if_fail (gdk_device_get_device_type (device) != GDK_DEVICE_TYPE_SLAVE ||
+ gdk_display_device_is_grabbed (display, device));
+
+ default_screen = gdk_display_get_default_screen (display);
+
+ _gdk_device_query_state (device,
+ gdk_screen_get_root_window (default_screen),
+ &root, NULL,
+ &tmp_x, &tmp_y,
+ NULL, NULL, NULL);
+
+ if (screen)
+ *screen = gdk_window_get_screen (root);
+ if (x)
+ *x = tmp_x;
+ if (y)
+ *y = tmp_y;
+}
+
+/**
+ * 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).
+ *
+ * As a slave device coordinates are those of its master pointer, This
+ * function may not be called on devices of type %GDK_DEVICE_TYPE_SLAVE,
+ * unless there is an ongoing grab on them, see gdk_device_grab().
+ *
+ * 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)
+{
+ 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);
+ g_return_val_if_fail (gdk_device_get_device_type (device) != GDK_DEVICE_TYPE_SLAVE ||
+ gdk_display_device_is_grabbed (gdk_device_get_display (device), device), NULL);
+
+ window = _gdk_device_window_at_position (device, &tmp_x, &tmp_y, NULL, FALSE);
+
+ /* This might need corrections, as the native window returned
+ may contain client side children */
+ if (window)
+ {
+ double xx, yy;
+
+ window = _gdk_window_find_descendant_at (window,
+ tmp_x, tmp_y,
+ &xx, &yy);
+ tmp_x = floor (xx + 0.5);
+ tmp_y = floor (yy + 0.5);
+ }
+
+ if (win_x)
+ *win_x = tmp_x;
+ if (win_y)
+ *win_y = tmp_y;
+
+ return window;
+}
+
+/**
+ * gdk_device_get_history: (skip)