aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKirill Primak <vyivel@eclair.cafe>2022-03-04 00:59:22 +0300
committerSimon Ser <contact@emersion.fr>2022-04-13 16:48:15 +0000
commitbf3f60ff731472e875790633a1660b5e91abdce5 (patch)
tree7d31fa90b57f13f828ab3dc1e241d63fce3504b9
parent2e14bed9f790c29146b0eee70eab7d8c704876e9 (diff)
xdg-toplevel: treat unmapped parents as NULL
-rw-r--r--types/xdg_shell/wlr_xdg_toplevel.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/types/xdg_shell/wlr_xdg_toplevel.c b/types/xdg_shell/wlr_xdg_toplevel.c
index ed304cfc..a78a4e89 100644
--- a/types/xdg_shell/wlr_xdg_toplevel.c
+++ b/types/xdg_shell/wlr_xdg_toplevel.c
@@ -151,11 +151,13 @@ void wlr_xdg_toplevel_set_parent(struct wlr_xdg_toplevel *toplevel,
wl_list_remove(&toplevel->parent_unmap.link);
}
- toplevel->parent = parent;
- if (parent) {
+ if (parent && parent->base->mapped) {
+ toplevel->parent = parent;
toplevel->parent_unmap.notify = handle_parent_unmap;
wl_signal_add(&toplevel->parent->base->events.unmap,
- &toplevel->parent_unmap);
+ &toplevel->parent_unmap);
+ } else {
+ toplevel->parent = NULL;
}
wlr_signal_emit_safe(&toplevel->events.set_parent, NULL);