Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support other input methods on Popup/Dialogs' _input_from_window #80594

Merged
merged 1 commit into from
Aug 14, 2023

Conversation

rsubtil
Copy link
Contributor

@rsubtil rsubtil commented Aug 13, 2023

The Popup/Dialog's _input_from_window callback was only listening for keyboard events. Therefore, other input methods (like game controllers) couldn't be used, notably for closing windows.

Fixes #80425

@rsubtil rsubtil requested a review from a team as a code owner August 13, 2023 16:48
@AThousandShips AThousandShips added this to the 4.2 milestone Aug 13, 2023
Copy link
Contributor

@Sauermann Sauermann left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If there isn't any conceptual reason for requiring a keyboard for the "ui_cancel"-action, then I find this implementation fitting.

@rsubtil
Copy link
Contributor Author

rsubtil commented Aug 13, 2023

If there isn't any conceptual reason for requiring a keyboard for the "ui_cancel"-action, then I find this implementation fitting.

This looks like a remnant of old code, ever since the Window refactoring:

void Popup::_input_from_window(const Ref<InputEvent> &p_event) {
Ref<InputEventKey> key = p_event;
if (key.is_valid() && key->is_pressed() && key->get_keycode() == KEY_ESCAPE) {
_close_pressed();
}
}

This used to be hardcoded to the Escape key, and then recently changed to use the ui_cancel with #77297

@akien-mga akien-mga merged commit 0308422 into godotengine:master Aug 14, 2023
@akien-mga
Copy link
Member

Thanks!

@rsubtil rsubtil deleted the fix_window_input_event branch August 14, 2023 07:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

OptionButton menu not closable with joypad
4 participants