Fix stale pressed state after focus changes

Release pressed input state whenever app or embedder focus changes so editor hover tooltips are not blocked by stale keyboard input while preserving the unfocused joypad behavior in Input.
This commit is contained in:
Infiland
2026-04-23 22:15:33 +02:00
parent ee713ccb7c
commit b08d13cc41
2 changed files with 5 additions and 6 deletions
+1 -3
View File
@@ -513,9 +513,7 @@ Error SceneDebugger::_msg_report_window_focused(const Array &p_args) {
bool focused = p_args[0];
Input::get_singleton()->embedder_focused = focused;
if (Input::get_singleton()->_should_ignore_joypad_events()) {
Input::get_singleton()->release_pressed_events();
}
Input::get_singleton()->release_pressed_events();
return OK;
}
+4 -3
View File
@@ -932,9 +932,10 @@ void SceneTree::_notification(int p_notification) {
if (Input::get_singleton()) {
Input::get_singleton()->application_focused = p_notification == NOTIFICATION_APPLICATION_FOCUS_IN;
if (Input::get_singleton()->_should_ignore_joypad_events()) {
Input::get_singleton()->release_pressed_events();
}
// `release_pressed_events()` already preserves joypad state when the
// unfocused joypad setting is disabled, but keyboard state still needs
// to be released after focus loss.
Input::get_singleton()->release_pressed_events();
}
// Pass these to nodes, since they are mirrored.