Backends: Allegro: Don't call AddInputCharacter if the pressed key has no character.#3252
Merged
ocornut merged 1 commit intoocornut:masterfrom May 20, 2020
Espyo:allegro5_question_mark_fix
Merged
Backends: Allegro: Don't call AddInputCharacter if the pressed key has no character.#3252ocornut merged 1 commit intoocornut:masterfrom Espyo:allegro5_question_mark_fix
ocornut merged 1 commit intoocornut:masterfrom
Espyo:allegro5_question_mark_fix
Conversation
Contributor
Espyo
commented
May 20, 2020
- Commit ef13d95 moved the logic of checking for invalid Unicode codes from each backend to Dear ImGui's AddInputCharacter function proper.
- Commit c8ea0a0 then removed that logic, replacing it with something that inserts a question mark-like character in the case of an invalid Unicode code.
- As a result, after these two commits, if an Allegro keypress has no associated character (arrow keys, End, Page Up, etc.), it will send zero with nobody to filter it out.
- With this fix, no-character inputs won't even call AddInputCharacter to begin with.
- Tested with arrow keys, Page Up, etc., tested with regular character keys, and tested with some Unicode symbols directly from the keyboard, like €.
…s no character. - Commit ef13d95 moved the logic of checking for invalid Unicode codes from each backend to Dear ImGui's AddInputCharacter function proper. - Commit c8ea0a0 then removed that logic, replacing it with something that inserts a question mark-like character in the case of an invalid Unicode code. - As a result, after these two commits, if an Allegro keypress has no associated character (arrow keys, End, Page Up, etc.), it will send zero with nobody to filter it out. - With this fix, no-character inputs won't even call AddInputCharacter to begin with. - Tested with arrow keys, Page Up, etc., tested with regular character keys, and tested with some Unicode symbols directly from the keyboard, like €.
Owner
|
Thanks @Espyo for the thoughtful commit and explanation. Looking at c8ea0a0 again, I feel like we should add a != 0 test in the lower-level functions I don't mind also leaving the if != 0 in Allegro back-end because that event can query both types of data. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.