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

Fix action exact match (Also fixes ui_ focus keys) #54173

Merged
merged 1 commit into from
Jan 26, 2022

Conversation

nathanfranke
Copy link
Contributor

@nathanfranke nathanfranke commented Oct 24, 2021

Fixes #54602
Fixes #55622
Supersedes #54842

3.x version: #54174

Previously, event.is_action_pressed("test", false, true) always returned false, while event.is_action_released("test", false, true) returned true both for pressed and released. This is because the pressed pointer was not passed into is_match. This PR fixes it by using action_match instead.

MRP: Test10.zip

core/input/input_event.h Outdated Show resolved Hide resolved
@nathanfranke nathanfranke force-pushed the fix-exact-match branch 2 times, most recently from 1939a23 to d880c6e Compare December 4, 2021 22:11
@nathanfranke nathanfranke changed the title Fix action exact match Fix action exact match (Also fixes ui_ focus keys) Dec 4, 2021
@nathanfranke nathanfranke force-pushed the fix-exact-match branch 2 times, most recently from cffdf79 to ab489b3 Compare December 9, 2021 07:43
@akien-mga akien-mga requested a review from a team January 12, 2022 14:13
core/input/input_map.h Outdated Show resolved Hide resolved
core/input/input_event.h Outdated Show resolved Hide resolved
@nathanfranke
Copy link
Contributor Author

Thanks for reviewing, sorry for missing those extra consts so many times now! Should be ready now.

Copy link
Member

@bruvzg bruvzg left a comment

Choose a reason for hiding this comment

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

Haven't checked it in deep, but all changes seems reasonable, and it fixes keyboard navigation.

Comment on lines +896 to +900
// Matches even if not in the same direction, but returns a "not pressed" event.
bool match = axis == jm->axis;
if (p_exact_match) {
match &= (axis_value < 0) == (jm->axis_value < 0);
}
Copy link
Member

Choose a reason for hiding this comment

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

I'm a bit concerned about the potential impact of this change on joypad motion events.

I guess let's merge and assess while testing whether this is working as expected.

@akien-mga akien-mga merged commit d74d4cb into godotengine:master Jan 26, 2022
@akien-mga
Copy link
Member

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
5 participants