Fix non consistent Wayland compositors (#1437)

Crostini seems to allow querying the currently active monitor, but not
the position of the window. This way Neovide previously thought "ah yes,
then I can just walk in and reposition" while it actually couldn't.
main
multisn8 2 years ago committed by GitHub
parent 80b9f2edd7
commit f86e457cb3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -350,15 +350,15 @@ pub fn create_window() {
let window = windowed_context.window();
// Check that window is visible in some monitor, and reposition it if not.
if let Some(current_monitor) = window.current_monitor() {
let did_reposition = window
.current_monitor()
.and_then(|current_monitor| {
let monitor_position = current_monitor.position();
let monitor_size = current_monitor.size();
let monitor_width = monitor_size.width as i32;
let monitor_height = monitor_size.height as i32;
let window_position = window
.outer_position()
.expect("Could not get window position");
let window_position = window.outer_position().ok()?;
let window_size = window.outer_size();
let window_width = window_size.width as i32;
let window_height = window_size.height as i32;
@ -370,7 +370,12 @@ pub fn create_window() {
{
window.set_outer_position(monitor_position);
}
}
Some(())
})
.is_some();
log::trace!("repositioned window: {}", did_reposition);
let scale_factor = windowed_context.window().scale_factor();
let renderer = Renderer::new(scale_factor);

Loading…
Cancel
Save