diff options
| author | Jason Stillwell <dragonfax@gmail.com> | 2018-03-16 13:41:01 -0700 |
|---|---|---|
| committer | Jack Humbert <jack.humb@gmail.com> | 2018-03-16 16:41:01 -0400 |
| commit | 00b4dce605bc44a2ee6babaf93dbe3640e735d2e (patch) | |
| tree | f146f9f64439a7ea0b16bf91f5f7e89e172a4368 | |
| parent | bb5c98699fe622a8978c6fc62dc5829d227fdec5 (diff) | |
| download | qmk_firmware-00b4dce605bc44a2ee6babaf93dbe3640e735d2e.tar.gz qmk_firmware-00b4dce605bc44a2ee6babaf93dbe3640e735d2e.zip | |
Rule to enable Modifiers with Auto-Shift (#2542)
* Re-enable modifiers with auto-shift
* Auto-shift modifiers rule
* missed a line
* Documentation
* fixing whitespace
| -rw-r--r-- | common_features.mk | 3 | ||||
| -rw-r--r-- | docs/feature_auto_shift.md | 17 | ||||
| -rw-r--r-- | quantum/process_keycode/process_auto_shift.c | 4 |
3 files changed, 20 insertions, 4 deletions
diff --git a/common_features.mk b/common_features.mk index 1c0b3546a..9b99edd75 100644 --- a/common_features.mk +++ b/common_features.mk | |||
| @@ -132,6 +132,9 @@ endif | |||
| 132 | ifeq ($(strip $(AUTO_SHIFT_ENABLE)), yes) | 132 | ifeq ($(strip $(AUTO_SHIFT_ENABLE)), yes) |
| 133 | OPT_DEFS += -DAUTO_SHIFT_ENABLE | 133 | OPT_DEFS += -DAUTO_SHIFT_ENABLE |
| 134 | SRC += $(QUANTUM_DIR)/process_keycode/process_auto_shift.c | 134 | SRC += $(QUANTUM_DIR)/process_keycode/process_auto_shift.c |
| 135 | ifeq ($(strip $(AUTO_SHIFT_MODIFIERS)), yes) | ||
| 136 | OPT_DEFS += -DAUTO_SHIFT_MODIFIERS | ||
| 137 | endif | ||
| 135 | endif | 138 | endif |
| 136 | 139 | ||
| 137 | ifeq ($(strip $(SERIAL_LINK_ENABLE)), yes) | 140 | ifeq ($(strip $(SERIAL_LINK_ENABLE)), yes) |
diff --git a/docs/feature_auto_shift.md b/docs/feature_auto_shift.md index ae821431d..9db4f11aa 100644 --- a/docs/feature_auto_shift.md +++ b/docs/feature_auto_shift.md | |||
| @@ -28,10 +28,7 @@ Yes, unfortunately. | |||
| 28 | characters, you could press and hold the 'a' key for a second or two. This no | 28 | characters, you could press and hold the 'a' key for a second or two. This no |
| 29 | longer works with Auto Shift because it is timing your depressed time instead | 29 | longer works with Auto Shift because it is timing your depressed time instead |
| 30 | of emitting a depressed key state to your operating system. | 30 | of emitting a depressed key state to your operating system. |
| 31 | 2. Auto Shift is disabled for any key press that is accompanied by one or more | 31 | 2. You will have characters that are shifted when you did not intend on shifting, and |
| 32 | modifiers. Thus, Ctrl+A that you hold for a really long time is not the same | ||
| 33 | as Ctrl+Shift+A. | ||
| 34 | 3. You will have characters that are shifted when you did not intend on shifting, and | ||
| 35 | other characters you wanted shifted, but were not. This simply comes down to | 32 | other characters you wanted shifted, but were not. This simply comes down to |
| 36 | practice. As we get in a hurry, we think we have hit the key long enough | 33 | practice. As we get in a hurry, we think we have hit the key long enough |
| 37 | for a shifted version, but we did not. On the other hand, we may think we are | 34 | for a shifted version, but we did not. On the other hand, we may think we are |
| @@ -48,6 +45,18 @@ If no `rules.mk` exists, you can create one. | |||
| 48 | 45 | ||
| 49 | Then compile and install your new firmware with Auto Key enabled! That's it! | 46 | Then compile and install your new firmware with Auto Key enabled! That's it! |
| 50 | 47 | ||
| 48 | ## Modifiers | ||
| 49 | |||
| 50 | By default, Auto Shift is disabled for any key press that is accompanied by one or more | ||
| 51 | modifiers. Thus, Ctrl+A that you hold for a really long time is not the same | ||
| 52 | as Ctrl+Shift+A. | ||
| 53 | |||
| 54 | You can re-enable Auto Shift for modifiers by adding another rule to your `rules.mk` | ||
| 55 | |||
| 56 | AUTO_SHIFT_MODIFIERS = yes | ||
| 57 | |||
| 58 | In which case, Ctrl+A held past the `AUTO_SHIFT_TIMEOUT` will be sent as Ctrl+Shift+A | ||
| 59 | |||
| 51 | ## Configuring Auto Shift | 60 | ## Configuring Auto Shift |
| 52 | 61 | ||
| 53 | If desired, there is some configuration that can be done to change the | 62 | If desired, there is some configuration that can be done to change the |
diff --git a/quantum/process_keycode/process_auto_shift.c b/quantum/process_keycode/process_auto_shift.c index fcce91849..098bdeaa7 100644 --- a/quantum/process_keycode/process_auto_shift.c +++ b/quantum/process_keycode/process_auto_shift.c | |||
| @@ -92,7 +92,9 @@ bool autoshift_state(void) { | |||
| 92 | } | 92 | } |
| 93 | 93 | ||
| 94 | bool process_auto_shift(uint16_t keycode, keyrecord_t *record) { | 94 | bool process_auto_shift(uint16_t keycode, keyrecord_t *record) { |
| 95 | #ifndef AUTO_SHIFT_MODIFIERS | ||
| 95 | static uint8_t any_mod_pressed; | 96 | static uint8_t any_mod_pressed; |
| 97 | #endif | ||
| 96 | 98 | ||
| 97 | if (record->event.pressed) { | 99 | if (record->event.pressed) { |
| 98 | switch (keycode) { | 100 | switch (keycode) { |
| @@ -175,6 +177,7 @@ bool process_auto_shift(uint16_t keycode, keyrecord_t *record) { | |||
| 175 | autoshift_flush(); | 177 | autoshift_flush(); |
| 176 | if (!autoshift_enabled) return true; | 178 | if (!autoshift_enabled) return true; |
| 177 | 179 | ||
| 180 | #ifndef AUTO_SHIFT_MODIFIERS | ||
| 178 | any_mod_pressed = get_mods() & ( | 181 | any_mod_pressed = get_mods() & ( |
| 179 | MOD_BIT(KC_LGUI)|MOD_BIT(KC_RGUI)| | 182 | MOD_BIT(KC_LGUI)|MOD_BIT(KC_RGUI)| |
| 180 | MOD_BIT(KC_LALT)|MOD_BIT(KC_RALT)| | 183 | MOD_BIT(KC_LALT)|MOD_BIT(KC_RALT)| |
| @@ -185,6 +188,7 @@ bool process_auto_shift(uint16_t keycode, keyrecord_t *record) { | |||
| 185 | if (any_mod_pressed) { | 188 | if (any_mod_pressed) { |
| 186 | return true; | 189 | return true; |
| 187 | } | 190 | } |
| 191 | #endif | ||
| 188 | 192 | ||
| 189 | autoshift_on(keycode); | 193 | autoshift_on(keycode); |
| 190 | return false; | 194 | return false; |
