Skip to content

Commit

Permalink
fix cursor grab issue
Browse files Browse the repository at this point in the history
  • Loading branch information
VitalyAnkh committed Dec 23, 2022
1 parent 1aeaafa commit b11cc85
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
4 changes: 2 additions & 2 deletions crates/bevy_winit/src/winit_windows.rs
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,8 @@ impl WinitWindows {
}
}

winit_window.set_cursor_visible(window_descriptor.cursor_visible);

// Do not set the grab mode on window creation if it's none, this can fail on mobile
if window_descriptor.cursor_grab_mode != CursorGrabMode::None {
match winit_window
Expand All @@ -175,8 +177,6 @@ impl WinitWindows {
}
}

winit_window.set_cursor_visible(window_descriptor.cursor_visible);

self.window_id_to_winit.insert(window_id, winit_window.id());
self.winit_to_window_id.insert(winit_window.id(), window_id);

Expand Down
1 change: 1 addition & 0 deletions examples/window/window_settings.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ fn main() {
height: 300.,
present_mode: PresentMode::AutoVsync,
always_on_top: true,
cursor_grab_mode: CursorGrabMode::Confined,
..default()
},
..default()
Expand Down

0 comments on commit b11cc85

Please sign in to comment.