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. 22
      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,14 +633,20 @@ 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);
struct wl_resource *client_resource =
weston_desktop_client_get_resource(client);
wl_resource_post_error(client_resource,
ZXDG_SHELL_V6_ERROR_INVALID_SURFACE_STATE,
"xdg_surface buffer does not match the configured state");
return;
}
if (reconfigure) {
weston_desktop_xdg_surface_schedule_configure(&toplevel->base);
} else {
toplevel->state = toplevel->next_state; toplevel->state = toplevel->next_state;
toplevel->min_size = toplevel->next_min_size; toplevel->min_size = toplevel->next_min_size;
toplevel->max_size = toplevel->next_max_size; toplevel->max_size = toplevel->next_max_size;
@ -649,7 +654,6 @@ weston_desktop_xdg_toplevel_committed(struct weston_desktop_xdg_toplevel *toplev
weston_desktop_api_committed(toplevel->base.desktop, weston_desktop_api_committed(toplevel->base.desktop,
toplevel->base.desktop_surface, toplevel->base.desktop_surface,
sx, sy); sx, sy);
}
} }
static void static void

Loading…
Cancel
Save