Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make PREVENT_STUCK_MODIFIERS the default #3107

Merged
merged 4 commits into from
Sep 17, 2018
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Switch from PREVENT_STUCK_MODIFIERS to STRICT_LAYER_RELEASE
  • Loading branch information
Talljoe committed Sep 17, 2018
commit f7349ed0291c943d0da481557cfe798f352d7c81
4 changes: 2 additions & 2 deletions docs/config_options.md
Original file line number Diff line number Diff line change
@@ -119,8 +119,8 @@ If you define these options you will enable the associated feature, which may in

* `#define FORCE_NKRO`
* NKRO by default requires to be turned on, this forces it on during keyboard startup regardless of EEPROM setting. NKRO can still be turned off but will be turned on again if the keyboard reboots.
* `#define PREVENT_STUCK_MODIFIERS`
* stores the layer a key press came from so the same layer is used when the key is released, regardless of which layers are enabled
* `#define STRICT_LAYER_RELEASE`
* force a key release to be evaluated using the current layer stack instead of remembering which layer it came from (used for advanced cases)

## Behaviors That Can Be Configured

4 changes: 0 additions & 4 deletions keyboards/planck/keymaps/mitch/readme.md
Original file line number Diff line number Diff line change
@@ -20,7 +20,3 @@ rest of the symbols, mostly mapped with the ten key numbers.

The normal right shift key uses the `MT` macro to trigger Enter on tap and right
shift when held.

This keymap sets the `PREVENT_STUCK_MODIFIERS` flag to avoid the occasional WTF
moments when using a modifier keys and accidentally releasing them after moving
to a new layer.
4 changes: 2 additions & 2 deletions layouts/community/ergodox/mclennon_osx/README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Ergodox EZ for OS X

This keymapping is designed to be reasonably familiar to an ordinary Mac keyboard while taking advantage of the Ergodox EZ's features. Caps lock instead enables a layer which allows a user to use HJKL as arrow keys and to control media. Shift and control have additional mappings on S and D to provide easier access while holding down caps lock.
This keymapping is designed to be reasonably familiar to an ordinary Mac keyboard while taking advantage of the Ergodox EZ's features. Caps lock instead enables a layer which allows a user to use HJKL as arrow keys and to control media. Shift and control have additional mappings on S and D to provide easier access while holding down caps lock.

If you choose to compile this yourself, be sure to compile with `#define PREVENT_STUCK_MODIFIERS` in your `config.h`. Firmware built using [qmk_firmware](https://github.com/qmk/qmk_firmware/).
Firmware built using [qmk_firmware](https://github.com/qmk/qmk_firmware/).
2 changes: 1 addition & 1 deletion layouts/community/ergodox/techtomas/readme.md
Original file line number Diff line number Diff line change
@@ -39,7 +39,7 @@ The right arrow key and End key toggle the control layer on the left board. Ther
On the left board you have mouse control with left & right click in the location of the G and B keys.
On the right board you have vim-style arrow keys using hjkl

The left thumb cluster moves shift and alt within easy reach while holding the toggle (end). So far I've found this convient to navigate and skip around text when using the hjkl arrow keys. I found that it was easy to get the alt key stuck on depending on what key you released first so I added the PREVENT_STUCK_MODIFIERS to the config.h to help with that.
The left thumb cluster moves shift and alt within easy reach while holding the toggle (end). So far I've found this convient to navigate and skip around text when using the hjkl arrow keys.

## Changelog

2 changes: 1 addition & 1 deletion quantum/quantum.c
Original file line number Diff line number Diff line change
@@ -196,7 +196,7 @@ bool process_record_quantum(keyrecord_t *record) {
keypos_t key = record->event.key;
uint16_t keycode;

#if !defined(NO_ACTION_LAYER) && defined(PREVENT_STUCK_MODIFIERS)
#if !defined(NO_ACTION_LAYER) && !defined(STRICT_LAYER_RELEASE)
/* TODO: Use store_or_get_action() or a similar function. */
if (!disable_action_cache) {
uint8_t layer;
2 changes: 1 addition & 1 deletion tmk_core/common/action.c
Original file line number Diff line number Diff line change
@@ -120,7 +120,7 @@ void process_hand_swap(keyevent_t *event) {
}
#endif

#if !defined(NO_ACTION_LAYER) && defined(PREVENT_STUCK_MODIFIERS)
#if !defined(NO_ACTION_LAYER) && !defined(STRICT_LAYER_RELEASE)
bool disable_action_cache = false;

void process_record_nocache(keyrecord_t *record)
2 changes: 1 addition & 1 deletion tmk_core/common/action.h
Original file line number Diff line number Diff line change
@@ -62,7 +62,7 @@ void action_function(keyrecord_t *record, uint8_t id, uint8_t opt);
bool process_record_quantum(keyrecord_t *record);

/* Utilities for actions. */
#if !defined(NO_ACTION_LAYER) && defined(PREVENT_STUCK_MODIFIERS)
#if !defined(NO_ACTION_LAYER) && !defined(STRICT_LAYER_RELEASE)
extern bool disable_action_cache;
#endif

4 changes: 2 additions & 2 deletions tmk_core/common/action_layer.c
Original file line number Diff line number Diff line change
@@ -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);
}
2 changes: 1 addition & 1 deletion tmk_core/common/action_layer.h
Original file line number Diff line number Diff line change
@@ -88,7 +88,7 @@ uint32_t layer_state_set_kb(uint32_t state);
#endif

/* pressed actions cache */
#if !defined(NO_ACTION_LAYER) && defined(PREVENT_STUCK_MODIFIERS)
#if !defined(NO_ACTION_LAYER) && !defined(STRICT_LAYER_RELEASE)
/* The number of bits needed to represent the layer number: log2(32). */
#define MAX_LAYER_BITS 5
void update_source_layers_cache(keypos_t key, uint8_t layer);