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

Allow keybindings with modifiers #14874

Open
wants to merge 13 commits into
base: master
Choose a base branch
from
Open

Conversation

y5nw
Copy link
Contributor

@y5nw y5nw commented Jul 20, 2024

  • Goal of the PR
    This PR allows users to create keybindings with modifier keys, such as Control-F10 or Shift-5.
  • How does the PR work?
    This PR extends the KeyPress class to include information on the state of modifier keys.
  • Does it resolve any reported issue?
    No.
  • Does this relate to a goal in the roadmap?
    No
  • If not a bug fix, why is this PR needed? What usecases does it solve?
    This provides a partial workaround for SDL: Some keybinds broken due to missing character lookup #14545 by allowing users to use e.g. Shift-7 instead of / for keybindings. Some people may want to continue using e.g. Shift-7, which will no longer be possible with SDL: Use scancodes for keybindings #14964.

Notes

  • This PR now treats Left Shift and Right Shift as the same key.
  • This PR removes the incompatible feature where Shift+key binds to the "character" rather than the keycode. However, my testing shows that this removed feature did not fully work anyway.

To do

This PR is a Draft.

  • Allow keybindings with modifiers in the "Change keys" form.
  • Adapt input handler to handle such keybindings.
  • "Resolve" keybindings to perform action(s) with the closest keybinding.
  • Update GUI
  • Fix bugs/regressions
    • Cannot bind an action to the Shift or Control key.
    • Cannot stop sneaking after pressing Shift once.
    • Cannot quit keybinding form with Esc after binding a key to Shift or Ctrl
    • Cannot perform action bound to a normal key when Shift-(key) or Ctrl-(key) is pressed.
    • Chat key does not work when bound to Modifier+Autoforward.
  • Add tests
    • KeyPress
    • KeyList
    • MyEventReceiver (src/client/inputhandler.h)

How to test

  • The testcases are complemented to reflect the changes made in this PR.
  • The above section includes a list of bugs/regressions that occurred during the development of the PR. These should not be reproducible.

@Zughy Zughy added the Bugfix 🐛 PRs that fix a bug label Jul 21, 2024
@y5nw y5nw marked this pull request as ready for review July 27, 2024 01:38
@Desour Desour added the Feature ✨ PRs that add or enhance a feature label Jul 27, 2024
@y5nw y5nw mentioned this pull request Sep 2, 2024
11 tasks
@y5nw y5nw mentioned this pull request Sep 12, 2024
8 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bugfix 🐛 PRs that fix a bug @ Client / Controls / Input Feature ✨ PRs that add or enhance a feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants