From 815ed4c24422713164b30ea158869b047a330f55 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois?= Date: Thu, 9 Mar 2023 09:23:59 +0100 Subject: [PATCH] do not set hit test unconditionally on window creation --- crates/bevy_winit/src/winit_windows.rs | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/crates/bevy_winit/src/winit_windows.rs b/crates/bevy_winit/src/winit_windows.rs index 33441333b9302..b87678acd3d8d 100644 --- a/crates/bevy_winit/src/winit_windows.rs +++ b/crates/bevy_winit/src/winit_windows.rs @@ -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());