libweston-desktop/xdg_shell_v6: Add surface as needed

Signed-off-by: Quentin Glidic <sardemff7+git@sardemff7.net>
Reviewed-by: Jonas Ådahl <jadahl@gmail.com>
dev
Quentin Glidic 8 years ago
parent e30b5fb2e7
commit 3d7e60798a
No known key found for this signature in database
GPG Key ID: AC203F96E2C34BB7
  1. 24
      libweston-desktop/xdg-shell-v6.c

@ -283,6 +283,18 @@ static const struct zxdg_positioner_v6_interface weston_desktop_xdg_positioner_i
static void static void
weston_desktop_xdg_surface_schedule_configure(struct weston_desktop_xdg_surface *surface); weston_desktop_xdg_surface_schedule_configure(struct weston_desktop_xdg_surface *surface);
static void
weston_desktop_xdg_toplevel_ensure_added(struct weston_desktop_xdg_toplevel *toplevel)
{
if (toplevel->added)
return;
weston_desktop_api_surface_added(toplevel->base.desktop,
toplevel->base.desktop_surface);
weston_desktop_xdg_surface_schedule_configure(&toplevel->base);
toplevel->added = true;
}
static void static void
weston_desktop_xdg_toplevel_protocol_set_parent(struct wl_client *wl_client, weston_desktop_xdg_toplevel_protocol_set_parent(struct wl_client *wl_client,
struct wl_resource *resource, struct wl_resource *resource,
@ -296,6 +308,8 @@ weston_desktop_xdg_toplevel_protocol_set_parent(struct wl_client *wl_client,
if (parent_resource != NULL) if (parent_resource != NULL)
parent = wl_resource_get_user_data(parent_resource); parent = wl_resource_get_user_data(parent_resource);
weston_desktop_xdg_toplevel_ensure_added(toplevel);
weston_desktop_api_set_parent(toplevel->base.desktop, dsurface, parent); weston_desktop_api_set_parent(toplevel->base.desktop, dsurface, parent);
} }
@ -416,6 +430,7 @@ weston_desktop_xdg_toplevel_protocol_set_maximized(struct wl_client *wl_client,
struct weston_desktop_xdg_toplevel *toplevel = struct weston_desktop_xdg_toplevel *toplevel =
weston_desktop_surface_get_implementation_data(dsurface); weston_desktop_surface_get_implementation_data(dsurface);
weston_desktop_xdg_toplevel_ensure_added(toplevel);
weston_desktop_api_maximized_requested(toplevel->base.desktop, dsurface, true); weston_desktop_api_maximized_requested(toplevel->base.desktop, dsurface, true);
} }
@ -428,6 +443,7 @@ weston_desktop_xdg_toplevel_protocol_unset_maximized(struct wl_client *wl_client
struct weston_desktop_xdg_toplevel *toplevel = struct weston_desktop_xdg_toplevel *toplevel =
weston_desktop_surface_get_implementation_data(dsurface); weston_desktop_surface_get_implementation_data(dsurface);
weston_desktop_xdg_toplevel_ensure_added(toplevel);
weston_desktop_api_maximized_requested(toplevel->base.desktop, dsurface, false); weston_desktop_api_maximized_requested(toplevel->base.desktop, dsurface, false);
} }
@ -445,6 +461,7 @@ weston_desktop_xdg_toplevel_protocol_set_fullscreen(struct wl_client *wl_client,
if (output_resource != NULL) if (output_resource != NULL)
output = wl_resource_get_user_data(output_resource); output = wl_resource_get_user_data(output_resource);
weston_desktop_xdg_toplevel_ensure_added(toplevel);
weston_desktop_api_fullscreen_requested(toplevel->base.desktop, dsurface, weston_desktop_api_fullscreen_requested(toplevel->base.desktop, dsurface,
true, output); true, output);
} }
@ -458,6 +475,7 @@ weston_desktop_xdg_toplevel_protocol_unset_fullscreen(struct wl_client *wl_clien
struct weston_desktop_xdg_toplevel *toplevel = struct weston_desktop_xdg_toplevel *toplevel =
weston_desktop_surface_get_implementation_data(dsurface); weston_desktop_surface_get_implementation_data(dsurface);
weston_desktop_xdg_toplevel_ensure_added(toplevel);
weston_desktop_api_fullscreen_requested(toplevel->base.desktop, dsurface, weston_desktop_api_fullscreen_requested(toplevel->base.desktop, dsurface,
false, NULL); false, NULL);
} }
@ -471,6 +489,7 @@ weston_desktop_xdg_toplevel_protocol_set_minimized(struct wl_client *wl_client,
struct weston_desktop_xdg_toplevel *toplevel = struct weston_desktop_xdg_toplevel *toplevel =
weston_desktop_surface_get_implementation_data(dsurface); weston_desktop_surface_get_implementation_data(dsurface);
weston_desktop_xdg_toplevel_ensure_added(toplevel);
weston_desktop_api_minimized_requested(toplevel->base.desktop, dsurface); weston_desktop_api_minimized_requested(toplevel->base.desktop, dsurface);
} }
@ -584,10 +603,7 @@ weston_desktop_xdg_toplevel_committed(struct weston_desktop_xdg_toplevel *toplev
bool reconfigure = false; bool reconfigure = false;
if (!wsurface->buffer_ref.buffer && !toplevel->added) { if (!wsurface->buffer_ref.buffer && !toplevel->added) {
weston_desktop_api_surface_added(toplevel->base.desktop, weston_desktop_xdg_toplevel_ensure_added(toplevel);
toplevel->base.desktop_surface);
weston_desktop_xdg_surface_schedule_configure(&toplevel->base);
toplevel->added = true;
return; return;
} }
if (!wsurface->buffer_ref.buffer) if (!wsurface->buffer_ref.buffer)

Loading…
Cancel
Save