[gtk/gdk-api-cleanups: 13/21] Rename gdk_surface_get_device_position_double
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk/gdk-api-cleanups: 13/21] Rename gdk_surface_get_device_position_double
- Date: Tue, 26 Mar 2019 22:14:46 +0000 (UTC)
commit 21580309d38d13488e2dbc7a1ccd04eb64f08d66
Author: Matthias Clasen <mclasen redhat com>
Date: Mon Mar 25 10:12:01 2019 -0400
Rename gdk_surface_get_device_position_double
Drop the _double suffix, now that the int version is gone.
docs/reference/gdk/gdk4-sections.txt | 2 +-
gdk/broadway/gdkdevice-broadway.c | 2 +-
gdk/gdksurface.c | 84 +++++++++++++++++-------------------
gdk/gdksurface.h | 10 ++---
gdk/quartz/gdkdevice-core-quartz.c | 2 +-
gdk/wayland/gdkdevice-wayland.c | 8 ++--
gdk/wayland/gdksurface-wayland.c | 4 +-
gdk/win32/gdkdevice-win32.c | 2 +-
gdk/x11/gdkdevice-core-x11.c | 2 +-
gtk/gtkmenu.c | 2 +-
gtk/gtktooltip.c | 6 +--
gtk/gtkwidget.c | 10 ++---
gtk/inspector/inspect-button.c | 4 +-
13 files changed, 65 insertions(+), 73 deletions(-)
---
diff --git a/docs/reference/gdk/gdk4-sections.txt b/docs/reference/gdk/gdk4-sections.txt
index f25e3ef121..76bfc40fec 100644
--- a/docs/reference/gdk/gdk4-sections.txt
+++ b/docs/reference/gdk/gdk4-sections.txt
@@ -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
diff --git a/gdk/broadway/gdkdevice-broadway.c b/gdk/broadway/gdkdevice-broadway.c
index 2171ca90f6..a51ecc416d 100644
--- a/gdk/broadway/gdkdevice-broadway.c
+++ b/gdk/broadway/gdkdevice-broadway.c
@@ -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)
{
diff --git a/gdk/gdksurface.c b/gdk/gdksurface.c
index 11b92b2c19..689999ba75 100644
--- a/gdk/gdksurface.c
+++ b/gdk/gdksurface.c
@@ -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);
-
-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;
+ 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);
-if (x)
-*x = tmp_x;
-if (y)
-*y = tmp_y;
-if (mask)
-*mask = tmp_mask;
+ 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 (normal_child)
-return _gdk_surface_find_child_at (surface, tmp_x, tmp_y);
-return NULL;
+ if (x)
+ *x = tmp_x;
+ if (y)
+ *y = tmp_y;
+ if (mask)
+ *mask = tmp_mask;
+
+ return NULL;
}
static gboolean
diff --git a/gdk/gdksurface.h b/gdk/gdksurface.h
index 2fa1aacc1a..122ca51ddd 100644
--- a/gdk/gdksurface.h
+++ b/gdk/gdksurface.h
@@ -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
diff --git a/gdk/quartz/gdkdevice-core-quartz.c b/gdk/quartz/gdkdevice-core-quartz.c
index 246dd55933..2d6233e0ae 100644
--- a/gdk/quartz/gdkdevice-core-quartz.c
+++ b/gdk/quartz/gdkdevice-core-quartz.c
@@ -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)
{
diff --git a/gdk/wayland/gdkdevice-wayland.c b/gdk/wayland/gdkdevice-wayland.c
index 317a285f96..26114033fe 100644
--- a/gdk/wayland/gdkdevice-wayland.c
+++ b/gdk/wayland/gdkdevice-wayland.c
@@ -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;
diff --git a/gdk/wayland/gdksurface-wayland.c b/gdk/wayland/gdksurface-wayland.c
index 1be048e7a8..0466112803 100644
--- a/gdk/wayland/gdksurface-wayland.c
+++ b/gdk/wayland/gdksurface-wayland.c
@@ -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);
}
diff --git a/gdk/win32/gdkdevice-win32.c b/gdk/win32/gdkdevice-win32.c
index 3987e2c5df..8d42f5389e 100644
--- a/gdk/win32/gdkdevice-win32.c
+++ b/gdk/win32/gdkdevice-win32.c
@@ -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)
{
diff --git a/gdk/x11/gdkdevice-core-x11.c b/gdk/x11/gdkdevice-core-x11.c
index 0b8bd8d4f7..d23c01a1bc 100644
--- a/gdk/x11/gdkdevice-core-x11.c
+++ b/gdk/x11/gdkdevice-core-x11.c
@@ -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)
{
diff --git a/gtk/gtkmenu.c b/gtk/gtkmenu.c
index c75ff03eb8..ae68e0c666 100644
--- a/gtk/gtkmenu.c
+++ b/gtk/gtkmenu.c
@@ -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);
}
diff --git a/gtk/gtktooltip.c b/gtk/gtktooltip.c
index c072d46106..e5992529e2 100644
--- a/gtk/gtktooltip.c
+++ b/gtk/gtktooltip.c
@@ -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);
diff --git a/gtk/gtkwidget.c b/gtk/gtkwidget.c
index 9d0dccc665..7eaf9ade9b 100644
--- a/gtk/gtkwidget.c
+++ b/gtk/gtkwidget.c
@@ -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;
diff --git a/gtk/inspector/inspect-button.c b/gtk/inspector/inspect-button.c
index d34629d163..76e52f4df1 100644
--- a/gtk/inspector/inspect-button.c
+++ b/gtk/inspector/inspect-button.c
@@ -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);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]