X11: Fix incorrect DPI factor when waking from suspend (#1303)

This commit is contained in:
Murarth 2019-12-04 10:18:20 -07:00 committed by GitHub
parent 2888d5c6cf
commit 1a514dff38
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 14 additions and 6 deletions

View file

@ -8,6 +8,7 @@
- On X11, fix key modifiers being incorrectly reported.
- On X11, fix window creation hanging when another window is fullscreen.
- On Windows, fix focusing unfocused windows when switching from fullscreen to windowed.
- On X11, fix reporting incorrect DPI factor when waking from suspend.
# 0.20.0 Alpha 4 (2019-10-18)

View file

@ -406,14 +406,16 @@ impl<T: 'static> EventProcessor<T> {
let last_hidpi_factor = shared_state_lock.last_monitor.hidpi_factor;
let new_hidpi_factor = {
let window_rect = util::AaRect::new(new_outer_position, new_inner_size);
monitor = wt.xconn.get_monitor_for_window(Some(window_rect));
let new_hidpi_factor = monitor.hidpi_factor;
let new_monitor = wt.xconn.get_monitor_for_window(Some(window_rect));
// Avoid caching an invalid dummy monitor handle
if monitor.id != 0 {
if new_monitor.is_dummy() {
// Avoid updating monitor using a dummy monitor handle
last_hidpi_factor
} else {
monitor = new_monitor;
shared_state_lock.last_monitor = monitor.clone();
monitor.hidpi_factor
}
new_hidpi_factor
};
if last_hidpi_factor != new_hidpi_factor {
events.dpi_changed =

View file

@ -143,6 +143,11 @@ impl MonitorHandle {
}
}
pub(crate) fn is_dummy(&self) -> bool {
// Zero is an invalid XID value; no real monitor will have it
self.id == 0
}
pub fn name(&self) -> Option<String> {
Some(self.name.clone())
}

View file

@ -651,7 +651,7 @@ impl UnownedWindow {
};
// Don't set fullscreen on an invalid dummy monitor handle
if monitor.id == 0 {
if monitor.is_dummy() {
return None;
}