qmk/qmk_firmware

[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.

Open

#13.732 geöffnet am 27. Juli 2021

Auf GitHub ansehen
 (0 Kommentare) (0 Reaktionen) (0 zugewiesene Personen)C (43.867 Forks)batch import
bughelp wanted

Repository-Metriken

Stars
 (20.368 Stars)
PR-Merge-Metriken
 (Durchschn. Merge 20T 9h) (27 gemergte PRs in 30 T)

Beschreibung

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:

Additional Context

Contributor Guide