Commit 56f22547 authored by Marius-Cristian Vlad's avatar Marius-Cristian Vlad

xdg-shell: set_parent should be no-op if there are no children and the surface is null

Signed-off-by: Marius-Cristian Vlad's avatarMarius Vlad <marius.vlad@collabora.com>
parent 37250b8a
......@@ -192,6 +192,8 @@ weston_desktop_surface_set_app_id(struct weston_desktop_surface *surface,
void
weston_desktop_surface_set_pid(struct weston_desktop_surface *surface,
pid_t pid);
bool
weston_desktop_surface_children_list_empty(struct weston_desktop_surface *surface);
void
weston_desktop_surface_set_geometry(struct weston_desktop_surface *surface,
struct weston_geometry geometry);
......
......@@ -724,6 +724,12 @@ weston_desktop_surface_set_pid(struct weston_desktop_surface *surface,
surface->pid = pid;
}
bool
weston_desktop_surface_children_list_empty(struct weston_desktop_surface *surface)
{
return wl_list_empty(&surface->children_list);
}
void
weston_desktop_surface_set_geometry(struct weston_desktop_surface *surface,
struct weston_geometry geometry)
......
......@@ -346,8 +346,12 @@ weston_desktop_xdg_toplevel_protocol_set_parent(struct wl_client *wl_client,
weston_desktop_surface_get_implementation_data(dsurface);
struct weston_desktop_surface *parent = NULL;
if (parent_resource != NULL)
if (parent_resource != NULL) {
parent = wl_resource_get_user_data(parent_resource);
} else {
if (weston_desktop_surface_children_list_empty(dsurface))
return;
}
weston_desktop_xdg_toplevel_ensure_added(toplevel);
weston_desktop_api_set_parent(toplevel->base.desktop, dsurface, parent);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment