xdg-shell: Take a xdg_surface as the parent surface

There is no other valid surface that we should be using here.

Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
dev
Jasper St. Pierre 10 years ago committed by Pekka Paalanen
parent 502f5e06a2
commit 66bc949b72
  1. 14
      clients/window.c
  2. 12
      desktop-shell/shell.c
  3. 2
      protocol/xdg-shell.xml

@ -253,7 +253,7 @@ struct window {
struct xdg_popup *xdg_popup; struct xdg_popup *xdg_popup;
struct window *parent; struct window *parent;
struct wl_surface *last_parent_surface; struct window *last_parent;
struct ivi_surface *ivi_surface; struct ivi_surface *ivi_surface;
@ -4031,21 +4031,21 @@ static const struct xdg_surface_listener xdg_surface_listener = {
static void static void
window_sync_parent(struct window *window) window_sync_parent(struct window *window)
{ {
struct wl_surface *parent_surface; struct xdg_surface *parent_surface;
if (!window->xdg_surface) if (!window->xdg_surface)
return; return;
if (window->parent == window->last_parent)
return;
if (window->parent) if (window->parent)
parent_surface = window->parent->main_surface->surface; parent_surface = window->parent->xdg_surface;
else else
parent_surface = NULL; parent_surface = NULL;
if (parent_surface == window->last_parent_surface)
return;
xdg_surface_set_parent(window->xdg_surface, parent_surface); xdg_surface_set_parent(window->xdg_surface, parent_surface);
window->last_parent_surface = parent_surface; window->last_parent = window->parent;
} }
static void static void

@ -3717,14 +3717,14 @@ xdg_surface_set_parent(struct wl_client *client,
struct wl_resource *parent_resource) struct wl_resource *parent_resource)
{ {
struct shell_surface *shsurf = wl_resource_get_user_data(resource); struct shell_surface *shsurf = wl_resource_get_user_data(resource);
struct weston_surface *parent; struct shell_surface *parent;
if (parent_resource) if (parent_resource) {
parent = wl_resource_get_user_data(parent_resource); parent = wl_resource_get_user_data(parent_resource);
else shell_surface_set_parent(shsurf, parent->surface);
parent = NULL; } else {
shell_surface_set_parent(shsurf, NULL);
shell_surface_set_parent(shsurf, parent); }
} }
static void static void

@ -152,7 +152,7 @@
unmapped if the parent is unmapped too. They should not appear unmapped if the parent is unmapped too. They should not appear
on task bars and alt+tab. on task bars and alt+tab.
</description> </description>
<arg name="parent" type="object" interface="wl_surface" allow-null="true"/> <arg name="parent" type="object" interface="xdg_surface" allow-null="true"/>
</request> </request>
<request name="set_title"> <request name="set_title">

Loading…
Cancel
Save