desktop-shell: Force scale to 1 for single pixel buffer

Now that we use single pixel buffer, we need to be careful to only use
scale of 1, as other scales are supposed to generate an INVALID_SIZE
protocol errors (because the buffer size is not an integer multiple
of the scale).

Right now a bad scale just breaks background repaints, but in the future
we'll properly validate scale, which would cause the shell client to
be disconnected.

Fixes: 6cc8f48cd ("clients: Paint desktop-shell color background with single-pixel-buffer")

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
This commit is contained in:
Derek Foreman 2025-10-14 12:01:50 -05:00
parent 52503ba9e6
commit 5a3f3c7ca7

View file

@ -806,6 +806,9 @@ background_draw(struct widget *widget, void *data)
uint32_t r8, g8, b8;
uint32_t r32, g32, b32;
/* Single pixel buffer must use scale 1 */
window_set_buffer_scale(background->window, 1);
sp_manager = display_get_single_pixel_buffer_manager(display);
assert(sp_manager);
wl_surface = widget_get_wl_surface(background->widget);
@ -1379,10 +1382,11 @@ output_handle_scale(void *data,
int32_t scale)
{
struct output *output = data;
struct background *background = output->background;
if (output->panel)
window_set_buffer_scale(output->panel->window, scale);
if (output->background)
if (background && !background->color)
window_set_buffer_scale(output->background->window, scale);
}