diff options
author | Jack Humbert <jack.humb@gmail.com> | 2015-10-27 19:10:36 -0400 |
---|---|---|
committer | Jack Humbert <jack.humb@gmail.com> | 2015-10-27 19:10:36 -0400 |
commit | e98c501a614385132a2e2a61a1242f12bab89969 (patch) | |
tree | f1f302d4ea2b6661f503b76782323545691ee87a /tmk_core/common | |
parent | d311fd8d1a0af3b767d26b520d399bf0db22f058 (diff) |
almost there - keymap_key_to_keycode returning 16bits, maybeunicode
Diffstat (limited to 'tmk_core/common')
-rw-r--r-- | tmk_core/common/action.c | 4 | ||||
-rw-r--r-- | tmk_core/common/action.h | 3 | ||||
-rw-r--r-- | tmk_core/common/action_layer.c | 8 | ||||
-rw-r--r-- | tmk_core/common/action_layer.h | 2 | ||||
-rw-r--r-- | tmk_core/common/action_tapping.c | 2 | ||||
-rw-r--r-- | tmk_core/common/keymap.c | 2 |
6 files changed, 11 insertions, 10 deletions
diff --git a/tmk_core/common/action.c b/tmk_core/common/action.c index 1f15bd0918..01692981ea 100644 --- a/tmk_core/common/action.c +++ b/tmk_core/common/action.c @@ -62,7 +62,7 @@ void process_action(keyrecord_t *record) if (IS_NOEVENT(event)) { return; } - action_t action = layer_switch_get_action(event.key); + action_t action = layer_switch_get_action(record, event.key); dprint("ACTION: "); debug_action(action); #ifndef NO_ACTION_LAYER dprint(" layer_state: "); layer_debug(); @@ -511,7 +511,7 @@ void clear_keyboard_but_mods(void) bool is_tap_key(keypos_t key) { - action_t action = layer_switch_get_action(key); + action_t action = layer_switch_get_action(NULL, key); switch (action.kind.id) { case ACT_LMODS_TAP: diff --git a/tmk_core/common/action.h b/tmk_core/common/action.h index 8a4736d7bc..16a1ed4b3f 100644 --- a/tmk_core/common/action.h +++ b/tmk_core/common/action.h @@ -19,6 +19,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. #include <stdint.h> #include <stdbool.h> +#include <stddef.h> #include "keyboard.h" #include "keycode.h" #include "action_code.h" @@ -50,7 +51,7 @@ typedef struct { void action_exec(keyevent_t event); /* action for key */ -action_t action_for_key(uint8_t layer, keypos_t key); +action_t action_for_key(keyrecord_t *record, uint8_t layer, keypos_t key); /* macro */ const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt); diff --git a/tmk_core/common/action_layer.c b/tmk_core/common/action_layer.c index c535615f44..8dfb35b626 100644 --- a/tmk_core/common/action_layer.c +++ b/tmk_core/common/action_layer.c @@ -112,7 +112,7 @@ void layer_debug(void) -action_t layer_switch_get_action(keypos_t key) +action_t layer_switch_get_action(keyrecord_t *record, keypos_t key) { action_t action; action.code = ACTION_TRANSPARENT; @@ -122,17 +122,17 @@ action_t layer_switch_get_action(keypos_t key) /* check top layer first */ for (int8_t i = 31; i >= 0; i--) { if (layers & (1UL<<i)) { - action = action_for_key(i, key); + action = action_for_key(record, i, key); if (action.code != ACTION_TRANSPARENT) { return action; } } } /* fall back to layer 0 */ - action = action_for_key(0, key); + action = action_for_key(record, 0, key); return action; #else - action = action_for_key(biton32(default_layer_state), key); + action = action_for_key(record, biton32(default_layer_state), key); return action; #endif } diff --git a/tmk_core/common/action_layer.h b/tmk_core/common/action_layer.h index b6da353cfd..e91d9dca79 100644 --- a/tmk_core/common/action_layer.h +++ b/tmk_core/common/action_layer.h @@ -72,6 +72,6 @@ void layer_xor(uint32_t state); /* return action depending on current layer status */ -action_t layer_switch_get_action(keypos_t key); +action_t layer_switch_get_action(keyrecord_t *record, keypos_t key); #endif diff --git a/tmk_core/common/action_tapping.c b/tmk_core/common/action_tapping.c index 826c233096..62b1874d42 100644 --- a/tmk_core/common/action_tapping.c +++ b/tmk_core/common/action_tapping.c @@ -116,7 +116,7 @@ bool process_tapping(keyrecord_t *keyp) */ else if (IS_RELEASED(event) && !waiting_buffer_typed(event)) { // Modifier should be retained till end of this tapping. - action_t action = layer_switch_get_action(event.key); + action_t action = layer_switch_get_action(0, event.key); switch (action.kind.id) { case ACT_LMODS: case ACT_RMODS: diff --git a/tmk_core/common/keymap.c b/tmk_core/common/keymap.c index 11f4aa8aaa..0631b15ff8 100644 --- a/tmk_core/common/keymap.c +++ b/tmk_core/common/keymap.c @@ -29,7 +29,7 @@ static action_t keycode_to_action(uint8_t keycode); /* converts key to action */ __attribute__ ((weak)) -action_t action_for_key(uint8_t layer, keypos_t key) +action_t action_for_key(keyrecord_t *record, uint8_t layer, keypos_t key) { uint8_t keycode = keymap_key_to_keycode(layer, key); switch (keycode) { |