diff options
author | Stephan Bösebeck <sb@caluga.de> | 2016-04-06 22:52:49 +0200 |
---|---|---|
committer | Stephan Bösebeck <sb@caluga.de> | 2016-04-06 22:52:49 +0200 |
commit | 0befb25739ebcec64a3300d60d7c108f6916dee7 (patch) | |
tree | 222fd634cf50c584ceb7925bb8e61a9f266830de /tmk_core/common/action.c | |
parent | 75c24499f3fcb4ad2156875fb529f87a5d99fe9f (diff) | |
parent | 153a6fb0d3e9b54c4d6241c44ffdb9ce8a65de7f (diff) | |
download | qmk_firmware-0befb25739ebcec64a3300d60d7c108f6916dee7.tar.gz qmk_firmware-0befb25739ebcec64a3300d60d7c108f6916dee7.tar.xz |
Merge branch 'master' of https://github.com/jackhumbert/qmk_firmware
Diffstat (limited to 'tmk_core/common/action.c')
-rw-r--r-- | tmk_core/common/action.c | 32 |
1 files changed, 29 insertions, 3 deletions
diff --git a/tmk_core/common/action.c b/tmk_core/common/action.c index 2ccc0e0b9..f9e6c17dc 100644 --- a/tmk_core/common/action.c +++ b/tmk_core/common/action.c @@ -53,6 +53,22 @@ void action_exec(keyevent_t event) #endif } +#if !defined(NO_ACTION_LAYER) && defined(PREVENT_STUCK_MODIFIERS) +bool disable_action_cache = false; + +void process_action_nocache(keyrecord_t *record) +{ + disable_action_cache = true; + process_action(record); + disable_action_cache = false; +} +#else +void process_action_nocache(keyrecord_t *record) +{ + process_action(record); +} +#endif + __attribute__ ((weak)) void process_action_kb(keyrecord_t *record) {} @@ -67,7 +83,7 @@ void process_action(keyrecord_t *record) process_action_kb(record); - action_t action = layer_switch_get_action(event.key); + action_t action = store_or_get_action(event.pressed, event.key); dprint("ACTION: "); debug_action(action); #ifndef NO_ACTION_LAYER dprint(" layer_state: "); layer_debug(); @@ -88,14 +104,24 @@ void process_action(keyrecord_t *record) action.key.mods<<4; if (event.pressed) { if (mods) { - add_weak_mods(mods); + if (IS_MOD(action.key.code)) { + // e.g. LSFT(KC_LGUI): we don't want the LSFT to be weak as it would make it useless. + // this also makes LSFT(KC_LGUI) behave exactly the same as LGUI(KC_LSFT) + add_mods(mods); + } else { + add_weak_mods(mods); + } send_keyboard_report(); } register_code(action.key.code); } else { unregister_code(action.key.code); if (mods) { - del_weak_mods(mods); + if (IS_MOD(action.key.code)) { + del_mods(mods); + } else { + del_weak_mods(mods); + } send_keyboard_report(); } } |