From 5a3f3c7ca7916d7b9affaebc46e59f83d296f96d Mon Sep 17 00:00:00 2001 From: Derek Foreman Date: Tue, 14 Oct 2025 12:01:50 -0500 Subject: [PATCH] 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 --- clients/desktop-shell.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/clients/desktop-shell.c b/clients/desktop-shell.c index 1a471d28f..0722e954c 100644 --- a/clients/desktop-shell.c +++ b/clients/desktop-shell.c @@ -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); }