diff --git a/CHANGELOG.md b/CHANGELOG.md index f9adaf47..f0c42984 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -15,6 +15,7 @@ And please only add new entries to the top of this list, right below the `# Unre - Added `Window::is_resizable`. - Added `Window::is_decorated`. - On X11, fix for repeated event loop iteration when `ControlFlow` was `Wait` +- On X11, fix scale factor calculation when the only monitor is reconnected - On Wayland, report unaccelerated mouse deltas in `DeviceEvent::MouseMotion`. - **Breaking:** Bump `ndk` version to 0.6, ndk-sys to `v0.3`, `ndk-glue` to `0.6`. - Remove no longer needed `WINIT_LINK_COLORSYNC` environment variable. diff --git a/src/platform_impl/linux/x11/event_processor.rs b/src/platform_impl/linux/x11/event_processor.rs index be269ce3..77cc5530 100644 --- a/src/platform_impl/linux/x11/event_processor.rs +++ b/src/platform_impl/linux/x11/event_processor.rs @@ -1179,9 +1179,12 @@ impl EventProcessor { if monitor.name == new_monitor.name { let (width, height) = window.inner_size_physical(); let (new_width, new_height) = window.adjust_for_dpi( - // If there all monitors are closed before, scale - // factor would be already changed to 1.0. - maybe_prev_scale_factor.unwrap_or(1.0), + // If we couldn't determine the previous scale + // factor (e.g., because all monitors were closed + // before), just pick whatever the current monitor + // has set as a baseline. + maybe_prev_scale_factor + .unwrap_or(monitor.scale_factor), new_monitor.scale_factor, width, height,