mirror of
https://github.com/openstenoproject/qmk
synced 2024-11-11 11:09:10 +00:00
parent
4e4250063e
commit
c2480884aa
1 changed files with 21 additions and 1 deletions
|
@ -53,6 +53,26 @@ void action_exec(keyevent_t event)
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Make sure the action triggered when the key is released is the same
|
||||||
|
* one as the one triggered on press. It's important for the mod keys
|
||||||
|
* when the layer is switched after the down event but before the up
|
||||||
|
* event as they may get stuck otherwise.
|
||||||
|
*/
|
||||||
|
action_t store_or_get_action(bool pressed, keypos_t key)
|
||||||
|
{
|
||||||
|
#ifndef NO_ACTION_LAYER
|
||||||
|
static action_t pressed_actions[MATRIX_ROWS][MATRIX_COLS];
|
||||||
|
|
||||||
|
if (pressed) {
|
||||||
|
pressed_actions[key.row][key.col] = layer_switch_get_action(key);
|
||||||
|
}
|
||||||
|
return pressed_actions[key.row][key.col];
|
||||||
|
#else
|
||||||
|
return layer_switch_get_action(key);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
void process_action(keyrecord_t *record)
|
void process_action(keyrecord_t *record)
|
||||||
{
|
{
|
||||||
keyevent_t event = record->event;
|
keyevent_t event = record->event;
|
||||||
|
@ -62,7 +82,7 @@ void process_action(keyrecord_t *record)
|
||||||
|
|
||||||
if (IS_NOEVENT(event)) { return; }
|
if (IS_NOEVENT(event)) { return; }
|
||||||
|
|
||||||
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);
|
dprint("ACTION: "); debug_action(action);
|
||||||
#ifndef NO_ACTION_LAYER
|
#ifndef NO_ACTION_LAYER
|
||||||
dprint(" layer_state: "); layer_debug();
|
dprint(" layer_state: "); layer_debug();
|
||||||
|
|
Loading…
Reference in a new issue