From 8f74b1090a6a5297ac7b6710420528ff56ed03d2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Ekl=C3=B6f?= Date: Mon, 26 Jun 2023 21:07:24 +0200 Subject: [PATCH] wayland: use legacy scaling until fractional_scale::preferred_scale() has been called This way, the initial frame is more likely to get scaled correctly; foot will guess the initial (integer) scale from the available monitors, and use that. By using legacy scaling, we force the compositor to down-scale the image to the correct scale factor. If we use the new fraction scaling method with an integer scaling factor, the initial frame gets rendered way too big. --- wayland.c | 3 ++- wayland.h | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/wayland.c b/wayland.c index aa1b298c..bf8f2682 100644 --- a/wayland.c +++ b/wayland.c @@ -1529,6 +1529,7 @@ static void fractional_scale_preferred_scale( { struct wl_window *win = data; win->scale = (float)scale / 120.; + win->have_preferred_scale = true; LOG_DBG("fractional scale: %.3f", win->scale); update_term_for_output_change(win->term); @@ -1895,7 +1896,7 @@ wayl_surface_scale_explicit_width_height( int width, int height, float scale) { - if (wayl_fractional_scaling(wayl)) { + if (wayl_fractional_scaling(win->term->wl) && win->have_preferred_scale) { #if defined(HAVE_FRACTIONAL_SCALE) LOG_DBG("scaling by a factor of %.2f (fractional scaling)", scale); wp_viewport_set_destination( diff --git a/wayland.h b/wayland.h index 7305ade7..e2d22031 100644 --- a/wayland.h +++ b/wayland.h @@ -346,6 +346,7 @@ struct wl_window { bool unmapped; float scale; + bool have_preferred_scale; struct zxdg_toplevel_decoration_v1 *xdg_toplevel_decoration;