Skip to content

Commit

Permalink
Lock cursor.
Browse files Browse the repository at this point in the history
I guess this won't work on X11 but who cares.
  • Loading branch information
wtholliday committed May 9, 2023
1 parent 3ffbf67 commit 446bfaa
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/winit_event_loop.rs
Original file line number Diff line number Diff line change
Expand Up @@ -118,8 +118,8 @@ fn process_event(cx: &mut Context, view: &impl View, event: &Event, window: &Win

if cx.grab_cursor && !cx.prev_grab_cursor {
println!("grabbing cursor");
window.set_cursor_grab(winit::window::CursorGrabMode::Confined)
.or_else(|_e| window.set_cursor_grab(winit::window::CursorGrabMode::Locked))
window.set_cursor_grab(winit::window::CursorGrabMode::Locked)
.or_else(|_e| window.set_cursor_grab(winit::window::CursorGrabMode::Confined))
.unwrap();
window.set_cursor_visible(false);
}
Expand Down

0 comments on commit 446bfaa

Please sign in to comment.