From ea531ca9aea25de228a57bc23ea07277ea3d6e1f Mon Sep 17 00:00:00 2001 From: fwsmit Date: Fri, 30 Apr 2021 22:00:53 +0200 Subject: [PATCH] wayland: Return the largest scale when output cannot be found When follow mode != none dunst cannot detect what output is being used to display the notification (yet). With this commit dunst falls back to using the largest scale from any ouput. The compositor should scale the buffer down again if the scale of the output is smaller that the used scale. --- src/wayland/wl.c | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/src/wayland/wl.c b/src/wayland/wl.c index 8f744a9..b5df3de 100644 --- a/src/wayland/wl.c +++ b/src/wayland/wl.c @@ -898,10 +898,19 @@ bool wl_have_fullscreen_window(void) { } int wl_get_scale(void) { + int scale = 0; struct dunst_output *output = get_configured_output(); - if (output) - return output->scale; - else - return 1; + if (output) { + scale = output->scale; + } else { + // return the largest scale + struct dunst_output *output; + wl_list_for_each(output, &ctx.outputs, link) { + scale = MAX(output->scale, scale); + } + } + if (scale <= 0) + scale = 1; + return scale; } /* vim: set ft=c tabstop=8 shiftwidth=8 expandtab textwidth=0: */