summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--tmk_core/common/action.c11
-rw-r--r--tmk_core/common/action.h1
-rw-r--r--tmk_core/common/action_layer.c8
3 files changed, 19 insertions, 1 deletions
diff --git a/tmk_core/common/action.c b/tmk_core/common/action.c
index 456d1e25fe..b99c2acaa7 100644
--- a/tmk_core/common/action.c
+++ b/tmk_core/common/action.c
@@ -899,9 +899,18 @@ void clear_keyboard(void)
*/
void clear_keyboard_but_mods(void)
{
+ clear_keys();
+ clear_keyboard_but_mods_and_keys();
+}
+
+/** \brief Utilities for actions. (FIXME: Needs better description)
+ *
+ * FIXME: Needs documentation.
+ */
+void clear_keyboard_but_mods_and_keys()
+{
clear_weak_mods();
clear_macro_mods();
- clear_keys();
send_keyboard_report();
#ifdef MOUSEKEY_ENABLE
mousekey_clear();
diff --git a/tmk_core/common/action.h b/tmk_core/common/action.h
index 5d797fd628..8e47e5339e 100644
--- a/tmk_core/common/action.h
+++ b/tmk_core/common/action.h
@@ -94,6 +94,7 @@ void unregister_mods(uint8_t mods);
//void set_mods(uint8_t mods);
void clear_keyboard(void);
void clear_keyboard_but_mods(void);
+void clear_keyboard_but_mods_and_keys(void);
void layer_switch(uint8_t new_layer);
bool is_tap_key(keypos_t key);
diff --git a/tmk_core/common/action_layer.c b/tmk_core/common/action_layer.c
index b8dcb34f3a..120ce3f51b 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