aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Eklöf <daniel@ekloef.se>2023-06-26 19:07:24 +0000
committerDaniel Eklöf <daniel@ekloef.se>2023-06-29 13:38:24 +0000
commit8f74b1090a6a5297ac7b6710420528ff56ed03d2 (patch)
treede928b326d321822df7da822d329cd1803a0e820
parentwayland: refactor: surface_scale(): pass wl_window pointer, instead of wayland global (diff)
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.
-rw-r--r--wayland.c3
-rw-r--r--wayland.h1
2 files changed, 3 insertions, 1 deletions
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;