From 49e9be62ae92382eddca600082785489c82ea487 Mon Sep 17 00:00:00 2001 From: Kirill Primak Date: Sat, 3 Jun 2023 15:43:18 +0300 Subject: [PATCH] subcompositor: consider mapping on parent map Fixes: https://gitlab.freedesktop.org/wlroots/wlroots/-/issues/3654 --- include/types/wlr_subcompositor.h | 1 + types/wlr_compositor.c | 9 +++++++++ types/wlr_subcompositor.c | 3 +-- 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/include/types/wlr_subcompositor.h b/include/types/wlr_subcompositor.h index fe2ab69d..147b2838 100644 --- a/include/types/wlr_subcompositor.h +++ b/include/types/wlr_subcompositor.h @@ -3,6 +3,7 @@ #include +void subsurface_consider_map(struct wlr_subsurface *subsurface); void subsurface_handle_parent_commit(struct wlr_subsurface *subsurface); #endif diff --git a/types/wlr_compositor.c b/types/wlr_compositor.c index 3fb3f627..4e32f959 100644 --- a/types/wlr_compositor.c +++ b/types/wlr_compositor.c @@ -735,6 +735,15 @@ void wlr_surface_map(struct wlr_surface *surface) { } assert(wlr_surface_has_buffer(surface)); surface->mapped = true; + + struct wlr_subsurface *subsurface; + wl_list_for_each(subsurface, &surface->current.subsurfaces_below, current.link) { + subsurface_consider_map(subsurface); + } + wl_list_for_each(subsurface, &surface->current.subsurfaces_above, current.link) { + subsurface_consider_map(subsurface); + } + wl_signal_emit_mutable(&surface->events.map, NULL); } diff --git a/types/wlr_subcompositor.c b/types/wlr_subcompositor.c index 42c86064..a4ef2382 100644 --- a/types/wlr_subcompositor.c +++ b/types/wlr_subcompositor.c @@ -189,7 +189,7 @@ const struct wlr_surface_role subsurface_role; * - The subsurface has a buffer * - Its parent is mapped */ -static void subsurface_consider_map(struct wlr_subsurface *subsurface) { +void subsurface_consider_map(struct wlr_subsurface *subsurface) { if (subsurface->surface->mapped || !wlr_surface_has_buffer(subsurface->surface)) { return; } @@ -329,7 +329,6 @@ void subsurface_handle_parent_commit(struct wlr_subsurface *subsurface) { subsurface->added = true; wl_signal_emit_mutable(&subsurface->parent->events.new_subsurface, subsurface); - subsurface_consider_map(subsurface); } }