Skip to content

Commit

Permalink
do not set hit test unconditionally on window creation (#7996)
Browse files Browse the repository at this point in the history
  • Loading branch information
mockersf authored Mar 13, 2023
1 parent 6bfc09f commit 71b1b35
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions crates/bevy_winit/src/winit_windows.rs
Original file line number Diff line number Diff line change
Expand Up @@ -166,11 +166,16 @@ impl WinitWindows {
}

winit_window.set_cursor_visible(window.cursor.visible);
if let Err(err) = winit_window.set_cursor_hittest(window.cursor.hit_test) {
warn!(
"Could not set cursor hit test for window {:?}: {:?}",
window.title, err
);

// Do not set the cursor hittest on window creation if it's false, as it will always fail on some
// platforms and log an unfixable warning.
if !window.cursor.hit_test {
if let Err(err) = winit_window.set_cursor_hittest(window.cursor.hit_test) {
warn!(
"Could not set cursor hit test for window {:?}: {:?}",
window.title, err
);
}
}

self.entity_to_winit.insert(entity, winit_window.id());
Expand Down

0 comments on commit 71b1b35

Please sign in to comment.