diff --git a/gdk/gdksubsurface.c b/gdk/gdksubsurface.c index 128a7f26d7..0a36826459 100644 --- a/gdk/gdksubsurface.c +++ b/gdk/gdksubsurface.c @@ -286,6 +286,28 @@ gdk_subsurface_is_above_parent (GdkSubsurface *subsurface) return subsurface->above_parent; } +/*< private> + * gdk_subsurface_get_sibling: + * @subsurface: the `GdkSubsurface` + * @above: whether to get the subsurface above + * + * Returns the subsurface above (or below) @subsurface in + * the stacking order. + * + * Returns: the sibling, or `NULL` if there is none. + */ +GdkSubsurface * +gdk_subsurface_get_sibling (GdkSubsurface *subsurface, + gboolean above) +{ + g_return_val_if_fail (GDK_IS_SUBSURFACE (subsurface), NULL); + + if (above) + return subsurface->sibling_above; + else + return subsurface->sibling_below; +} + /*< private > * gdk_subsurface_get_transform: * @subsurface: a `GdkSubsurface` diff --git a/gdk/gdksubsurfaceprivate.h b/gdk/gdksubsurfaceprivate.h index c588676e6c..6a28ac3f1d 100644 --- a/gdk/gdksubsurfaceprivate.h +++ b/gdk/gdksubsurfaceprivate.h @@ -101,6 +101,8 @@ void gdk_subsurface_get_source_rect (GdkSubsurface *subsu void gdk_subsurface_get_texture_rect (GdkSubsurface *subsurface, graphene_rect_t *rect); gboolean gdk_subsurface_is_above_parent (GdkSubsurface *subsurface); +GdkSubsurface * gdk_subsurface_get_sibling (GdkSubsurface *subsurface, + gboolean above); GdkTextureTransform gdk_subsurface_get_transform (GdkSubsurface *subsurface); gboolean gdk_subsurface_get_background_rect (GdkSubsurface *subsurface, @@ -108,6 +110,5 @@ gboolean gdk_subsurface_get_background_rect (GdkSubsurface *subsu void gdk_subsurface_get_bounds (GdkSubsurface *subsurface, graphene_rect_t *bounds); - G_END_DECLS