From f426155e0b11a5d1a7c95e1068729178bf99fbad Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Ekl=C3=B6f?= Date: Fri, 10 Jul 2020 11:43:34 +0200 Subject: [PATCH] bar/wayland: explicitly refresh on scale changes Just calling update_size() isn't enough, as that in itself doesn't trigger a redraw. --- bar/wayland.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/bar/wayland.c b/bar/wayland.c index 8a4247d..511109c 100644 --- a/bar/wayland.c +++ b/bar/wayland.c @@ -378,6 +378,7 @@ output_done(void *data, struct wl_output *wl_output) } static bool update_size(struct wayland_backend *backend); +static void refresh(const struct bar *_bar); static void output_scale(void *data, struct wl_output *wl_output, int32_t factor) @@ -388,8 +389,13 @@ output_scale(void *data, struct wl_output *wl_output, int32_t factor) mon->scale = factor; - if (mon->backend->monitor == mon) + if (mon->backend->monitor == mon) { + int old_scale = mon->backend->scale; update_size(mon->backend); + + if (mon->backend->scale != old_scale) + refresh(mon->backend->bar); + } } @@ -1054,7 +1060,12 @@ surface_enter(void *data, struct wl_surface *wl_surface, if (backend->monitor != mon) { backend->monitor = mon; + + int old_scale = backend->scale; update_size(backend); + + if (backend->scale != old_scale) + refresh(backend->bar); } break; }