wayland/surface: Post error on invalid scale

To follow the spec and make faulty clients fail hard.

https://gitlab.freedesktop.org/wayland/wayland/blob/master/protocol/wayland.xml#L1618

https://gitlab.gnome.org/GNOME/mutter/merge_requests/647
This commit is contained in:
Robert Mader 2019-03-11 14:33:38 +01:00
parent d7d75dd8e7
commit f2fb3945d1

View File

@ -1072,10 +1072,17 @@ wl_surface_set_buffer_scale (struct wl_client *client,
int scale)
{
MetaWaylandSurface *surface = wl_resource_get_user_data (resource);
if (scale > 0)
surface->pending->scale = scale;
else
g_warning ("Trying to set invalid buffer_scale of %d\n", scale);
if (scale <= 0)
{
wl_resource_post_error (resource,
WL_SURFACE_ERROR_INVALID_SCALE,
"Trying to set invalid buffer_scale of %d\n",
scale);
return;
}
surface->pending->scale = scale;
}
static void