mirror of
https://github.com/qmk/qmk_firmware.git
synced 2024-11-29 22:45:51 +00:00
cbabc8dbe6
* Replace Tapping Force Hold feature with Quick Tap Term * Replace keyboard level TAPPING_FORCE_HOLD with QUICK_TAP_TERM 0 * Deprecate force hold in info_config.json * Before and after quick tap term unit tests * Quick tap unit tests iteration * Keymap config.h correction * Remove TAPPING_FORCE_HOLD_PER_KEY macros that were missed * Add two more test cases for quick tap * Replace TAPPING_FORCE_HOLD with QUICK_TAP_TERM in configs #2 * Replace TAPPING_FORCE_HOLD_PER_KEY with QUICK_TAP_TERM_PER_KEY in configs #2 * Add function declaration for get_quick_tap_term Co-authored-by: Stefan Kerkmann <karlk90@pm.me>
58 lines
1.5 KiB
C
58 lines
1.5 KiB
C
#include "quantum.h"
|
|
#include "dshields.h"
|
|
|
|
bool process_record_user(uint16_t keycode, keyrecord_t *record) {
|
|
if ((keycode >= QK_MOD_TAP && keycode <= QK_MOD_TAP_MAX)
|
|
|| (keycode >= QK_LAYER_TAP && keycode <= QK_LAYER_TAP_MAX)
|
|
|| (keycode >= QK_MODS && keycode <= QK_MODS_MAX)) {
|
|
keycode = keycode & 0xFF;
|
|
}
|
|
if (keycode == KC_ESC && record->event.pressed) {
|
|
bool rc = true;
|
|
uint8_t mods = 0;
|
|
if ((mods = get_oneshot_mods()) && !has_oneshot_mods_timed_out()) {
|
|
clear_oneshot_mods();
|
|
unregister_mods(mods);
|
|
rc = false;
|
|
}
|
|
if ((mods = get_oneshot_locked_mods())) {
|
|
clear_oneshot_locked_mods();
|
|
unregister_mods(mods);
|
|
rc = false;
|
|
}
|
|
if (is_oneshot_layer_active()) {
|
|
layer_clear();
|
|
rc = false;
|
|
}
|
|
return rc;
|
|
}
|
|
return true;
|
|
}
|
|
|
|
uint16_t get_quick_tap_term(uint16_t keycode, keyrecord_t *record) {
|
|
switch (keycode) {
|
|
case MT_A:
|
|
case MT_S:
|
|
case MT_D:
|
|
case MT_F:
|
|
case MT_J:
|
|
case MT_K:
|
|
case MT_L:
|
|
case MT_SCLN:
|
|
return 0;
|
|
default:
|
|
return QUICK_TAP_TERM;
|
|
}
|
|
}
|
|
|
|
bool get_permissive_hold(uint16_t keycode, keyrecord_t *record) {
|
|
switch (keycode) {
|
|
case MT_SPC:
|
|
case MT_BSPC:
|
|
case MT_ESC:
|
|
return true;
|
|
default:
|
|
return false;
|
|
}
|
|
}
|