-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
Refactor input handler #15933
Merged
Merged
Refactor input handler #15933
+168
−254
Conversation
This file contains 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
sfan5
reviewed
Mar 26, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(code review only)
Co-authored-by: sfan5 <[email protected]>
Co-authored-by: sfan5 <[email protected]>
sfan5
approved these changes
Mar 28, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
seems to work
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
@ Client / Controls / Input
Maintenance
Tasks to keep the codebase and related parts in order, including architectural improvements
One approval ✅ ◻️
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.
Mostly preparations for allowing more complex keyboard-related features (e.g. secondary keybindings); largely based on #15918 (which turned out to be useful after all after some more changes). The main changes (later ones can be dropped if we want to put them into later PRs that actually need the commits):
Implement
operator<
(for e.g.std::set
) andstd::hash
(forstd::unordered_map
) forKeyPress
.KeyList
is dropped accordingly.The event receiver now stores keypress information into a bitset indexed using
GameKeyType
. This architecture is useful as it avoids future headaches around e.g.wasKeyDown
.We continue to keep track of physical keys. This is useful for e.g. secondary keybindings, where (with the above change) we want to make sure that other keybindings are also unset before releasing a
GameKeyType
key (physical keys are still marked as relased when they are released, of course).KeyCache
is dropped and integrated into the event receiver, as the changes around the event receiver makes it no longer necessary for the input handler to hold information on keybindings, while it can become useful in the future for the event receiver to quickly look up keypresses (see above point for example).Does it resolve any reported issue?
No.
Does this relate to a goal in the roadmap?
The first two commits qualify for 2.2 Internal code refactoring. Other the entire PR also eases development for future feature PRs.
To do
This PR is Ready for Review.
How to test
Check that keyboard input still works.