xwayland: Fix unscaled dpi setting
This commit is contained in:
parent
b9d7870f71
commit
1f2863fa18
1 changed files with 6 additions and 2 deletions
|
|
@ -635,7 +635,11 @@ impl Common {
|
||||||
|
|
||||||
// update xorg dpi
|
// update xorg dpi
|
||||||
if let Some(xwm) = xwayland.xwm.as_mut() {
|
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(
|
if let Err(err) = xwm.set_xsettings(
|
||||||
[
|
[
|
||||||
("Xft/DPI".into(), (dpi.round() as i32).into()),
|
("Xft/DPI".into(), (dpi.round() as i32).into()),
|
||||||
|
|
@ -645,7 +649,7 @@ impl Common {
|
||||||
),
|
),
|
||||||
(
|
(
|
||||||
"Gdk/UnscaledDPI".into(),
|
"Gdk/UnscaledDPI".into(),
|
||||||
((dpi / new_scale).round() as i32).into(),
|
(unscaled_dpi.round() as i32).into(),
|
||||||
),
|
),
|
||||||
(
|
(
|
||||||
"Gdk/WindowScalingFactor".into(),
|
"Gdk/WindowScalingFactor".into(),
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue