xdg-toplevel: change parent type to xdg-toplevel

This commit changes wlr_xdg_toplevel::parent type from wlr_xdg_surface
to wlr_xdg_toplevel.
This commit is contained in:
Kirill Primak 2022-01-08 22:52:53 +03:00
parent 27c8865a4d
commit 1e4c1a3b58
2 changed files with 5 additions and 8 deletions

View file

@ -125,7 +125,7 @@ struct wlr_xdg_toplevel {
struct wlr_xdg_surface *base; struct wlr_xdg_surface *base;
bool added; bool added;
struct wlr_xdg_surface *parent; struct wlr_xdg_toplevel *parent;
struct wl_listener parent_unmap; struct wl_listener parent_unmap;
struct wlr_xdg_toplevel_state current, pending; struct wlr_xdg_toplevel_state current, pending;

View file

@ -142,8 +142,7 @@ struct wlr_xdg_toplevel *wlr_xdg_toplevel_from_resource(
static void handle_parent_unmap(struct wl_listener *listener, void *data) { static void handle_parent_unmap(struct wl_listener *listener, void *data) {
struct wlr_xdg_toplevel *toplevel = struct wlr_xdg_toplevel *toplevel =
wl_container_of(listener, toplevel, parent_unmap); wl_container_of(listener, toplevel, parent_unmap);
wlr_xdg_toplevel_set_parent(toplevel, wlr_xdg_toplevel_set_parent(toplevel, toplevel->parent->parent);
toplevel->parent->toplevel->parent->toplevel);
} }
void wlr_xdg_toplevel_set_parent(struct wlr_xdg_toplevel *toplevel, void wlr_xdg_toplevel_set_parent(struct wlr_xdg_toplevel *toplevel,
@ -152,13 +151,11 @@ void wlr_xdg_toplevel_set_parent(struct wlr_xdg_toplevel *toplevel,
wl_list_remove(&toplevel->parent_unmap.link); wl_list_remove(&toplevel->parent_unmap.link);
} }
toplevel->parent = parent;
if (parent) { if (parent) {
toplevel->parent = parent->base;
toplevel->parent_unmap.notify = handle_parent_unmap; 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); &toplevel->parent_unmap);
} else {
toplevel->parent = NULL;
} }
wlr_signal_emit_safe(&toplevel->events.set_parent, NULL); wlr_signal_emit_safe(&toplevel->events.set_parent, NULL);