[gtk/global-coords: 16/37] Clarify gdk_surface_get_position
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk/global-coords: 16/37] Clarify gdk_surface_get_position
- Date: Wed, 29 May 2019 18:05:06 +0000 (UTC)
commit fd048005f54a0f044d2b1d01de3886c8daf572a6
Author: Matthias Clasen <mclasen redhat com>
Date: Wed May 29 00:30:03 2019 -0400
Clarify gdk_surface_get_position
This function returns the position relative to
the surface parent, so will always return 0 for
non-popups. The out arguments don't need to
allow-none either - nobody passes NULL for these.
gdk/gdksurface.c | 31 +++++++++++++++----------------
1 file changed, 15 insertions(+), 16 deletions(-)
---
diff --git a/gdk/gdksurface.c b/gdk/gdksurface.c
index fc30d532d9..8016dddd57 100644
--- a/gdk/gdksurface.c
+++ b/gdk/gdksurface.c
@@ -1038,29 +1038,28 @@ gdk_surface_is_destroyed (GdkSurface *surface)
/**
* gdk_surface_get_position:
* @surface: a #GdkSurface
- * @x: (out) (allow-none): X coordinate of surface
- * @y: (out) (allow-none): Y coordinate of surface
- *
- * Obtains the position of the surface as reported in the
- * most-recently-processed #GdkEventConfigure. Contrast with
- * gdk_surface_get_geometry() which queries the X server for the
- * current surface position, regardless of which events have been
- * received or processed.
- *
- * The position coordinates are relative to the surface’s parent surface.
+ * @x: (out): X coordinate of surface
+ * @y: (out): Y coordinate of surface
*
+ * Obtains the position of the surface relative to its parent.
**/
void
gdk_surface_get_position (GdkSurface *surface,
- gint *x,
- gint *y)
+ int *x,
+ int *y)
{
g_return_if_fail (GDK_IS_SURFACE (surface));
- if (x)
- *x = surface->x;
- if (y)
- *y = surface->y;
+ if (surface->parent)
+ {
+ *x = surface->x;
+ *y = surface->y;
+ }
+ else
+ {
+ *x = 0;
+ *y = 0;
+ }
}
/**
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]