]> git.donarmstrong.com Git - qmk_firmware.git/commitdiff
Document the issue of stuck modifiers
authorWojciech Siewierski <wojciech.siewierski@onet.pl>
Tue, 8 Mar 2016 07:48:43 +0000 (08:48 +0100)
committerWojciech Siewierski <wojciech.siewierski@onet.pl>
Tue, 8 Mar 2016 07:48:43 +0000 (08:48 +0100)
README.md
tmk_core/common/action.c

index 6a6bbed40b0097ba50b0168d8a554de56da5e719..d8dfd7c2bc3025daa96f712e6dae616fc87d5a59 100644 (file)
--- a/README.md
+++ b/README.md
@@ -98,6 +98,26 @@ We've added shortcuts to make common modifier/tap (mod-tap) mappings more compac
 
 `DF(layer)` - sets default layer to *layer*. The default layer is the one at the "bottom" of the layer stack - the ultimate fallback layer. This currently does not persist over power loss. When you plug the keyboard back in, layer 0 will always be the default. It is theoretically possible to work around that, but that's not what `DF` does.
 
+### Prevent stuck modifiers
+
+Consider the following scenario:
+
+1. Layer 0 has a key defined as Shift.
+2. The same key is defined on layer 1 as the letter A.
+3. User presses Shift.
+4. User switches to layer 1 for whatever reason.
+5. User releases Shift, or rather the letter A.
+6. User switches back to layer 0.
+
+Shift was actually never released and is still considered pressed.
+
+If such situation bothers you add this to your `config.h`:
+
+    #define PREVENT_STUCK_MODIFIERS
+
+Warning: This option uses up 2 bytes of memory per key. For example on
+Planck it uses 2\*4\*12=96 bytes.
+
 ### Remember: These are just aliases
 
 These functions work the same way that their `ACTION_*` functions do - they're just quick aliases. To dig into all of the tmk ACTION_* functions, please see the [TMK documentation](https://github.com/jackhumbert/qmk_firmware/blob/master/tmk_core/doc/keymap.md#2-action).
index be06e12aae096fb6414897bc5528b882000d912c..26a5fad7ac676cbbe4517b85ce8b4ffcf74b3f27 100644 (file)
@@ -61,7 +61,7 @@ void action_exec(keyevent_t event)
  */
 action_t store_or_get_action(bool pressed, keypos_t key)
 {
-#ifndef NO_ACTION_LAYER
+#if !defined(NO_ACTION_LAYER) && defined(PREVENT_STUCK_MODIFIERS)
     static action_t pressed_actions[MATRIX_ROWS][MATRIX_COLS];
 
     if (pressed) {