diff options
author | Kenny Levinsen <kl@kl.wtf> | 2021-02-19 18:39:54 +0100 |
---|---|---|
committer | Simon Ser <contact@emersion.fr> | 2021-05-19 11:48:08 +0200 |
commit | ad718158b6f4aea989075a65089fdee2fc1e2214 (patch) | |
tree | 7466fabc633a902d9c0a461501b65800c701a032 | |
parent | build: bump version to 1.5.1 (diff) | |
download | sway-ad718158b6f4aea989075a65089fdee2fc1e2214.tar.gz sway-ad718158b6f4aea989075a65089fdee2fc1e2214.tar.zst sway-ad718158b6f4aea989075a65089fdee2fc1e2214.zip |
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.c | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/sway/tree/view.c b/sway/tree/view.c index ac314795..d77bd07d 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, | |||
906 | view_child_damage(&subsurface->child, true); | 906 | view_child_damage(&subsurface->child, true); |
907 | } | 907 | } |
908 | 908 | ||
909 | static bool view_child_is_mapped(struct sway_view_child *child) { | ||
910 | while (child) { | ||
911 | if (!child->mapped) { | ||
912 | return false; | ||
913 | } | ||
914 | child = child->parent; | ||
915 | } | ||
916 | return true; | ||
917 | } | ||
918 | |||
909 | static void view_child_damage(struct sway_view_child *child, bool whole) { | 919 | static void view_child_damage(struct sway_view_child *child, bool whole) { |
910 | if (!child || !child->mapped || !child->view || !child->view->container) { | 920 | if (!child || !view_child_is_mapped(child) || !child->view || !child->view->container) { |
911 | return; | 921 | return; |
912 | } | 922 | } |
913 | int sx, sy; | 923 | int sx, sy; |
@@ -1006,7 +1016,7 @@ void view_child_init(struct sway_view_child *child, | |||
1006 | } | 1016 | } |
1007 | 1017 | ||
1008 | void view_child_destroy(struct sway_view_child *child) { | 1018 | void view_child_destroy(struct sway_view_child *child) { |
1009 | if (child->mapped && child->view->container != NULL) { | 1019 | if (view_child_is_mapped(child) && child->view->container != NULL) { |
1010 | view_child_damage(child, true); | 1020 | view_child_damage(child, true); |
1011 | } | 1021 | } |
1012 | 1022 | ||