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.
This commit is contained in:
fwsmit 2021-04-30 22:00:53 +02:00
parent e69adcefea
commit ea531ca9ae

View File

@ -898,10 +898,19 @@ bool wl_have_fullscreen_window(void) {
} }
int wl_get_scale(void) { int wl_get_scale(void) {
int scale = 0;
struct dunst_output *output = get_configured_output(); struct dunst_output *output = get_configured_output();
if (output) if (output) {
return output->scale; scale = output->scale;
else } else {
return 1; // 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: */ /* vim: set ft=c tabstop=8 shiftwidth=8 expandtab textwidth=0: */