From 71b1b35757a01dbf59a122e2e8a7425a75c09a5d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois?= Date: Mon, 13 Mar 2023 16:31:13 +0100 Subject: [PATCH] do not set hit test unconditionally on window creation (#7996) --- 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());