From 1f2863fa1873161e8aebf562d439583722a6742f Mon Sep 17 00:00:00 2001 From: Victoria Brekenfeld Date: Tue, 18 Nov 2025 17:00:40 +0100 Subject: [PATCH] xwayland: Fix unscaled dpi setting --- src/xwayland.rs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/xwayland.rs b/src/xwayland.rs index 85fffb9e..2e4cfc0b 100644 --- a/src/xwayland.rs +++ b/src/xwayland.rs @@ -635,7 +635,11 @@ impl Common { // update xorg dpi if let Some(xwm) = xwayland.xwm.as_mut() { - let dpi = new_scale * 96. * 1024.; + let base = 96. * 1024.; + let dpi = new_scale * base; + let fractional = new_scale.fract(); + let integer = (new_scale - fractional).max(1.0); + let unscaled_dpi = base * (1.0 + fractional / integer); if let Err(err) = xwm.set_xsettings( [ ("Xft/DPI".into(), (dpi.round() as i32).into()), @@ -645,7 +649,7 @@ impl Common { ), ( "Gdk/UnscaledDPI".into(), - ((dpi / new_scale).round() as i32).into(), + (unscaled_dpi.round() as i32).into(), ), ( "Gdk/WindowScalingFactor".into(),