mirror of
https://github.com/italicsjenga/winit-sonoma-fix.git
synced 2025-01-11 21:31:29 +11:00
Fix x11 window size calculations (#402)
The fix for returning accurate window position lead to a regression computing inner size in pixels. This commit resolves that by getting inner size from the window ID winit caches and still resolving position by climbing the window hierarchy. Resolves #398
This commit is contained in:
parent
ff17eff00f
commit
4cce65274f
|
@ -533,6 +533,17 @@ impl Window2 {
|
||||||
let mut border: libc::c_uint = mem::uninitialized();
|
let mut border: libc::c_uint = mem::uninitialized();
|
||||||
let mut depth: libc::c_uint = mem::uninitialized();
|
let mut depth: libc::c_uint = mem::uninitialized();
|
||||||
|
|
||||||
|
// Get non-positioning data from winit window
|
||||||
|
if (self.x.display.xlib.XGetGeometry)(self.x.display.display, self.x.window,
|
||||||
|
&mut root, &mut x, &mut y, &mut width, &mut height,
|
||||||
|
&mut border, &mut depth) == 0
|
||||||
|
{
|
||||||
|
return None;
|
||||||
|
}
|
||||||
|
|
||||||
|
let width_out = width;
|
||||||
|
let height_out = height;
|
||||||
|
let border_out = border;
|
||||||
|
|
||||||
// Some window managers like i3wm will actually nest application
|
// Some window managers like i3wm will actually nest application
|
||||||
// windows (like those opened by winit) within other windows to, for
|
// windows (like those opened by winit) within other windows to, for
|
||||||
|
@ -562,7 +573,7 @@ impl Window2 {
|
||||||
return None;
|
return None;
|
||||||
}
|
}
|
||||||
|
|
||||||
Some((x as i32, y as i32, width as u32, height as u32, border as u32))
|
Some((x as i32, y as i32, width_out as u32, height_out as u32, border_out as u32))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue