wayland: Replace manual GNode subsurface iteration with macro

Similar to wl_list_foreach(), add
META_WAYLAND_SURFACE_FOREACH_SUBSURFACE() that iterates over all the
subsurfaces of a surface, without the caller needing to care about
implementation details, such as leaf nodes vs non-leaf nodes.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/961
This commit is contained in:
Jonas Ådahl
2019-12-06 18:22:47 +01:00
committed by Georges Basile Stavracas Neto
parent 76ee026caa
commit fcfe90aa9f
7 changed files with 58 additions and 75 deletions

View File

@ -1205,20 +1205,13 @@ static gboolean
pointer_can_grab_surface (MetaWaylandPointer *pointer,
MetaWaylandSurface *surface)
{
GNode *n;
MetaWaylandSurface *subsurface;
if (pointer->focus_surface == surface)
return TRUE;
for (n = g_node_first_child (surface->subsurface_branch_node);
n;
n = g_node_next_sibling (n))
META_WAYLAND_SURFACE_FOREACH_SUBSURFACE (surface, subsurface)
{
MetaWaylandSurface *subsurface = n->data;
if (G_NODE_IS_LEAF (n))
continue;
if (pointer_can_grab_surface (pointer, subsurface))
return TRUE;
}