summaryrefslogtreecommitdiff
path: root/common/action.c
diff options
context:
space:
mode:
authortmk <nobody@nowhere>2013-02-13 09:23:52 +0900
committertmk <nobody@nowhere>2013-02-13 09:26:22 +0900
commit48e6d0848cdeac26ffab101ea2ef48e5ac60acd3 (patch)
tree7f6d82af6752a9ca0d7ae2e3b72cf1ad3b602a3a /common/action.c
parentf02431e9da2158ff8a8508629b86329fef0ba24a (diff)
Make Transparent feature available to new keymaps.
Diffstat (limited to 'common/action.c')
-rw-r--r--common/action.c19
1 files changed, 16 insertions, 3 deletions
diff --git a/common/action.c b/common/action.c
index aadf5e16e8..710300eb30 100644
--- a/common/action.c
+++ b/common/action.c
@@ -201,6 +201,19 @@ void action_exec(keyevent_t event)
}
}
+static action_t get_action(key_t key)
+{
+ action_t action = keymap_get_action(current_layer, key.pos.row, key.pos.col);
+
+ /* Transparently use default layer */
+ if (action.code == ACTION_TRANSPARENT) {
+ // TODO: layer stacking
+ action = keymap_get_action(default_layer, key.pos.row, key.pos.col);
+ debug("TRNASPARENT: "); debug_hex16(action.code); debug("\n");
+ }
+ return action;
+}
+
static void process_action(keyrecord_t *record)
{
keyevent_t event = record->event;
@@ -208,8 +221,7 @@ static void process_action(keyrecord_t *record)
if (IS_NOEVENT(event)) { return; }
- action_t action = keymap_get_action(current_layer, event.key.pos.row, event.key.pos.col);
- //debug("action: "); debug_hex16(action.code); if (event.pressed) debug("d\n"); else debug("u\n");
+ action_t action = get_action(event.key);
debug("ACTION: "); debug_action(action); debug("\n");
switch (action.kind.id) {
@@ -809,7 +821,8 @@ void layer_switch(uint8_t new_layer)
bool is_tap_key(key_t key)
{
- action_t action = keymap_get_action(current_layer, key.pos.row, key.pos.col);
+ action_t action = get_action(key);
+
switch (action.kind.id) {
case ACT_LMODS_TAP:
case ACT_RMODS_TAP: