mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2024-12-23 20:30:15 +00:00
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.
This commit is contained in:
parent
0c285341a9
commit
9746991548
@ -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
|
||||
|
@ -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
|
||||
|
@ -435,6 +435,45 @@ gdk_device_get_position (GdkDevice *device,
|
||||
*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).
|
||||
*
|
||||
* 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
|
||||
|
@ -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,
|
||||
|
@ -696,45 +696,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.
|
||||
@ -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
|
||||
|
@ -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);
|
||||
|
||||
|
@ -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,
|
||||
|
@ -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,
|
||||
|
@ -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;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user