diff options
Diffstat (limited to 'common/action.c')
| -rw-r--r-- | common/action.c | 19 |
1 files changed, 16 insertions, 3 deletions
diff --git a/common/action.c b/common/action.c index aadf5e16e..710300eb3 100644 --- a/common/action.c +++ b/common/action.c | |||
| @@ -201,6 +201,19 @@ void action_exec(keyevent_t event) | |||
| 201 | } | 201 | } |
| 202 | } | 202 | } |
| 203 | 203 | ||
| 204 | static action_t get_action(key_t key) | ||
| 205 | { | ||
| 206 | action_t action = keymap_get_action(current_layer, key.pos.row, key.pos.col); | ||
| 207 | |||
| 208 | /* Transparently use default layer */ | ||
| 209 | if (action.code == ACTION_TRANSPARENT) { | ||
| 210 | // TODO: layer stacking | ||
| 211 | action = keymap_get_action(default_layer, key.pos.row, key.pos.col); | ||
| 212 | debug("TRNASPARENT: "); debug_hex16(action.code); debug("\n"); | ||
| 213 | } | ||
| 214 | return action; | ||
| 215 | } | ||
| 216 | |||
| 204 | static void process_action(keyrecord_t *record) | 217 | static void process_action(keyrecord_t *record) |
| 205 | { | 218 | { |
| 206 | keyevent_t event = record->event; | 219 | keyevent_t event = record->event; |
| @@ -208,8 +221,7 @@ static void process_action(keyrecord_t *record) | |||
| 208 | 221 | ||
| 209 | if (IS_NOEVENT(event)) { return; } | 222 | if (IS_NOEVENT(event)) { return; } |
| 210 | 223 | ||
| 211 | action_t action = keymap_get_action(current_layer, event.key.pos.row, event.key.pos.col); | 224 | action_t action = get_action(event.key); |
| 212 | //debug("action: "); debug_hex16(action.code); if (event.pressed) debug("d\n"); else debug("u\n"); | ||
| 213 | debug("ACTION: "); debug_action(action); debug("\n"); | 225 | debug("ACTION: "); debug_action(action); debug("\n"); |
| 214 | 226 | ||
| 215 | switch (action.kind.id) { | 227 | switch (action.kind.id) { |
| @@ -809,7 +821,8 @@ void layer_switch(uint8_t new_layer) | |||
| 809 | 821 | ||
| 810 | bool is_tap_key(key_t key) | 822 | bool is_tap_key(key_t key) |
| 811 | { | 823 | { |
| 812 | action_t action = keymap_get_action(current_layer, key.pos.row, key.pos.col); | 824 | action_t action = get_action(key); |
| 825 | |||
| 813 | switch (action.kind.id) { | 826 | switch (action.kind.id) { |
| 814 | case ACT_LMODS_TAP: | 827 | case ACT_LMODS_TAP: |
| 815 | case ACT_RMODS_TAP: | 828 | case ACT_RMODS_TAP: |
