diff --git a/CHANGELOG.md b/CHANGELOG.md index f2272050..00d66919 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -74,8 +74,11 @@ * Race condition for systemd units start in GNOME and KDE ([#1436][1436]). +* One frame being rendered at the wrong scale after being hidden by + another opaque, maximized window ([#1464][1464]). [1436]: https://codeberg.org/dnkl/foot/issues/1436 +[1464]: https://codeberg.org/dnkl/foot/issues/1464 ### Security diff --git a/terminal.c b/terminal.c index 2f81adc8..f19da873 100644 --- a/terminal.c +++ b/terminal.c @@ -1161,6 +1161,7 @@ term_init(const struct config *conf, struct fdm *fdm, struct reaper *reaper, .auto_margin = true, .window_title_stack = tll_init(), .scale = 1., + .scale_before_unmap = -1, .flash = {.fd = flash_fd}, .blink = {.fd = -1}, .vt = { @@ -2094,21 +2095,27 @@ term_update_scale(struct terminal *term) * * - “preferred” scale, from the fractional-scale-v1 protocol * - scaling factor of output we most recently were mapped on - * - if we’re not mapped, use the scaling factor from the first - * available output. + * - if we're not mapped, use the last known scaling factor + * - if we're not mapped, and we don't have a last known scaling + * factor, use the scaling factor from the first available + * output. * - if there aren’t any outputs available, use 1.0 */ - const float new_scale = - (term_fractional_scaling(term) - ? win->scale - : (tll_length(win->on_outputs) > 0 + const float new_scale = (term_fractional_scaling(term) + ? win->scale + : tll_length(win->on_outputs) > 0 ? tll_back(win->on_outputs)->scale - : 1.)); + : term->scale_before_unmap > 0. + ? term->scale_before_unmap + : tll_length(term->wl->monitors) > 0 + ? tll_front(term->wl->monitors).scale + : 1.); if (new_scale == term->scale) return false; LOG_DBG("scaling factor changed: %.2f -> %.2f", term->scale, new_scale); + term->scale_before_unmap = new_scale; term->scale = new_scale; return true; } diff --git a/terminal.h b/terminal.h index 25019ecd..0bba6945 100644 --- a/terminal.h +++ b/terminal.h @@ -489,6 +489,7 @@ struct terminal { } blink; float scale; + float scale_before_unmap; /* Last scaling factor used */ int width; /* pixels */ int height; /* pixels */ int stashed_width;