mirror of
https://github.com/swaywm/sway.git
synced 2024-11-14 20:23:16 +00:00
view: Recursively check mapped of view_child tree
A subsurface may be set to mapped without its parent.
(cherry picked from commit e7af5b6309
)
This commit is contained in:
parent
eca57594a0
commit
ad718158b6
|
@ -906,8 +906,18 @@ static void view_child_subsurface_create(struct sway_view_child *child,
|
||||||
view_child_damage(&subsurface->child, true);
|
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) {
|
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;
|
return;
|
||||||
}
|
}
|
||||||
int sx, sy;
|
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) {
|
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);
|
view_child_damage(child, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue