aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKirill Primak <vyivel@eclair.cafe>2023-06-06 13:01:47 +0300
committerSimon Ser <contact@emersion.fr>2023-06-06 20:38:19 +0000
commit25a62a3775932188d7f59077c70b59478cdae184 (patch)
treeeb54029fdc0481690a268a8a26d07ba7432880f0
parent2acc74a3db0834d0423e2fac9dfe824f57f2f235 (diff)
subcompositor: simplify subsurface_consider_map(), call on add
Fixes: 49e9be62ae92382eddca600082785489c82ea487
-rw-r--r--types/wlr_subcompositor.c29
1 files changed, 3 insertions, 26 deletions
diff --git a/types/wlr_subcompositor.c b/types/wlr_subcompositor.c
index cb8a8d55..b16fc17f 100644
--- a/types/wlr_subcompositor.c
+++ b/types/wlr_subcompositor.c
@@ -183,33 +183,9 @@ static const struct wl_subsurface_interface subsurface_implementation = {
const struct wlr_surface_role subsurface_role;
-/**
- * Checks if this subsurface needs to be marked as mapped. The subsurface
- * is considered mapped if both:
- * - The subsurface has a buffer
- * - Its parent is mapped
- */
void subsurface_consider_map(struct wlr_subsurface *subsurface) {
- if (subsurface->surface->mapped || !wlr_surface_has_buffer(subsurface->surface)) {
- return;
- }
-
- if (!subsurface->parent->mapped) {
- return;
- }
-
- // Now we can map the subsurface
- wlr_surface_map(subsurface->surface);
-
- // Try mapping all children too
- struct wlr_subsurface *child;
- wl_list_for_each(child, &subsurface->surface->current.subsurfaces_below,
- current.link) {
- subsurface_consider_map(child);
- }
- wl_list_for_each(child, &subsurface->surface->current.subsurfaces_above,
- current.link) {
- subsurface_consider_map(child);
+ if (subsurface->parent->mapped && wlr_surface_has_buffer(subsurface->surface)) {
+ wlr_surface_map(subsurface->surface);
}
}
@@ -312,6 +288,7 @@ 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);
}
}