Prefer locking the cursor when grabbing it (if that option is supported)

over just confining it to the window.

This prevents the cursor from moving around when controlling the camera.
This commit is contained in:
Imbris 2023-09-10 16:51:31 -04:00
parent a07ec63a53
commit 34ee35c524

View File

@ -1034,8 +1034,8 @@ impl Window {
self.window.set_cursor_visible(!grab);
let res = if grab {
self.window
.set_cursor_grab(CursorGrabMode::Confined)
.or_else(|_e| self.window.set_cursor_grab(CursorGrabMode::Locked))
.set_cursor_grab(CursorGrabMode::Locked)
.or_else(|_e| self.window.set_cursor_grab(CursorGrabMode::Confined))
} else {
self.window.set_cursor_grab(CursorGrabMode::None)
};