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

core: Always fire KeyPress after KeyDown for buttons #16245

Merged
merged 3 commits into from May 9, 2024

Conversation

kjarosh
Copy link
Contributor

@kjarosh kjarosh commented May 7, 2024

Just fixing a bug I found when writing some tests.

Button events are actually handled twofold:

  1. KeyPress for printable characters is handled on TextInput,
  2. KeyPress for special characters (e.g. enter, arrows) is handled on KeyDown.

Before this patch, KeyPress was fired too early, so that for special characters (2) it fired BEFORE KeyDown. This was not a problem for printable characters, as they fired on TextInput, which always fired separately after KeyDown.

This patch ensures that KeyPress is fired always in the proper order.

Additionally I added a test that verifies the "KeyPress events take precedence over text input" behavior, because it was not covered by tests before.

@kjarosh kjarosh force-pushed the button-events-order branch 2 times, most recently from 1e33e7e to d495724 Compare May 7, 2024 22:20
This test ensures that button key press events take precedence
over text input.
Button events are actually handled twofold:
1. KeyPress for printable characters is handled on TextInput,
2. KeyPress for special characters (e.g. enter, arrows)
   is handled on KeyDown.

Before this patch, KeyPress was fired too early, so that for
special characters (2) it fired BEFORE KeyDown.
This was not a problem for printable characters, as they
fired on TextInput, which always fired separately after KeyDown.

This patch ensures that KeyPress is fired always in the proper order.
This test verifies the behavior of button events when
special characters are pressed.
@Dinnerbone Dinnerbone enabled auto-merge (rebase) May 9, 2024 18:58
@Dinnerbone Dinnerbone merged commit ea3ac09 into ruffle-rs:master May 9, 2024
17 checks passed
@kjarosh kjarosh deleted the button-events-order branch May 9, 2024 19:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants