wayland/surface: Reenable WL_SURFACE_ERROR_INVALID_SIZE check

This partly reverts f9857cb8 but leaves an exception for cursor
surfaces in place, as some apps/toolkits will likely not get updated
anytime soon to ensure cursor themes comply with the Wayland spec.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2815>
This commit is contained in:
Robert Mader 2023-01-30 17:53:41 +01:00 committed by Marge Bot
parent 733aa0e3b7
commit 120e21db7c

View File

@ -772,16 +772,27 @@ meta_wayland_surface_apply_state (MetaWaylandSurface *surface,
if ((get_buffer_width (surface) % surface->scale != 0) || if ((get_buffer_width (surface) % surface->scale != 0) ||
(get_buffer_height (surface) % surface->scale != 0)) (get_buffer_height (surface) % surface->scale != 0))
{ {
struct wl_resource *resource = surface->resource; if (surface->role && !META_IS_WAYLAND_CURSOR_SURFACE (surface->role))
pid_t pid; {
wl_resource_post_error (surface->resource, WL_SURFACE_ERROR_INVALID_SIZE,
"Buffer size (%dx%d) must be an integer multiple "
"of the buffer_scale (%d).",
get_buffer_width (surface),
get_buffer_height (surface), surface->scale);
}
else
{
struct wl_resource *resource = surface->resource;
pid_t pid;
wl_client_get_credentials (wl_resource_get_client (resource), &pid, NULL, wl_client_get_credentials (wl_resource_get_client (resource), &pid, NULL,
NULL); NULL);
g_warning ("Bug in client with pid %ld: Buffer size (%dx%d) is not an" g_warning ("Bug in client with pid %ld: Cursor buffer size (%dx%d) is "
"integer multiple of the buffer_scale (%d).", (long) pid, "not an integer multiple of the buffer_scale (%d).",
get_buffer_width (surface), get_buffer_height (surface), (long) pid, get_buffer_width (surface),
surface->scale); get_buffer_height (surface), surface->scale);
}
} }
if (state->has_new_buffer_transform) if (state->has_new_buffer_transform)