From 9754241080c326584303bee81547631062f9137f Mon Sep 17 00:00:00 2001 From: Simon Plakolb Date: Tue, 1 Jun 2021 01:49:58 +0200 Subject: [PATCH] Ensure buffer size is multiple of buffer scale An odd value of fe.height lead to the indicator disappearing. This was due to the buffer size no longer being a multiple of the buffer scale. This commit fixes the issue by checking both height and width to be a multiple of scale. This is done early to avoid excessive re-calls of create_buffer if the buffer_height != new_height in render.c line 314 (now 318). --- render.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/render.c b/render.c index d3cad8a..01f27ca 100644 --- a/render.c +++ b/render.c @@ -311,6 +311,10 @@ void render_frame(struct swaylock_surface *surface) { } } + // Ensure buffer size is multiple of buffer scale - required by protocol + new_height += surface->scale - (new_height % surface->scale); + new_width += surface->scale - (new_width % surface->scale); + if (buffer_width != new_width || buffer_height != new_height) { destroy_buffer(surface->current_buffer); surface->indicator_width = new_width;