wayland/surface: Implement WL_SURFACE_ERROR_INVALID_SIZE check
From the spec: > This means that at commit time the supplied buffer size must be > an integer multiple of the buffer_scale. If that's not the case, > an invalid_size error is sent. Closes https://gitlab.gnome.org/GNOME/mutter/-/issues/1938 Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2188>
This commit is contained in:
parent
77d5c8c928
commit
ab17c98c94
@ -787,6 +787,17 @@ meta_wayland_surface_apply_state (MetaWaylandSurface *surface,
|
||||
if (state->scale > 0)
|
||||
surface->scale = state->scale;
|
||||
|
||||
if ((get_buffer_width (surface) % surface->scale != 0) ||
|
||||
(get_buffer_height (surface) % surface->scale != 0))
|
||||
{
|
||||
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);
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
if (state->has_new_buffer_transform)
|
||||
surface->buffer_transform = state->buffer_transform;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user