From 743449472e58651ec8111e6f70811103fb0a28bd Mon Sep 17 00:00:00 2001 From: Joe Wasson Date: Mon, 17 Sep 2018 10:48:02 -0700 Subject: Make `PREVENT_STUCK_MODIFIERS` the default (#3107) * Remove chording as it is not documented, not used, and needs work. * Make Leader Key an optional feature. * Switch from `PREVENT_STUCK_MODIFIERS` to `STRICT_LAYER_RELEASE` * Remove `#define PREVENT_STUCK_MODIFIERS` from keymaps. --- tmk_core/common/action_layer.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'tmk_core/common/action_layer.c') diff --git a/tmk_core/common/action_layer.c b/tmk_core/common/action_layer.c index f3cd381ab..62375dfbf 100644 --- a/tmk_core/common/action_layer.c +++ b/tmk_core/common/action_layer.c @@ -219,7 +219,7 @@ void layer_debug(void) } #endif -#if !defined(NO_ACTION_LAYER) && defined(PREVENT_STUCK_MODIFIERS) +#if !defined(NO_ACTION_LAYER) && !defined(STRICT_LAYER_RELEASE) uint8_t source_layers_cache[(MATRIX_ROWS * MATRIX_COLS + 7) / 8][MAX_LAYER_BITS] = {{0}}; void update_source_layers_cache(keypos_t key, uint8_t layer) @@ -263,7 +263,7 @@ uint8_t read_source_layers_cache(keypos_t key) */ action_t store_or_get_action(bool pressed, keypos_t key) { -#if !defined(NO_ACTION_LAYER) && defined(PREVENT_STUCK_MODIFIERS) +#if !defined(NO_ACTION_LAYER) && !defined(STRICT_LAYER_RELEASE) if (disable_action_cache) { return layer_switch_get_action(key); } -- cgit v1.2.3-24-g4f1b From 4318797d198b58bb807b3e436c7d8924d8b4a6fe Mon Sep 17 00:00:00 2001 From: Drashna Jaelre Date: Mon, 27 Aug 2018 09:16:54 -0700 Subject: Add user level to default_layer_state_set --- tmk_core/common/action_layer.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'tmk_core/common/action_layer.c') diff --git a/tmk_core/common/action_layer.c b/tmk_core/common/action_layer.c index 62375dfbf..b8dcb34f3 100644 --- a/tmk_core/common/action_layer.c +++ b/tmk_core/common/action_layer.c @@ -15,13 +15,22 @@ */ uint32_t default_layer_state = 0; +/** \brief Default Layer State Set At user Level + * + * FIXME: Needs docs + */ +__attribute__((weak)) +uint32_t default_layer_state_set_user(uint32_t state) { + return state; +} + /** \brief Default Layer State Set At Keyboard Level * * FIXME: Needs docs */ __attribute__((weak)) uint32_t default_layer_state_set_kb(uint32_t state) { - return state; + return default_layer_state_set_user(state); } /** \brief Default Layer State Set -- cgit v1.2.3-24-g4f1b From 93b004c943a4b13bd640fc83000e910b72cb4640 Mon Sep 17 00:00:00 2001 From: Konstantin Đorđević Date: Fri, 28 Dec 2018 20:07:56 +0100 Subject: Keep pressed keys on layer state change (fixes #2053, #2279) (#3905) * Keep pressed keys on layer state change * Add doc comment for clear_keyboard_but_mods_and_keys * Keep pressed keys only if PREVENT_STUCK_MODIFIERS is on * Check STRICT_LAYER_RELEASE instead of PREVENT_STUCK_MODIFIERS --- tmk_core/common/action_layer.c | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'tmk_core/common/action_layer.c') diff --git a/tmk_core/common/action_layer.c b/tmk_core/common/action_layer.c index b8dcb34f3..120ce3f51 100644 --- a/tmk_core/common/action_layer.c +++ b/tmk_core/common/action_layer.c @@ -44,7 +44,11 @@ static void default_layer_state_set(uint32_t state) default_layer_debug(); debug(" to "); default_layer_state = state; default_layer_debug(); debug("\n"); +#ifdef STRICT_LAYER_RELEASE clear_keyboard_but_mods(); // To avoid stuck keys +#else + clear_keyboard_but_mods_and_keys(); // Don't reset held keys +#endif } /** \brief Default Layer Print @@ -127,7 +131,11 @@ void layer_state_set(uint32_t state) layer_debug(); dprint(" to "); layer_state = state; layer_debug(); dprintln(); +#ifdef STRICT_LAYER_RELEASE clear_keyboard_but_mods(); // To avoid stuck keys +#else + clear_keyboard_but_mods_and_keys(); // Don't reset held keys +#endif } /** \brief Layer clear -- cgit v1.2.3-24-g4f1b