Skip to content

Commit f1eb52c

Browse files
committed
fix osx build
1 parent dee37d6 commit f1eb52c

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/main.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
windows_subsystem = "windows"
44
)]
55
use state::State;
6+
use std::io::Cursor;
67
use std::sync::{Arc, Mutex};
78
use std::time::Instant;
89
use winit::dpi::LogicalSize;
@@ -47,7 +48,10 @@ async fn run(event_loop: EventLoop<()>, window: Window) {
4748
size.width = size.width.max(1);
4849
size.height = size.height.max(1);
4950

50-
window.set_cursor_grab(CursorGrabMode::Confined).unwrap();
51+
window
52+
.set_cursor_grab(CursorGrabMode::Confined)
53+
.or_else(|_| window.set_cursor_grab(CursorGrabMode::Locked))
54+
.unwrap();
5155
window.set_cursor_visible(false);
5256
let window = Arc::new(Mutex::new(window));
5357
let mut state = State::new(window.clone()).await;

0 commit comments

Comments
 (0)