mirror of
https://github.com/storytold/pdfcraft.git
synced 2026-10-24 10:08:00 -06:00
Linux: prefer server DPI over panel physical DPI in vendored winit (#1150)
* fix(x11): prefer server DPI over panel physical DPI in winit Without Xft DPI, use the X server screen dimensions before the output physical density. Xorg can run a dense panel at 96 DPI; EDID sizes alone make only winit apps appear zoomed. Supersedes #908: preserves Xft.dpi priority, configured HiDPI screens, and WINIT_X11_SCALE_FACTOR override (including randr). Falls back to RandR output density when server dimensions are missing. Adds default_dpi_factor() with 4 unit tests plus vendored-copy guard test in apps/pdfcraft/tests/winit_x11_dpi.rs. * vendor/README: record the winit X11 DPI patch as (11) --------- Co-authored-by: Brandon Thomas <echelon@gmail.com>
This commit is contained in:
@@ -0,0 +1,14 @@
|
||||
#[test]
|
||||
fn winit_carries_the_x11_server_dpi_fallback() {
|
||||
// The behavior tests live beside the policy in winit (util::randr::tests).
|
||||
// This guards PdfCraft's vendored copy, which workspace tests do not test itself.
|
||||
let root = std::path::Path::new(env!("CARGO_MANIFEST_DIR")).join("../..");
|
||||
let randr = std::fs::read_to_string(root.join("vendor/winit/src/platform_impl/linux/x11/util/randr.rs")).unwrap();
|
||||
assert!(randr.contains("let screen = self.default_root();"));
|
||||
assert!(randr.contains("default_dpi_factor(\n self.get_xft_dpi(),"));
|
||||
assert!(randr.contains("screen.width_in_millimeters.into()"));
|
||||
assert!(randr.contains("calc_dpi_factor(screen_pixels, screen_mm)"));
|
||||
assert!(randr.contains("server_dpi_wins_over_the_panels_physical_density"));
|
||||
let desktop = std::fs::read_to_string(root.join("packaging/linux/ai.storyteller.pdfcraft.desktop")).unwrap();
|
||||
assert!(!desktop.contains("WINIT_X11_SCALE_FACTOR"));
|
||||
}
|
||||
Reference in New Issue
Block a user