diff options
-rw-r--r-- | CHANGELOG.md | 1 | ||||
-rw-r--r-- | alacritty/src/display/window.rs | 13 |
2 files changed, 13 insertions, 1 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md index 78a2ef01..e568c92d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -21,6 +21,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). - Segmentation fault on shutdown with Wayland - Incorrect estimated DPR with Wayland - Consecutive clipboard stores dropped on Wayland until the application is refocused +- Alacritty failing to start on X11 with invalid DPI reported by XRandr ### Removed diff --git a/alacritty/src/display/window.rs b/alacritty/src/display/window.rs index 1bd3525a..7302c687 100644 --- a/alacritty/src/display/window.rs +++ b/alacritty/src/display/window.rs @@ -60,6 +60,10 @@ use crate::gl; #[cfg(all(feature = "x11", not(any(target_os = "macos", windows))))] static WINDOW_ICON: &[u8] = include_bytes!("../../alacritty.png"); +/// Maximum DPR on X11 before it is assumed that XRandr is reporting incorrect values. +#[cfg(all(feature = "x11", not(any(target_os = "macos", windows))))] +const MAX_X11_DPR: f64 = 10.; + /// This should match the definition of IDI_ICON from `windows.rc`. #[cfg(windows)] const IDI_ICON: WORD = 0x101; @@ -216,7 +220,14 @@ impl Window { None }; - let dpr = windowed_context.window().scale_factor(); + #[allow(unused_mut)] + let mut dpr = windowed_context.window().scale_factor(); + + // Handle winit reporting invalid values due to incorrect XRandr monitor metrics. + #[cfg(all(feature = "x11", not(any(target_os = "macos", windows))))] + if !is_wayland && dpr > MAX_X11_DPR { + dpr = 1.; + } Ok(Self { current_mouse_cursor, |