mirror of
https://github.com/italicsjenga/winit-sonoma-fix.git
synced 2024-12-25 23:01:30 +11:00
Fix wrong grabbing rect
This commit is contained in:
parent
bae1e42b8b
commit
9bef21048e
|
@ -292,9 +292,11 @@ impl Window {
|
||||||
unsafe {
|
unsafe {
|
||||||
user32::SetCursor(ptr::null_mut());
|
user32::SetCursor(ptr::null_mut());
|
||||||
let mut rect = mem::uninitialized();
|
let mut rect = mem::uninitialized();
|
||||||
if user32::GetWindowRect(self.window.0, &mut rect) == 0 {
|
if user32::GetClientRect(self.window.0, &mut rect) == 0 {
|
||||||
return Err(format!("GetWindowRect failed"));
|
return Err(format!("GetWindowRect failed"));
|
||||||
}
|
}
|
||||||
|
user32::ClientToScreen(self.window.0, mem::transmute(&mut rect.left));
|
||||||
|
user32::ClientToScreen(self.window.0, mem::transmute(&mut rect.right));
|
||||||
if user32::ClipCursor(&rect) == 0 {
|
if user32::ClipCursor(&rect) == 0 {
|
||||||
return Err(format!("ClipCursor failed"));
|
return Err(format!("ClipCursor failed"));
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue