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.
This commit is contained in:
Matthias Clasen 2019-05-29 00:30:03 -04:00
parent 83827d3199
commit fd048005f5

View File

@ -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 surfaces 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;
}
}
/**