Projects STRLCPY alacritty Commits 8b4c8e9d
🤬
  • Fix the estimated DPR to 1 on Wayland.

    On Wayland, regardless of the underlying scale factor for an output, The
    scale factor is 1.0 until we receive the first DPRChanged event. To
    correctly calculate the window sizes, we must use a DPR of 1.0 as well.
    
    Ideally we would know what the DPR of the window we're being opened in
    is going to be, and avoid the estimation guessing game, but that doesn't
    seem possible with the current interfaces provided by the window
    systems.
  • Loading...
  • 8b4c8e9d
    1 parent 5e8c9f16
Revision indexing in progress... (symbol navigation in revisions will be accurate after indexed)
  • ■ ■ ■ ■ ■
    CHANGELOG.md
    skipped 10 lines
    11 11   
    12 12  - Crash due to assertion failure on 32-bit architectures
    13 13  - Segmentation fault on shutdown with Wayland
     14 +- Incorrect estimated DPR with Wayland
    14 15   
    15 16  ## 0.7.1
    16 17   
    skipped 839 lines
  • ■ ■ ■ ■ ■ ■
    alacritty/src/display.rs
    skipped 168 lines
    169 169   
    170 170  impl Display {
    171 171   pub fn new<E>(config: &Config, event_loop: &EventLoop<E>) -> Result<Display, Error> {
    172  - // Guess DPR based on first monitor.
    173  - let estimated_dpr =
    174  - event_loop.available_monitors().next().map(|m| m.scale_factor()).unwrap_or(1.);
     172 + #[cfg(any(not(feature = "x11"), target_os = "macos", windows))]
     173 + let is_x11 = false;
     174 + #[cfg(all(feature = "x11", not(any(target_os = "macos", windows))))]
     175 + let is_x11 = event_loop.is_x11();
     176 + 
     177 + // Guess DPR based on first monitor. On Wayland the initial frame always renders at a DPR
     178 + // of 1.
     179 + let estimated_dpr = if cfg!(any(target_os = "macos", windows)) || is_x11 {
     180 + event_loop.available_monitors().next().map(|m| m.scale_factor()).unwrap_or(1.)
     181 + } else {
     182 + 1.
     183 + };
    175 184   
    176 185   // Guess the target window dimensions.
    177 186   let metrics = GlyphCache::static_metrics(config.ui_config.font.clone(), estimated_dpr)?;
    skipped 80 lines
    258 267   // Disable shadows for transparent windows on macOS.
    259 268   #[cfg(target_os = "macos")]
    260 269   window.set_has_shadow(config.ui_config.background_opacity() >= 1.0);
    261  - 
    262  - #[cfg(all(feature = "x11", not(any(target_os = "macos", windows))))]
    263  - let is_x11 = event_loop.is_x11();
    264  - #[cfg(not(any(feature = "x11", target_os = "macos", windows)))]
    265  - let is_x11 = false;
    266 270   
    267 271   // On Wayland we can safely ignore this call, since the window isn't visible until you
    268 272   // actually draw something into it and commit those changes.
    skipped 528 lines
Please wait...
Page is in error, reload to recover