diff options
| author | Joe Wasson <jwasson+github@gmail.com> | 2018-09-17 10:48:02 -0700 |
|---|---|---|
| committer | Jack Humbert <jack.humb@gmail.com> | 2018-09-17 13:48:02 -0400 |
| commit | 743449472e58651ec8111e6f70811103fb0a28bd (patch) | |
| tree | bf8391fd9ba42ec08fa42fc867b20810cbe27d4f /quantum | |
| parent | b65e2143751fd7c1721a6690597f523137c7c484 (diff) | |
| download | qmk_firmware-743449472e58651ec8111e6f70811103fb0a28bd.tar.gz qmk_firmware-743449472e58651ec8111e6f70811103fb0a28bd.zip | |
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.
Diffstat (limited to 'quantum')
| -rw-r--r-- | quantum/process_keycode/process_chording.c | 76 | ||||
| -rw-r--r-- | quantum/process_keycode/process_chording.h | 32 | ||||
| -rw-r--r-- | quantum/process_keycode/process_leader.c | 2 | ||||
| -rw-r--r-- | quantum/quantum.c | 7 | ||||
| -rw-r--r-- | quantum/quantum.h | 7 | ||||
| -rw-r--r-- | quantum/quantum_keycodes.h | 6 |
6 files changed, 5 insertions, 125 deletions
diff --git a/quantum/process_keycode/process_chording.c b/quantum/process_keycode/process_chording.c deleted file mode 100644 index 6c6ebe300..000000000 --- a/quantum/process_keycode/process_chording.c +++ /dev/null | |||
| @@ -1,76 +0,0 @@ | |||
| 1 | /* Copyright 2016 Jack Humbert | ||
| 2 | * | ||
| 3 | * This program is free software: you can redistribute it and/or modify | ||
| 4 | * it under the terms of the GNU General Public License as published by | ||
| 5 | * the Free Software Foundation, either version 2 of the License, or | ||
| 6 | * (at your option) any later version. | ||
| 7 | * | ||
| 8 | * This program is distributed in the hope that it will be useful, | ||
| 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 11 | * GNU General Public License for more details. | ||
| 12 | * | ||
| 13 | * You should have received a copy of the GNU General Public License | ||
| 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
| 15 | */ | ||
| 16 | |||
| 17 | #include "process_chording.h" | ||
| 18 | |||
| 19 | bool keys_chord(uint8_t keys[]) { | ||
| 20 | uint8_t keys_size = sizeof(keys)/sizeof(keys[0]); | ||
| 21 | bool pass = true; | ||
| 22 | uint8_t in = 0; | ||
| 23 | for (uint8_t i = 0; i < chord_key_count; i++) { | ||
| 24 | bool found = false; | ||
| 25 | for (uint8_t j = 0; j < keys_size; j++) { | ||
| 26 | if (chord_keys[i] == (keys[j] & 0xFF)) { | ||
| 27 | in++; // detects key in chord | ||
| 28 | found = true; | ||
| 29 | break; | ||
| 30 | } | ||
| 31 | } | ||
| 32 | if (found) | ||
| 33 | continue; | ||
| 34 | if (chord_keys[i] != 0) { | ||
| 35 | pass = false; // makes sure rest are blank | ||
| 36 | } | ||
| 37 | } | ||
| 38 | return (pass && (in == keys_size)); | ||
| 39 | } | ||
| 40 | |||
| 41 | bool process_chording(uint16_t keycode, keyrecord_t *record) { | ||
| 42 | if (keycode >= QK_CHORDING && keycode <= QK_CHORDING_MAX) { | ||
| 43 | if (record->event.pressed) { | ||
| 44 | if (!chording) { | ||
| 45 | chording = true; | ||
| 46 | for (uint8_t i = 0; i < CHORDING_MAX; i++) | ||
| 47 | chord_keys[i] = 0; | ||
| 48 | chord_key_count = 0; | ||
| 49 | chord_key_down = 0; | ||
| 50 | } | ||
| 51 | chord_keys[chord_key_count] = (keycode & 0xFF); | ||
| 52 | chord_key_count++; | ||
| 53 | chord_key_down++; | ||
| 54 | return false; | ||
| 55 | } else { | ||
| 56 | if (chording) { | ||
| 57 | chord_key_down--; | ||
| 58 | if (chord_key_down == 0) { | ||
| 59 | chording = false; | ||
| 60 | // Chord Dictionary | ||
| 61 | if (keys_chord((uint8_t[]){KC_ENTER, KC_SPACE})) { | ||
| 62 | register_code(KC_A); | ||
| 63 | unregister_code(KC_A); | ||
| 64 | return false; | ||
| 65 | } | ||
| 66 | for (uint8_t i = 0; i < chord_key_count; i++) { | ||
| 67 | register_code(chord_keys[i]); | ||
| 68 | unregister_code(chord_keys[i]); | ||
| 69 | return false; | ||
| 70 | } | ||
| 71 | } | ||
| 72 | } | ||
| 73 | } | ||
| 74 | } | ||
| 75 | return true; | ||
| 76 | } | ||
diff --git a/quantum/process_keycode/process_chording.h b/quantum/process_keycode/process_chording.h deleted file mode 100644 index 8c0f4862a..000000000 --- a/quantum/process_keycode/process_chording.h +++ /dev/null | |||
| @@ -1,32 +0,0 @@ | |||
| 1 | /* Copyright 2016 Jack Humbert | ||
| 2 | * | ||
| 3 | * This program is free software: you can redistribute it and/or modify | ||
| 4 | * it under the terms of the GNU General Public License as published by | ||
| 5 | * the Free Software Foundation, either version 2 of the License, or | ||
| 6 | * (at your option) any later version. | ||
| 7 | * | ||
| 8 | * This program is distributed in the hope that it will be useful, | ||
| 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 11 | * GNU General Public License for more details. | ||
| 12 | * | ||
| 13 | * You should have received a copy of the GNU General Public License | ||
| 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
| 15 | */ | ||
| 16 | |||
| 17 | #ifndef PROCESS_CHORDING_H | ||
| 18 | #define PROCESS_CHORDING_H | ||
| 19 | |||
| 20 | #include "quantum.h" | ||
| 21 | |||
| 22 | // Chording stuff | ||
| 23 | #define CHORDING_MAX 4 | ||
| 24 | bool chording = false; | ||
| 25 | |||
| 26 | uint8_t chord_keys[CHORDING_MAX] = {0}; | ||
| 27 | uint8_t chord_key_count = 0; | ||
| 28 | uint8_t chord_key_down = 0; | ||
| 29 | |||
| 30 | bool process_chording(uint16_t keycode, keyrecord_t *record); | ||
| 31 | |||
| 32 | #endif | ||
diff --git a/quantum/process_keycode/process_leader.c b/quantum/process_keycode/process_leader.c index c87ef115a..eddbf71f7 100644 --- a/quantum/process_keycode/process_leader.c +++ b/quantum/process_keycode/process_leader.c | |||
| @@ -14,7 +14,7 @@ | |||
| 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. |
| 15 | */ | 15 | */ |
| 16 | 16 | ||
| 17 | #ifndef DISABLE_LEADER | 17 | #ifdef LEADER_ENABLE |
| 18 | 18 | ||
| 19 | #include "process_leader.h" | 19 | #include "process_leader.h" |
| 20 | 20 | ||
diff --git a/quantum/quantum.c b/quantum/quantum.c index 9d352a94c..9bf91eb86 100644 --- a/quantum/quantum.c +++ b/quantum/quantum.c | |||
| @@ -196,7 +196,7 @@ bool process_record_quantum(keyrecord_t *record) { | |||
| 196 | keypos_t key = record->event.key; | 196 | keypos_t key = record->event.key; |
| 197 | uint16_t keycode; | 197 | uint16_t keycode; |
| 198 | 198 | ||
| 199 | #if !defined(NO_ACTION_LAYER) && defined(PREVENT_STUCK_MODIFIERS) | 199 | #if !defined(NO_ACTION_LAYER) && !defined(STRICT_LAYER_RELEASE) |
| 200 | /* TODO: Use store_or_get_action() or a similar function. */ | 200 | /* TODO: Use store_or_get_action() or a similar function. */ |
| 201 | if (!disable_action_cache) { | 201 | if (!disable_action_cache) { |
| 202 | uint8_t layer; | 202 | uint8_t layer; |
| @@ -251,12 +251,9 @@ bool process_record_quantum(keyrecord_t *record) { | |||
| 251 | #ifdef TAP_DANCE_ENABLE | 251 | #ifdef TAP_DANCE_ENABLE |
| 252 | process_tap_dance(keycode, record) && | 252 | process_tap_dance(keycode, record) && |
| 253 | #endif | 253 | #endif |
| 254 | #ifndef DISABLE_LEADER | 254 | #ifdef LEADER_ENABLE |
| 255 | process_leader(keycode, record) && | 255 | process_leader(keycode, record) && |
| 256 | #endif | 256 | #endif |
| 257 | #ifndef DISABLE_CHORDING | ||
| 258 | process_chording(keycode, record) && | ||
| 259 | #endif | ||
| 260 | #ifdef COMBO_ENABLE | 257 | #ifdef COMBO_ENABLE |
| 261 | process_combo(keycode, record) && | 258 | process_combo(keycode, record) && |
| 262 | #endif | 259 | #endif |
diff --git a/quantum/quantum.h b/quantum/quantum.h index d1f761f17..7cf16d81e 100644 --- a/quantum/quantum.h +++ b/quantum/quantum.h | |||
| @@ -89,15 +89,10 @@ extern uint32_t default_layer_state; | |||
| 89 | #include "process_music.h" | 89 | #include "process_music.h" |
| 90 | #endif | 90 | #endif |
| 91 | 91 | ||
| 92 | #ifndef DISABLE_LEADER | 92 | #ifdef LEADER_ENABLE |
| 93 | #include "process_leader.h" | 93 | #include "process_leader.h" |
| 94 | #endif | 94 | #endif |
| 95 | 95 | ||
| 96 | #define DISABLE_CHORDING | ||
| 97 | #ifndef DISABLE_CHORDING | ||
| 98 | #include "process_chording.h" | ||
| 99 | #endif | ||
| 100 | |||
| 101 | #ifdef UNICODE_ENABLE | 96 | #ifdef UNICODE_ENABLE |
| 102 | #include "process_unicode.h" | 97 | #include "process_unicode.h" |
| 103 | #endif | 98 | #endif |
diff --git a/quantum/quantum_keycodes.h b/quantum/quantum_keycodes.h index 0ecc293a8..3b8795496 100644 --- a/quantum/quantum_keycodes.h +++ b/quantum/quantum_keycodes.h | |||
| @@ -63,10 +63,6 @@ enum quantum_keycodes { | |||
| 63 | QK_ONE_SHOT_LAYER_MAX = 0x54FF, | 63 | QK_ONE_SHOT_LAYER_MAX = 0x54FF, |
| 64 | QK_ONE_SHOT_MOD = 0x5500, | 64 | QK_ONE_SHOT_MOD = 0x5500, |
| 65 | QK_ONE_SHOT_MOD_MAX = 0x55FF, | 65 | QK_ONE_SHOT_MOD_MAX = 0x55FF, |
| 66 | #ifndef DISABLE_CHORDING | ||
| 67 | QK_CHORDING = 0x5600, | ||
| 68 | QK_CHORDING_MAX = 0x56FF, | ||
| 69 | #endif | ||
| 70 | QK_TAP_DANCE = 0x5700, | 66 | QK_TAP_DANCE = 0x5700, |
| 71 | QK_TAP_DANCE_MAX = 0x57FF, | 67 | QK_TAP_DANCE_MAX = 0x57FF, |
| 72 | QK_LAYER_TAP_TOGGLE = 0x5800, | 68 | QK_LAYER_TAP_TOGGLE = 0x5800, |
| @@ -123,7 +119,7 @@ enum quantum_keycodes { | |||
| 123 | GRAVE_ESC, | 119 | GRAVE_ESC, |
| 124 | 120 | ||
| 125 | // Leader key | 121 | // Leader key |
| 126 | #ifndef DISABLE_LEADER | 122 | #ifdef LEADER_ENABLE |
| 127 | KC_LEAD, | 123 | KC_LEAD, |
| 128 | #endif | 124 | #endif |
| 129 | 125 | ||
