From 5689b6bd33eb72966550679a842f18da5a61cc91 Mon Sep 17 00:00:00 2001 From: Maarten van Gompel Date: Sat, 9 Aug 2025 17:28:57 +0200 Subject: [PATCH] Fix landscape appearance bug in multi-monitor setup In a multi-monitor setup, the keyboard didn't appear correctly since commit 9cc8931b464c1df2f362a57dec63d07821a5893b . This affected only landscape mode and only on multi-monitor setups where wvkbd is launched on anything but the first output (and perhaps even only in multi-monitor setups where one is portrait mode and one landscape like mine, I'm not sure). In the mentioned commit Willow commented: > On situation where multiple screens are present, it will eventually need > a second loop (roundtrip) It seems that second loop never really made it all the way to drawing. Adding an explicit drwsurf_attach() unconditionally in layer_surface_configure fixes this. I'm not sure if this is the best way but this fixes this bug, and as far as I know doesn't cause extra redraws/resizes in the normal single-monitor scenario. Signed-off-by: Maarten van Gompel --- keyboard.h | 1 + main.c | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/keyboard.h b/keyboard.h index ebc0438..14d2d12 100644 --- a/keyboard.h +++ b/keyboard.h @@ -111,6 +111,7 @@ struct kbd { size_t last_abc_index; //the layer index of the last alphabetical layout struct layout *layouts; + struct Output *output; //only used to keep track of landscape flipping, never dereferenced enum layout_id *layers; enum layout_id *landscape_layers; diff --git a/main.c b/main.c index 502d2f5..c1c8f01 100644 --- a/main.c +++ b/main.c @@ -611,7 +611,7 @@ layer_surface_configure(void *data, struct zwlr_layer_surface_v1 *surface, } if (keyboard.w != w || keyboard.h != h || keyboard.scale != scale || - hidden) { + keyboard.output != current_output || hidden) { keyboard.w = w; keyboard.h = h; @@ -665,6 +665,7 @@ layer_surface_configure(void *data, struct zwlr_layer_surface_v1 *surface, zwlr_layer_surface_v1_ack_configure(surface, serial); kbd_resize(&keyboard, layouts, NumLayouts); drwsurf_attach(&draw_surf); + keyboard.output = current_output; } else { zwlr_layer_surface_v1_ack_configure(surface, serial); }