[Bug] When a key is pressed and held while a oneshot layer is active, the keyup event is triggered for the key when the oneshot layer exits even if the key is still held down.
#13,732 opened on 2021年7月27日
Repository metrics
- Stars
- (20,368 stars)
- PR merge metrics
- (平均マージ 20d 9h) (30d で 27 merged PRs)
説明
Describe the Bug
Whenever a key is pressed and held while a oneshot layer is active, QMK will register a keyup for the held-down key immediately after the oneshot layer exits, even if that key is still held down. When the key is physically released, a second keyup is registered.
The result of this is that modifiers that are pressed and held while a oneshot layer is active are immediately released as the oneshot layer deactivates.
I've determined this by using a few print statements in process_record_user() and oneshot_layer_changed_user().
A was able to reproduce the issue on a fresh clone of this repository on both an ergodox_ez and a planck rev6 on the default layouts for those keyboards.
To reproduce the issue, change any of the layer toggles to OSL(layer). The following are what I used to provide the debugging output to confirm that process_record_user reports that a key is released immediately after a OSL exits, even if that key is still physically depressed.
void oneshot_layer_changed_user(uint8_t layer) {
if (layer == _LOWER) {
print("Oneshot Layer LOWER active\n");
} else if (layer == _RAISE) {
print("Oneshot Layer RAISE active\n");
} else if (!layer) {
print("Oneshot layer off\n");
}
}
bool process_record_user(uint16_t keycode, keyrecord_t *record) {
if (keycode == 21507) {
if (record->event.pressed) {
printf("Depressed Layer Key\n");
} else {
printf("Released Layer Key\n");
}
} else if (keycode == 21761) {
if (record->event.pressed) {
printf("Depressed OSM CTRL Key\n");
} else {
printf("Released OSM CTRL Key\n");
}
} else {
if (record->event.pressed) {
printf("Depressed Keycode %d\n", keycode);
} else {
printf("Released Keycode %d\n", keycode);
}
}
System Information
- Keyboard: planck
- Revision (if applicable): rev 6
- Operating system: Arch Linux
- AVR GCC version: 11.1.0
- ARM GCC version: 11.1.0
- QMK Firmware version: 0.13.26
- Any keyboard related software installed?
- AutoHotKey
- Karabiner
- Other: