diff options
| author | Furkan Sahin <furkan-dev@proton.me> | 2021-02-19 18:39:54 +0100 |
|---|---|---|
| committer | Furkan Sahin <furkan-dev@proton.me> | 2021-02-19 18:39:54 +0100 |
| commit | 43a57f7488d7b4ff5314f3ef82851ba287bcdb25 (patch) | |
| tree | 039065460acb9cd3e32242b575febab1f1bc00ab | |
| parent | 49b7147a4241a851fd4fe39219d81e6995b2b2be (diff) | |
view: Recursively check mapped of view_child tree
A subsurface may be set to mapped without its parent.
| -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 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, 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; @@ -1082,7 +1092,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); } |
