浏览代码

Expose the pressed_actions_cache global variable

Wojciech Siewierski 9 年之前
父节点
当前提交
a5cdc3aab1
共有 2 个文件被更改,包括 4 次插入4 次删除
  1. 3 4
      tmk_core/common/action.c
  2. 1 0
      tmk_core/common/action.h

+ 3 - 4
tmk_core/common/action.c

@@ -55,6 +55,7 @@ void action_exec(keyevent_t event)
 
 #if !defined(NO_ACTION_LAYER) && defined(PREVENT_STUCK_MODIFIERS)
 bool disable_action_cache = false;
+action_t pressed_actions_cache[MATRIX_ROWS][MATRIX_COLS];
 
 void process_action_nocache(keyrecord_t *record)
 {
@@ -78,16 +79,14 @@ void process_action_nocache(keyrecord_t *record)
 action_t store_or_get_action(bool pressed, keypos_t key)
 {
 #if !defined(NO_ACTION_LAYER) && defined(PREVENT_STUCK_MODIFIERS)
-    static action_t pressed_actions[MATRIX_ROWS][MATRIX_COLS];
-
     if (disable_action_cache) {
         return layer_switch_get_action(key);
     }
 
     if (pressed) {
-        pressed_actions[key.row][key.col] = layer_switch_get_action(key);
+        pressed_actions_cache[key.row][key.col] = layer_switch_get_action(key);
     }
-    return pressed_actions[key.row][key.col];
+    return pressed_actions_cache[key.row][key.col];
 #else
     return layer_switch_get_action(key);
 #endif

+ 1 - 0
tmk_core/common/action.h

@@ -61,6 +61,7 @@ void action_function(keyrecord_t *record, uint8_t id, uint8_t opt);
 /* Utilities for actions.  */
 #if !defined(NO_ACTION_LAYER) && defined(PREVENT_STUCK_MODIFIERS)
 extern bool disable_action_cache;
+extern action_t pressed_actions_cache[MATRIX_ROWS][MATRIX_COLS];
 #endif
 void process_action_nocache(keyrecord_t *record);
 void process_action(keyrecord_t *record);