aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/wlr/types/wlr_xdg_shell.h2
-rw-r--r--types/xdg_shell/wlr_xdg_toplevel.c11
2 files changed, 5 insertions, 8 deletions
diff --git a/include/wlr/types/wlr_xdg_shell.h b/include/wlr/types/wlr_xdg_shell.h
index 247bad15..2fee1453 100644
--- a/include/wlr/types/wlr_xdg_shell.h
+++ b/include/wlr/types/wlr_xdg_shell.h
@@ -125,7 +125,7 @@ struct wlr_xdg_toplevel {
struct wlr_xdg_surface *base;
bool added;
- struct wlr_xdg_surface *parent;
+ struct wlr_xdg_toplevel *parent;
struct wl_listener parent_unmap;
struct wlr_xdg_toplevel_state current, pending;
diff --git a/types/xdg_shell/wlr_xdg_toplevel.c b/types/xdg_shell/wlr_xdg_toplevel.c
index 376ab49c..842e37c2 100644
--- a/types/xdg_shell/wlr_xdg_toplevel.c
+++ b/types/xdg_shell/wlr_xdg_toplevel.c
@@ -142,8 +142,7 @@ struct wlr_xdg_toplevel *wlr_xdg_toplevel_from_resource(
static void handle_parent_unmap(struct wl_listener *listener, void *data) {
struct wlr_xdg_toplevel *toplevel =
wl_container_of(listener, toplevel, parent_unmap);
- wlr_xdg_toplevel_set_parent(toplevel,
- toplevel->parent->toplevel->parent->toplevel);
+ wlr_xdg_toplevel_set_parent(toplevel, toplevel->parent->parent);
}
void wlr_xdg_toplevel_set_parent(struct wlr_xdg_toplevel *toplevel,
@@ -151,14 +150,12 @@ void wlr_xdg_toplevel_set_parent(struct wlr_xdg_toplevel *toplevel,
if (toplevel->parent) {
wl_list_remove(&toplevel->parent_unmap.link);
}
-
+
+ toplevel->parent = parent;
if (parent) {
- toplevel->parent = parent->base;
toplevel->parent_unmap.notify = handle_parent_unmap;
- wl_signal_add(&toplevel->parent->events.unmap,
+ wl_signal_add(&toplevel->parent->base->events.unmap,
&toplevel->parent_unmap);
- } else {
- toplevel->parent = NULL;
}
wlr_signal_emit_safe(&toplevel->events.set_parent, NULL);