subcompositor: consider mapping on parent map

Fixes: https://gitlab.freedesktop.org/wlroots/wlroots/-/issues/3654
This commit is contained in:
Kirill Primak 2023-06-03 15:43:18 +03:00 committed by Isaac Freund
parent a2f94b500c
commit 49e9be62ae
3 changed files with 11 additions and 2 deletions

View file

@ -3,6 +3,7 @@
#include <wlr/types/wlr_subcompositor.h> #include <wlr/types/wlr_subcompositor.h>
void subsurface_consider_map(struct wlr_subsurface *subsurface);
void subsurface_handle_parent_commit(struct wlr_subsurface *subsurface); void subsurface_handle_parent_commit(struct wlr_subsurface *subsurface);
#endif #endif

View file

@ -735,6 +735,15 @@ void wlr_surface_map(struct wlr_surface *surface) {
} }
assert(wlr_surface_has_buffer(surface)); assert(wlr_surface_has_buffer(surface));
surface->mapped = true; 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); wl_signal_emit_mutable(&surface->events.map, NULL);
} }

View file

@ -189,7 +189,7 @@ const struct wlr_surface_role subsurface_role;
* - The subsurface has a buffer * - The subsurface has a buffer
* - Its parent is mapped * - 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)) { if (subsurface->surface->mapped || !wlr_surface_has_buffer(subsurface->surface)) {
return; return;
} }
@ -329,7 +329,6 @@ void subsurface_handle_parent_commit(struct wlr_subsurface *subsurface) {
subsurface->added = true; subsurface->added = true;
wl_signal_emit_mutable(&subsurface->parent->events.new_subsurface, wl_signal_emit_mutable(&subsurface->parent->events.new_subsurface,
subsurface); subsurface);
subsurface_consider_map(subsurface);
} }
} }