aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIlia Bozhinov <ammen99@gmail.com>2021-01-05 20:14:47 +0100
committerSimon Ser <contact@emersion.fr>2021-01-05 20:32:56 +0100
commit42d033e738d8ef213f13e1de849899d563f92a5b (patch)
tree6b2a70470b36c541e38f2c4241c0425057c4342b
parentbf4e2e0eac4b336747979dbda30d4f328ab0bf3d (diff)
xdg-shell: add wlr_xdg_toplevel_set_parent
Co-authored-by: Jason Francis <cycl0ps@tuta.io>
-rw-r--r--include/wlr/types/wlr_xdg_shell.h6
-rw-r--r--types/xdg_shell/wlr_xdg_toplevel.c10
2 files changed, 10 insertions, 6 deletions
diff --git a/include/wlr/types/wlr_xdg_shell.h b/include/wlr/types/wlr_xdg_shell.h
index 0b9167d2..8ca3a2b1 100644
--- a/include/wlr/types/wlr_xdg_shell.h
+++ b/include/wlr/types/wlr_xdg_shell.h
@@ -310,6 +310,12 @@ uint32_t wlr_xdg_toplevel_set_tiled(struct wlr_xdg_surface *surface,
void wlr_xdg_toplevel_send_close(struct wlr_xdg_surface *surface);
/**
+ * Sets the parent of this toplevel. Parent can be NULL.
+ */
+void wlr_xdg_toplevel_set_parent(struct wlr_xdg_surface *surface,
+ struct wlr_xdg_surface *parent);
+
+/**
* Request that this xdg popup closes.
**/
void wlr_xdg_popup_destroy(struct wlr_xdg_surface *surface);
diff --git a/types/xdg_shell/wlr_xdg_toplevel.c b/types/xdg_shell/wlr_xdg_toplevel.c
index 51d0687b..03d31897 100644
--- a/types/xdg_shell/wlr_xdg_toplevel.c
+++ b/types/xdg_shell/wlr_xdg_toplevel.c
@@ -194,16 +194,14 @@ struct wlr_xdg_surface *wlr_xdg_surface_from_toplevel_resource(
return wl_resource_get_user_data(resource);
}
-static void set_parent(struct wlr_xdg_surface *surface,
- struct wlr_xdg_surface *parent);
-
static void handle_parent_unmap(struct wl_listener *listener, void *data) {
struct wlr_xdg_toplevel *toplevel =
wl_container_of(listener, toplevel, parent_unmap);
- set_parent(toplevel->base, toplevel->parent->toplevel->parent);
+ wlr_xdg_toplevel_set_parent(toplevel->base,
+ toplevel->parent->toplevel->parent);
}
-static void set_parent(struct wlr_xdg_surface *surface,
+void wlr_xdg_toplevel_set_parent(struct wlr_xdg_surface *surface,
struct wlr_xdg_surface *parent) {
assert(surface->role == WLR_XDG_SURFACE_ROLE_TOPLEVEL);
assert(!parent || parent->role == WLR_XDG_SURFACE_ROLE_TOPLEVEL);
@@ -232,7 +230,7 @@ static void xdg_toplevel_handle_set_parent(struct wl_client *client,
parent = wlr_xdg_surface_from_toplevel_resource(parent_resource);
}
- set_parent(surface, parent);
+ wlr_xdg_toplevel_set_parent(surface, parent);
}
static void xdg_toplevel_handle_set_title(struct wl_client *client,