aboutsummaryrefslogtreecommitdiff
path: root/tmk_core/common/action.c
diff options
context:
space:
mode:
authorWojciech Siewierski <wojciech.siewierski@onet.pl>2016-03-13 00:18:20 +0100
committerWojciech Siewierski <wojciech.siewierski@onet.pl>2016-03-13 00:18:20 +0100
commit20dd9c032616722a54174d53b0f8824f639b5263 (patch)
tree768efa3a7ca873d25596afcf015fa6cd9ec113ed /tmk_core/common/action.c
parent8d55a12a9538742f510087f14fc59eb813b2ef42 (diff)
downloadqmk_firmware-20dd9c032616722a54174d53b0f8824f639b5263.tar.gz
qmk_firmware-20dd9c032616722a54174d53b0f8824f639b5263.zip
process_action may be called either with key cache or without it
If one wants to temporarily disable the key cache (for example because it interferes with a macro), `disable_action_cache` must be set to `true`. `process_action_nocache` is a simple wrapper doing just that for a single call.
Diffstat (limited to 'tmk_core/common/action.c')
-rw-r--r--tmk_core/common/action.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/tmk_core/common/action.c b/tmk_core/common/action.c
index 26a5fad7a..1d3b73811 100644
--- a/tmk_core/common/action.c
+++ b/tmk_core/common/action.c
@@ -53,6 +53,17 @@ void action_exec(keyevent_t event)
53#endif 53#endif
54} 54}
55 55
56#if !defined(NO_ACTION_LAYER) && defined(PREVENT_STUCK_MODIFIERS)
57bool disable_action_cache = false;
58
59void process_action_nocache(keyrecord_t *record)
60{
61 disable_action_cache = true;
62 process_action(record);
63 disable_action_cache = false;
64}
65#endif
66
56/* 67/*
57 * Make sure the action triggered when the key is released is the same 68 * Make sure the action triggered when the key is released is the same
58 * one as the one triggered on press. It's important for the mod keys 69 * one as the one triggered on press. It's important for the mod keys
@@ -64,6 +75,10 @@ action_t store_or_get_action(bool pressed, keypos_t key)
64#if !defined(NO_ACTION_LAYER) && defined(PREVENT_STUCK_MODIFIERS) 75#if !defined(NO_ACTION_LAYER) && defined(PREVENT_STUCK_MODIFIERS)
65 static action_t pressed_actions[MATRIX_ROWS][MATRIX_COLS]; 76 static action_t pressed_actions[MATRIX_ROWS][MATRIX_COLS];
66 77
78 if (disable_action_cache) {
79 return layer_switch_get_action(key);
80 }
81
67 if (pressed) { 82 if (pressed) {
68 pressed_actions[key.row][key.col] = layer_switch_get_action(key); 83 pressed_actions[key.row][key.col] = layer_switch_get_action(key);
69 } 84 }