|
|
@ -82,6 +82,17 @@ static void xdg_imported_handle_set_parent_of(struct wl_client *client,
|
|
|
|
if (!verify_is_toplevel(resource, wlr_surface_child)) {
|
|
|
|
if (!verify_is_toplevel(resource, wlr_surface_child)) {
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
struct wlr_xdg_surface *surface =
|
|
|
|
|
|
|
|
wlr_xdg_surface_from_wlr_surface(wlr_surface);
|
|
|
|
|
|
|
|
struct wlr_xdg_surface *surface_child =
|
|
|
|
|
|
|
|
wlr_xdg_surface_from_wlr_surface(wlr_surface_child);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (!surface->mapped) {
|
|
|
|
|
|
|
|
wlr_xdg_toplevel_set_parent(surface_child->toplevel, NULL);
|
|
|
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
struct wlr_xdg_imported_child_v1 *child;
|
|
|
|
struct wlr_xdg_imported_child_v1 *child;
|
|
|
|
wl_list_for_each(child, &imported->children, link) {
|
|
|
|
wl_list_for_each(child, &imported->children, link) {
|
|
|
|
if (child->surface == wlr_surface_child) {
|
|
|
|
if (child->surface == wlr_surface_child) {
|
|
|
@ -98,11 +109,6 @@ static void xdg_imported_handle_set_parent_of(struct wl_client *client,
|
|
|
|
child->xdg_surface_unmap.notify = handle_child_xdg_surface_unmap;
|
|
|
|
child->xdg_surface_unmap.notify = handle_child_xdg_surface_unmap;
|
|
|
|
child->xdg_toplevel_set_parent.notify = handle_xdg_toplevel_set_parent;
|
|
|
|
child->xdg_toplevel_set_parent.notify = handle_xdg_toplevel_set_parent;
|
|
|
|
|
|
|
|
|
|
|
|
struct wlr_xdg_surface *surface =
|
|
|
|
|
|
|
|
wlr_xdg_surface_from_wlr_surface(wlr_surface);
|
|
|
|
|
|
|
|
struct wlr_xdg_surface *surface_child =
|
|
|
|
|
|
|
|
wlr_xdg_surface_from_wlr_surface(wlr_surface_child);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
wlr_xdg_toplevel_set_parent(surface_child->toplevel, surface->toplevel);
|
|
|
|
wlr_xdg_toplevel_set_parent(surface_child->toplevel, surface->toplevel);
|
|
|
|
wl_signal_add(&surface_child->events.unmap,
|
|
|
|
wl_signal_add(&surface_child->events.unmap,
|
|
|
|
&child->xdg_surface_unmap);
|
|
|
|
&child->xdg_surface_unmap);
|
|
|
@ -151,11 +157,8 @@ static void destroy_imported(struct wlr_xdg_imported_v1 *imported) {
|
|
|
|
wl_list_for_each_safe(child, child_tmp, &imported->children, link) {
|
|
|
|
wl_list_for_each_safe(child, child_tmp, &imported->children, link) {
|
|
|
|
struct wlr_xdg_surface *xdg_child =
|
|
|
|
struct wlr_xdg_surface *xdg_child =
|
|
|
|
wlr_xdg_surface_from_wlr_surface(child->surface);
|
|
|
|
wlr_xdg_surface_from_wlr_surface(child->surface);
|
|
|
|
|
|
|
|
|
|
|
|
if (xdg_child != NULL) {
|
|
|
|
|
|
|
|
wlr_xdg_toplevel_set_parent(xdg_child->toplevel, NULL);
|
|
|
|
wlr_xdg_toplevel_set_parent(xdg_child->toplevel, NULL);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
wl_list_remove(&imported->exported_destroyed.link);
|
|
|
|
wl_list_remove(&imported->exported_destroyed.link);
|
|
|
|
wl_list_init(&imported->exported_destroyed.link);
|
|
|
|
wl_list_init(&imported->exported_destroyed.link);
|
|
|
@ -169,7 +172,7 @@ static void destroy_imported(struct wlr_xdg_imported_v1 *imported) {
|
|
|
|
static void destroy_exported(struct wlr_xdg_exported_v1 *exported) {
|
|
|
|
static void destroy_exported(struct wlr_xdg_exported_v1 *exported) {
|
|
|
|
wlr_xdg_foreign_exported_finish(&exported->base);
|
|
|
|
wlr_xdg_foreign_exported_finish(&exported->base);
|
|
|
|
|
|
|
|
|
|
|
|
wl_list_remove(&exported->xdg_surface_destroy.link);
|
|
|
|
wl_list_remove(&exported->xdg_surface_unmap.link);
|
|
|
|
wl_list_remove(&exported->link);
|
|
|
|
wl_list_remove(&exported->link);
|
|
|
|
wl_resource_set_user_data(exported->resource, NULL);
|
|
|
|
wl_resource_set_user_data(exported->resource, NULL);
|
|
|
|
free(exported);
|
|
|
|
free(exported);
|
|
|
@ -185,10 +188,10 @@ static void xdg_exported_handle_resource_destroy(
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static void handle_xdg_surface_destroy(
|
|
|
|
static void handle_xdg_surface_unmap(
|
|
|
|
struct wl_listener *listener, void *data) {
|
|
|
|
struct wl_listener *listener, void *data) {
|
|
|
|
struct wlr_xdg_exported_v1 *exported =
|
|
|
|
struct wlr_xdg_exported_v1 *exported =
|
|
|
|
wl_container_of(listener, exported, xdg_surface_destroy);
|
|
|
|
wl_container_of(listener, exported, xdg_surface_unmap);
|
|
|
|
|
|
|
|
|
|
|
|
destroy_exported(exported);
|
|
|
|
destroy_exported(exported);
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -235,10 +238,10 @@ static void xdg_exporter_handle_export(struct wl_client *wl_client,
|
|
|
|
|
|
|
|
|
|
|
|
zxdg_exported_v1_send_handle(exported->resource, exported->base.handle);
|
|
|
|
zxdg_exported_v1_send_handle(exported->resource, exported->base.handle);
|
|
|
|
|
|
|
|
|
|
|
|
exported->xdg_surface_destroy.notify = handle_xdg_surface_destroy;
|
|
|
|
exported->xdg_surface_unmap.notify = handle_xdg_surface_unmap;
|
|
|
|
struct wlr_xdg_surface *xdg_surface =
|
|
|
|
struct wlr_xdg_surface *xdg_surface =
|
|
|
|
wlr_xdg_surface_from_wlr_surface(surface);
|
|
|
|
wlr_xdg_surface_from_wlr_surface(surface);
|
|
|
|
wl_signal_add(&xdg_surface->events.unmap, &exported->xdg_surface_destroy);
|
|
|
|
wl_signal_add(&xdg_surface->events.unmap, &exported->xdg_surface_unmap);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static const struct zxdg_exporter_v1_interface xdg_exporter_impl = {
|
|
|
|
static const struct zxdg_exporter_v1_interface xdg_exporter_impl = {
|
|
|
|