From b7a81f041906c3c978a314987e486536be0a58cd Mon Sep 17 00:00:00 2001 From: Didier Loiseau Date: Tue, 8 Mar 2016 23:14:15 +0100 Subject: Fix #156: clear weak mods on every key press - new macro_mods bit field for mods applied by macros - weak_mods now only used for ACT_{L,R}MODS (i.e. LSFT, RSFT, LCTL etc.) - clear the _weak_ mods on every key *pressed* such that LSFT etc. can no more interfere with the next key --- tmk_core/common/action.c | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'tmk_core/common/action.c') diff --git a/tmk_core/common/action.c b/tmk_core/common/action.c index 77ea39e94..4197c53ed 100644 --- a/tmk_core/common/action.c +++ b/tmk_core/common/action.c @@ -70,6 +70,10 @@ void process_action(keyrecord_t *record) #endif dprintln(); + if (event.pressed) { + // clear the potential weak mods left by previously pressed keys + clear_weak_mods(); + } switch (action.kind.id) { /* Key and Mods */ case ACT_LMODS: @@ -500,6 +504,7 @@ void clear_keyboard(void) void clear_keyboard_but_mods(void) { clear_weak_mods(); + clear_macro_mods(); clear_keys(); send_keyboard_report(); #ifdef MOUSEKEY_ENABLE -- cgit v1.2.3-24-g4f1b From ef21a855e6d60b78011ddb8940f58985b1c60acb Mon Sep 17 00:00:00 2001 From: Damien Pollet Date: Sun, 27 Mar 2016 17:58:26 +0200 Subject: Add per-event user hook function to QMK --- tmk_core/common/action.c | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'tmk_core/common/action.c') diff --git a/tmk_core/common/action.c b/tmk_core/common/action.c index 4197c53ed..c6595196f 100644 --- a/tmk_core/common/action.c +++ b/tmk_core/common/action.c @@ -53,6 +53,9 @@ void action_exec(keyevent_t event) #endif } +__attribute__ ((weak)) +void process_action_user(keyrecord_t *record) {} + void process_action(keyrecord_t *record) { keyevent_t event = record->event; @@ -62,6 +65,8 @@ void process_action(keyrecord_t *record) if (IS_NOEVENT(event)) { return; } + process_action_user(record); + action_t action = layer_switch_get_action(event.key); dprint("ACTION: "); debug_action(action); #ifndef NO_ACTION_LAYER -- cgit v1.2.3-24-g4f1b From acd64aa841f92ee638ca630fc66c3ff91c09ae72 Mon Sep 17 00:00:00 2001 From: Damien Pollet Date: Mon, 28 Mar 2016 16:12:50 +0200 Subject: Rename function to be keyboard-specific --- tmk_core/common/action.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'tmk_core/common/action.c') diff --git a/tmk_core/common/action.c b/tmk_core/common/action.c index c6595196f..2ccc0e0b9 100644 --- a/tmk_core/common/action.c +++ b/tmk_core/common/action.c @@ -54,7 +54,7 @@ void action_exec(keyevent_t event) } __attribute__ ((weak)) -void process_action_user(keyrecord_t *record) {} +void process_action_kb(keyrecord_t *record) {} void process_action(keyrecord_t *record) { @@ -65,7 +65,7 @@ void process_action(keyrecord_t *record) if (IS_NOEVENT(event)) { return; } - process_action_user(record); + process_action_kb(record); action_t action = layer_switch_get_action(event.key); dprint("ACTION: "); debug_action(action); -- cgit v1.2.3-24-g4f1b