Rename gdk_surface_get_device_position_double

Drop the _double suffix, now that the int version is gone.
This commit is contained in:
Matthias Clasen 2019-03-25 10:12:01 -04:00
parent f1d61d5515
commit 21580309d3
13 changed files with 64 additions and 72 deletions

View File

@ -270,7 +270,7 @@ gdk_surface_get_root_origin
gdk_surface_get_frame_extents
gdk_surface_get_origin
gdk_surface_get_root_coords
gdk_surface_get_device_position_double
gdk_surface_get_device_position
GdkModifierType
GdkModifierIntent
gdk_surface_get_parent

View File

@ -106,7 +106,7 @@ gdk_broadway_device_get_state (GdkDevice *device,
{
gdouble x, y;
gdk_surface_get_device_position_double (surface, device, &x, &y, mask);
gdk_surface_get_device_position (surface, device, &x, &y, mask);
if (axes)
{

View File

@ -2039,56 +2039,50 @@ if (geometry->max_aspect * height < width)
}
/**
* gdk_surface_get_device_position_double:
* @surface: a #GdkSurface.
* @device: pointer #GdkDevice to query to.
* @x: (out) (allow-none): return location for the X coordinate of @device, or %NULL.
* @y: (out) (allow-none): return location for the Y coordinate of @device, or %NULL.
* @mask: (out) (allow-none): return location for the modifier mask, or %NULL.
*
* Obtains the current device position in doubles and modifier state.
* The position is given in coordinates relative to the upper left
* corner of @surface.
*
* Returns: (nullable) (transfer none): The surface underneath @device
* (as with gdk_device_get_surface_at_position()), or %NULL if the
* surface is not known to GDK.
**/
* gdk_surface_get_device_position:
* @surface: a #GdkSurface.
* @device: pointer #GdkDevice to query to.
* @x: (out) (allow-none): return location for the X coordinate of @device, or %NULL.
* @y: (out) (allow-none): return location for the Y coordinate of @device, or %NULL.
* @mask: (out) (allow-none): return location for the modifier mask, or %NULL.
*
* Obtains the current device position in doubles and modifier state.
* The position is given in coordinates relative to the upper left
* corner of @surface.
*
* Returns: (nullable) (transfer none): The surface underneath @device
* (as with gdk_device_get_surface_at_position()), or %NULL if the
* surface is not known to GDK.
**/
GdkSurface *
gdk_surface_get_device_position_double (GdkSurface *surface,
GdkDevice *device,
double *x,
double *y,
GdkModifierType *mask)
gdk_surface_get_device_position (GdkSurface *surface,
GdkDevice *device,
double *x,
double *y,
GdkModifierType *mask)
{
gdouble tmp_x, tmp_y;
GdkModifierType tmp_mask;
gboolean normal_child;
gdouble tmp_x, tmp_y;
GdkModifierType tmp_mask;
g_return_val_if_fail (GDK_IS_SURFACE (surface), 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);
g_return_val_if_fail (GDK_IS_SURFACE (surface), 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);
tmp_x = tmp_y = 0;
tmp_mask = 0;
normal_child = GDK_SURFACE_IMPL_GET_CLASS (surface->impl)->get_device_state (surface,
device,
&tmp_x, &tmp_y,
&tmp_mask);
/* We got the coords on the impl, convert to the surface */
tmp_x -= surface->abs_x;
tmp_y -= surface->abs_y;
tmp_x = tmp_y = 0;
tmp_mask = 0;
GDK_SURFACE_IMPL_GET_CLASS (surface->impl)->get_device_state (surface,
device,
&tmp_x, &tmp_y,
&tmp_mask);
if (x)
*x = tmp_x;
if (y)
*y = tmp_y;
if (mask)
*mask = tmp_mask;
if (x)
*x = tmp_x;
if (y)
*y = tmp_y;
if (mask)
*mask = tmp_mask;
if (normal_child)
return _gdk_surface_find_child_at (surface, tmp_x, tmp_y);
return NULL;
return NULL;
}
static gboolean

View File

@ -640,11 +640,11 @@ GDK_AVAILABLE_IN_ALL
gint gdk_surface_get_scale_factor (GdkSurface *surface);
GDK_AVAILABLE_IN_ALL
GdkSurface * gdk_surface_get_device_position_double (GdkSurface *surface,
GdkDevice *device,
gdouble *x,
gdouble *y,
GdkModifierType *mask);
GdkSurface * gdk_surface_get_device_position (GdkSurface *surface,
GdkDevice *device,
double *x,
double *y,
GdkModifierType *mask);
GDK_AVAILABLE_IN_ALL
GdkSurface * gdk_surface_get_parent (GdkSurface *surface);
GDK_AVAILABLE_IN_ALL

View File

@ -125,7 +125,7 @@ gdk_quartz_device_core_get_state (GdkDevice *device,
{
gdouble x_pos, y_pos;
gdk_surface_get_device_position_double (window, device, &x_pos, &y_pos, mask);
gdk_surface_get_device_position (window, device, &x_pos, &y_pos, mask);
if (axes)
{

View File

@ -321,7 +321,7 @@ gdk_wayland_device_get_state (GdkDevice *device,
{
gdouble x, y;
gdk_surface_get_device_position_double (surface, device, &x, &y, mask);
gdk_surface_get_device_position (surface, device, &x, &y, mask);
if (axes)
{
@ -614,9 +614,9 @@ emulate_crossing (GdkSurface *surface,
gdk_event_set_device (event, device);
gdk_event_set_source_device (event, device);
gdk_surface_get_device_position_double (surface, device,
&event->crossing.x, &event->crossing.y,
&event->crossing.state);
gdk_surface_get_device_position (surface, device,
&event->crossing.x, &event->crossing.y,
&event->crossing.state);
event->crossing.x_root = event->crossing.x;
event->crossing.y_root = event->crossing.y;

View File

@ -2467,8 +2467,8 @@ gdk_wayland_surface_map (GdkSurface *surface)
if (impl->position_method == POSITION_METHOD_NONE && grab_device)
{
double px, py;
gdk_surface_get_device_position_double (transient_for, grab_device,
&px, &py, NULL);
gdk_surface_get_device_position (transient_for, grab_device,
&px, &py, NULL);
surface->x = round (px);
surface->y = round (py);
}

View File

@ -47,7 +47,7 @@ gdk_device_win32_get_state (GdkDevice *device,
{
double x, y;
gdk_surface_get_device_position_double (window, device, &x, &y, mask);
gdk_surface_get_device_position (window, device, &x, &y, mask);
if (axes)
{

View File

@ -192,7 +192,7 @@ gdk_x11_device_core_get_state (GdkDevice *device,
{
gdouble x, y;
gdk_surface_get_device_position_double (surface, device, &x, &y, mask);
gdk_surface_get_device_position (surface, device, &x, &y, mask);
if (axes)
{

View File

@ -1825,7 +1825,7 @@ gtk_menu_popup_at_pointer (GtkMenu *menu,
if (device)
{
double px, py;
gdk_surface_get_device_position_double (rect_surface, device, &px, &py, NULL);
gdk_surface_get_device_position (rect_surface, device, &px, &py, NULL);
rect.x = round (px);
rect.y = round (py);
}

View File

@ -634,9 +634,7 @@ gtk_tooltip_position (GtkTooltip *tooltip,
* far away from the pointer position.
*/
effective_toplevel = _gtk_widget_get_surface (toplevel);
gdk_surface_get_device_position_double (effective_toplevel,
device,
&px, &py, NULL);
gdk_surface_get_device_position (effective_toplevel, device, &px, &py, NULL);
pointer_x = round (px);
pointer_y = round (py);
@ -697,7 +695,7 @@ gtk_tooltip_show_tooltip (GdkDisplay *display)
device = gdk_seat_get_pointer (gdk_display_get_default_seat (display));
gdk_surface_get_device_position_double (surface, device, &px, &py, NULL);
gdk_surface_get_device_position (surface, device, &px, &py, NULL);
x = round (px);
y = round (py);

View File

@ -8645,11 +8645,11 @@ synth_crossing (GtkWidget *widget,
gdk_device_get_position_double (device,
&event->crossing.x_root,
&event->crossing.y_root);
gdk_surface_get_device_position_double (surface,
device,
&event->crossing.x,
&event->crossing.y,
NULL);
gdk_surface_get_device_position (surface,
device,
&event->crossing.x,
&event->crossing.y,
NULL);
event->crossing.mode = mode;
event->crossing.detail = detail;
event->crossing.focus = FALSE;

View File

@ -52,8 +52,8 @@ find_widget_at_pointer (GdkDevice *device)
{
double x, y;
gdk_surface_get_device_position_double (gtk_widget_get_surface (widget),
device, &x, &y, NULL);
gdk_surface_get_device_position (gtk_widget_get_surface (widget),
device, &x, &y, NULL);
widget = gtk_widget_pick (widget, x, y);
}