aboutsummaryrefslogtreecommitdiffstats
path: root/sway/tree/view.c
diff options
context:
space:
mode:
authorLibravatar Kenny Levinsen <kl@kl.wtf>2021-02-19 18:39:54 +0100
committerLibravatar Simon Ser <contact@emersion.fr>2021-02-23 00:17:32 +0100
commite7af5b630916c5620cb7806993530ef4ca965591 (patch)
tree039065460acb9cd3e32242b575febab1f1bc00ab /sway/tree/view.c
parentcontainer: Add container_is_current_floating (diff)
downloadsway-e7af5b630916c5620cb7806993530ef4ca965591.tar.gz
sway-e7af5b630916c5620cb7806993530ef4ca965591.tar.zst
sway-e7af5b630916c5620cb7806993530ef4ca965591.zip
view: Recursively check mapped of view_child tree
A subsurface may be set to mapped without its parent.
Diffstat (limited to 'sway/tree/view.c')
-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 ad79b229..c8a4ea6b 100644
--- a/sway/tree/view.c
+++ b/sway/tree/view.c
@@ -982,8 +982,18 @@ static void view_child_subsurface_create(struct sway_view_child *child,
982 view_child_damage(&subsurface->child, true); 982 view_child_damage(&subsurface->child, true);
983} 983}
984 984
985static bool view_child_is_mapped(struct sway_view_child *child) {
986 while (child) {
987 if (!child->mapped) {
988 return false;
989 }
990 child = child->parent;
991 }
992 return true;
993}
994
985static void view_child_damage(struct sway_view_child *child, bool whole) { 995static void view_child_damage(struct sway_view_child *child, bool whole) {
986 if (!child || !child->mapped || !child->view || !child->view->container) { 996 if (!child || !view_child_is_mapped(child) || !child->view || !child->view->container) {
987 return; 997 return;
988 } 998 }
989 int sx, sy; 999 int sx, sy;
@@ -1082,7 +1092,7 @@ void view_child_init(struct sway_view_child *child,
1082} 1092}
1083 1093
1084void view_child_destroy(struct sway_view_child *child) { 1094void view_child_destroy(struct sway_view_child *child) {
1085 if (child->mapped && child->view->container != NULL) { 1095 if (view_child_is_mapped(child) && child->view->container != NULL) {
1086 view_child_damage(child, true); 1096 view_child_damage(child, true);
1087 } 1097 }
1088 1098