summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKenny Levinsen <kl@kl.wtf>2021-02-19 18:39:54 +0100
committerSimon Ser <contact@emersion.fr>2021-05-19 11:48:08 +0200
commitad718158b6f4aea989075a65089fdee2fc1e2214 (patch)
tree7466fabc633a902d9c0a461501b65800c701a032
parenteca57594a04ed5e6f2294bb51ce29445849cc48b (diff)
view: Recursively check mapped of view_child tree
A subsurface may be set to mapped without its parent. (cherry picked from commit e7af5b630916c5620cb7806993530ef4ca965591)
-rw-r--r--sway/tree/view.c14
1 files changed, 12 insertions, 2 deletions
diff --git a/sway/tree/view.c b/sway/tree/view.c
index ac3147953..d77bd07d5 100644
--- a/sway/tree/view.c
+++ b/sway/tree/view.c
@@ -906,8 +906,18 @@ static void view_child_subsurface_create(struct sway_view_child *child,
view_child_damage(&subsurface->child, true);
}
+static bool view_child_is_mapped(struct sway_view_child *child) {
+ while (child) {
+ if (!child->mapped) {
+ return false;
+ }
+ child = child->parent;
+ }
+ return true;
+}
+
static void view_child_damage(struct sway_view_child *child, bool whole) {
- if (!child || !child->mapped || !child->view || !child->view->container) {
+ if (!child || !view_child_is_mapped(child) || !child->view || !child->view->container) {
return;
}
int sx, sy;
@@ -1006,7 +1016,7 @@ void view_child_init(struct sway_view_child *child,
}
void view_child_destroy(struct sway_view_child *child) {
- if (child->mapped && child->view->container != NULL) {
+ if (view_child_is_mapped(child) && child->view->container != NULL) {
view_child_damage(child, true);
}