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:
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
@@ -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.
|
||||
|
||||
Reference in New Issue
Block a user