diff options
author | tmk <nobody@nowhere> | 2013-02-20 15:52:32 +0900 |
---|---|---|
committer | tmk <nobody@nowhere> | 2013-02-20 15:52:32 +0900 |
commit | c3d57b69e02fce40455c96f4a9ac6b68b89ce027 (patch) | |
tree | cafa784fcc2c8ba91827d2417d57c740570b8ac4 /common/action.c | |
parent | e0f960a576e090808e5cc25c5368441c11f36ea6 (diff) | |
download | firmware-c3d57b69e02fce40455c96f4a9ac6b68b89ce027.tar.gz firmware-c3d57b69e02fce40455c96f4a9ac6b68b89ce027.tar.bz2 firmware-c3d57b69e02fce40455c96f4a9ac6b68b89ce027.zip |
Add keymap clear/reset action
Diffstat (limited to 'common/action.c')
-rw-r--r-- | common/action.c | 34 |
1 files changed, 29 insertions, 5 deletions
diff --git a/common/action.c b/common/action.c index 3703b4e8c..844a35b3e 100644 --- a/common/action.c +++ b/common/action.c @@ -355,26 +355,50 @@ static void process_action(keyrecord_t *record) case ACT_KEYMAP: switch (action.layer.code) { - /* Keymap Reset */ + /* Keymap clear */ case OP_RESET: - default_layer_set(action.layer.val); + switch (action.layer.val & 0x03) { + case 0: + overlay_clear(); + keymap_clear(); + break; + case ON_PRESS: + if (event.pressed) { + overlay_clear(); + keymap_clear(); + } + break; + case ON_RELEASE: + if (!event.pressed) { + overlay_clear(); + keymap_clear(); + } + break; + case ON_BOTH: + overlay_clear(); + keymap_clear(); + break; + } break; /* Keymap Reset default layer */ case (OP_RESET | ON_PRESS): if (event.pressed) { - default_layer_set(action.layer.val); overlay_clear(); + keymap_clear(); + default_layer_set(action.layer.val); } break; case (OP_RESET | ON_RELEASE): if (!event.pressed) { - default_layer_set(action.layer.val); overlay_clear(); + keymap_clear(); + default_layer_set(action.layer.val); } break; case (OP_RESET | ON_BOTH): - default_layer_set(action.layer.val); overlay_clear(); + keymap_clear(); + default_layer_set(action.layer.val); break; /* Keymap Bit invert */ |