Skip to content

Commit

Permalink
cargo fmt
Browse files Browse the repository at this point in the history
  • Loading branch information
wtholliday committed May 9, 2023
1 parent 446bfaa commit 55a8506
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions src/winit_event_loop.rs
Original file line number Diff line number Diff line change
Expand Up @@ -118,15 +118,18 @@ 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::Locked)
.or_else(|_e| window.set_cursor_grab(winit::window::CursorGrabMode::Confined))
.unwrap();
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);
}

if !cx.grab_cursor && cx.prev_grab_cursor {
println!("releasing cursor");
window.set_cursor_grab(winit::window::CursorGrabMode::None).unwrap();
window
.set_cursor_grab(winit::window::CursorGrabMode::None)
.unwrap();
window.set_cursor_visible(true);
}

Expand Down

0 comments on commit 55a8506

Please sign in to comment.