-
-
Notifications
You must be signed in to change notification settings - Fork 40k
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 keycode parameter extraction to match the new DD keycodes #18977
Merged
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
Implement both encoding and decoding for keycodes like TO(layer) or LM(layer, mod) in one place, so that the decoding won't get out of sync with the encoding. While at it, fix some macros for creating keycode values that did not apply the appropriate masks to parameters (and therefore could allow the result to be out of range if a wrong parameter was passed).
(Also fix a minor bug - SH_TG was not handled properly)
(Technically the code is not 100% correct, because it always assumes that the LT() or MT() action was a tap, but it's a separate issue that already existed before the keycode changes.)
tzarc
approved these changes
Nov 6, 2022
zvecr
approved these changes
Nov 6, 2022
2 tasks
ramonimbao
pushed a commit
to ramonimbao/qmk_firmware
that referenced
this pull request
Nov 28, 2022
) * Add macros to extract parameters from keycode values Implement both encoding and decoding for keycodes like TO(layer) or LM(layer, mod) in one place, so that the decoding won't get out of sync with the encoding. While at it, fix some macros for creating keycode values that did not apply the appropriate masks to parameters (and therefore could allow the result to be out of range if a wrong parameter was passed). * keymap_common: Use extraction macros for keycodes * pointing_device_auto_mouse: Use extraction macros for keycodes Fixes qmk#18970. * process_autocorrect: Use extraction macros for keycodes * process_caps_word: Use extraction macros for keycodes (Also fix a minor bug - SH_TG was not handled properly) * process_leader: Use extraction macros for keycodes (Technically the code is not 100% correct, because it always assumes that the LT() or MT() action was a tap, but it's a separate issue that already existed before the keycode changes.) * process_unicode: Use extraction macros for keycodes * process_unicodemap: Use extraction macros for keycodes
elpekenin
pushed a commit
to elpekenin/qmk_firmware
that referenced
this pull request
Dec 7, 2022
) * Add macros to extract parameters from keycode values Implement both encoding and decoding for keycodes like TO(layer) or LM(layer, mod) in one place, so that the decoding won't get out of sync with the encoding. While at it, fix some macros for creating keycode values that did not apply the appropriate masks to parameters (and therefore could allow the result to be out of range if a wrong parameter was passed). * keymap_common: Use extraction macros for keycodes * pointing_device_auto_mouse: Use extraction macros for keycodes Fixes qmk#18970. * process_autocorrect: Use extraction macros for keycodes * process_caps_word: Use extraction macros for keycodes (Also fix a minor bug - SH_TG was not handled properly) * process_leader: Use extraction macros for keycodes (Technically the code is not 100% correct, because it always assumes that the LT() or MT() action was a tap, but it's a separate issue that already existed before the keycode changes.) * process_unicode: Use extraction macros for keycodes * process_unicodemap: Use extraction macros for keycodes
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.
Description
QMK has many keycodes with parameters, like
TO(layer)
orMT(mod, kc)
. Add macros for extracting the values of those parameters from the keycode, so that the bit allocation for those parameters can be performed in a single place where those macros are defined; then change various code that was extracting the parameters manually to use those macros.Macro names are based on the full
QK_xxx
range name; e.g., forMO(layer)
it isQK_MOMENTARY_GET_LAYER(kc)
.This change actually fixes several regressions introduced by DD keycode changes (mainly due to bit masks for layer-related keycodes no longer being correct).
Tested mostly by
make test:all
(which unfortunately does not cover much of the affected code); theTT()
bug was verified on some actual hardware. And probably not all problematic places have been found yet.Types of Changes
Issues Fixed or Closed by This PR
Checklist