libweston-desktop/xdg_shell_v6: Send error on wrongly-sized buffer

Signed-off-by: Quentin Glidic <sardemff7+git@sardemff7.net>
Reviewed-by: Daniel Stone <daniels@collabora.com>
dev
Quentin Glidic 8 years ago
parent ee58911912
commit c84423baea
No known key found for this signature in database
GPG Key ID: AC203F96E2C34BB7
  1. 36
      libweston-desktop/xdg-shell-v6.c

@ -625,7 +625,6 @@ weston_desktop_xdg_toplevel_committed(struct weston_desktop_xdg_toplevel *toplev
{ {
struct weston_surface *wsurface = struct weston_surface *wsurface =
weston_desktop_surface_get_surface(toplevel->base.desktop_surface); weston_desktop_surface_get_surface(toplevel->base.desktop_surface);
bool reconfigure = false;
if (!wsurface->buffer_ref.buffer && !toplevel->added) { if (!wsurface->buffer_ref.buffer && !toplevel->added) {
weston_desktop_xdg_toplevel_ensure_added(toplevel); weston_desktop_xdg_toplevel_ensure_added(toplevel);
@ -634,22 +633,27 @@ weston_desktop_xdg_toplevel_committed(struct weston_desktop_xdg_toplevel *toplev
if (!wsurface->buffer_ref.buffer) if (!wsurface->buffer_ref.buffer)
return; return;
if (toplevel->next_state.maximized || toplevel->next_state.fullscreen) if ((toplevel->next_state.maximized || toplevel->next_state.fullscreen) &&
reconfigure = (toplevel->requested_size.width != wsurface->width ||
( ( toplevel->requested_size.width != wsurface->width ) || toplevel->requested_size.height != wsurface->height)) {
( toplevel->requested_size.height != wsurface->height ) ); struct weston_desktop_client *client =
weston_desktop_surface_get_client(toplevel->base.desktop_surface);
if (reconfigure) { struct wl_resource *client_resource =
weston_desktop_xdg_surface_schedule_configure(&toplevel->base); weston_desktop_client_get_resource(client);
} else {
toplevel->state = toplevel->next_state; wl_resource_post_error(client_resource,
toplevel->min_size = toplevel->next_min_size; ZXDG_SHELL_V6_ERROR_INVALID_SURFACE_STATE,
toplevel->max_size = toplevel->next_max_size; "xdg_surface buffer does not match the configured state");
return;
weston_desktop_api_committed(toplevel->base.desktop,
toplevel->base.desktop_surface,
sx, sy);
} }
toplevel->state = toplevel->next_state;
toplevel->min_size = toplevel->next_min_size;
toplevel->max_size = toplevel->next_max_size;
weston_desktop_api_committed(toplevel->base.desktop,
toplevel->base.desktop_surface,
sx, sy);
} }
static void static void

Loading…
Cancel
Save