X11: Fix panic when no monitors are available (#1158)
* X11: Fix panic when no monitors are available * Set dummy monitor's dimensions to `(1, 1)` * X11: Avoid panicking when there are no monitors in Window::new
This commit is contained in:
parent
c0a7900341
commit
472eddcc1b
4 changed files with 38 additions and 11 deletions
|
|
@ -389,7 +389,11 @@ impl<T: 'static> EventProcessor<T> {
|
|||
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;
|
||||
shared_state_lock.last_monitor = Some(monitor.clone());
|
||||
|
||||
// Avoid caching an invalid dummy monitor handle
|
||||
if monitor.id != 0 {
|
||||
shared_state_lock.last_monitor = Some(monitor.clone());
|
||||
}
|
||||
new_hidpi_factor
|
||||
};
|
||||
if last_hidpi_factor != new_hidpi_factor {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue