-
Notifications
You must be signed in to change notification settings - Fork 51
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
Wrong keycode with Custom Shift Keys Feature #5
Comments
oh nevermind. it looks like b102238 fixes this with del_weak_mods() |
double nevermind, it looks like I'm still having the same issue unless i use use unregister_mods() so i re-opened the issue. sorry about the confusion. |
Thanks for the report and suggested fix! What kind of shift keys are observing this with? is it the plain |
of course. i'm not sure if i understand the question, but whether i hold the left shift or right shift and press comma I get colon instead of semi-colon. my repo is qmk fork if it helps. if i recall i remember i encountered this same issue in qmk's custom keys feature so maybe I'm missing some detail. |
#5 reports that the shift mod is not correctly cleared, e.g. for the custom shift key `{KC_COMM, KC_SCLN}`, a `:` is typed instead of `;`. To test a plausible fix, this commit adds a `send_keyboard_report()` call between removing the shift mods and registering the keycode.
Thanks for sharing your keymap. It's awesome to see all the custom code you have in there, I'll be studying this. About my earlier question, I was thinking your shift keys could be one-shot mods or something like that with special handling, vs. the plain I see your keymap can apply shifts in several ways, including through a userspace implementation of one-shot mods (
Thanks again for the suggestion. I looked further into this. When a custom shift key is pressed with a shift mod active, the current code does del_mods(MOD_MASK_SHIFT);
del_weak_mods(MOD_MASK_SHIFT);
register_code16(registered_keycode); Under the hood, void unregister_mods(uint8_t mods) {
if (mods) {
del_mods(mods);
send_keyboard_report();
}
} This function is simply I suggest we test that. I just pushed a commit df11113 to add a If it's possible, it would also help if you could test your keymap with other shift-handling features disabled, like the userspace oneshot and magic_shift. That might narrow down this bug to some edge-case interaction between our custom codes. |
This commit changes uses of `add_weak_mods()` to `register_weak_mods()` so that a keyboard report is sent after setting the shift mod but before registering the current key press. This appears to fix a bug on Mac OS, where Caps Word does not shift the keys. This seems to be essentially the same bug reported in #5 about weak mod use in custom_shift_keys. Thank you, @wheredoesyourmindgo and u/uolot for reporting and help fixing these bugs!
An update: I just got a similar bug report from reddit user u/uolot about weak mods in Caps Word. Interestingly, the bug there was also happening on Mac OS and fixed when adding a send_keyboard_report() call after setting mods and before registering the next key. This fits with what I was thinking: adding this send_keyboard_report() call sequences the shift release vs. next key, so that the OS knows not to shift that key. Otherwise, without this send_keyboard_report(), maybe it is OS dependent how exactly it treats the next key event. Maybe that explains how I haven't run into this problem on Linux. Thank you both for reporting and help fixing it! It sounds like we have solved both bugs, but please reopen if there are still problems. |
* This seems to be ok. * add the planck. * prepare for something else.
I'm getting the incorrect keycode when I use the custom shift keys feature with keycodes that don't require a shift press, ex. comma and opening arrow bracket --> comma and semi-colon. The shifted code is always being returned, in my example, the colon is firing instead of the semi-colon. My workaround is to use unregister_mods() over del_mods(). Does that seem like the proper fix?
qmk-keymap/features/custom_shift_keys.c
Line 43 in 90267e0
The text was updated successfully, but these errors were encountered: