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.
This commit is contained in:
parent
b65e214375
commit
743449472e
198 changed files with 91 additions and 599 deletions
|
@ -1,76 +0,0 @@
|
|||
/* Copyright 2016 Jack Humbert
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "process_chording.h"
|
||||
|
||||
bool keys_chord(uint8_t keys[]) {
|
||||
uint8_t keys_size = sizeof(keys)/sizeof(keys[0]);
|
||||
bool pass = true;
|
||||
uint8_t in = 0;
|
||||
for (uint8_t i = 0; i < chord_key_count; i++) {
|
||||
bool found = false;
|
||||
for (uint8_t j = 0; j < keys_size; j++) {
|
||||
if (chord_keys[i] == (keys[j] & 0xFF)) {
|
||||
in++; // detects key in chord
|
||||
found = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (found)
|
||||
continue;
|
||||
if (chord_keys[i] != 0) {
|
||||
pass = false; // makes sure rest are blank
|
||||
}
|
||||
}
|
||||
return (pass && (in == keys_size));
|
||||
}
|
||||
|
||||
bool process_chording(uint16_t keycode, keyrecord_t *record) {
|
||||
if (keycode >= QK_CHORDING && keycode <= QK_CHORDING_MAX) {
|
||||
if (record->event.pressed) {
|
||||
if (!chording) {
|
||||
chording = true;
|
||||
for (uint8_t i = 0; i < CHORDING_MAX; i++)
|
||||
chord_keys[i] = 0;
|
||||
chord_key_count = 0;
|
||||
chord_key_down = 0;
|
||||
}
|
||||
chord_keys[chord_key_count] = (keycode & 0xFF);
|
||||
chord_key_count++;
|
||||
chord_key_down++;
|
||||
return false;
|
||||
} else {
|
||||
if (chording) {
|
||||
chord_key_down--;
|
||||
if (chord_key_down == 0) {
|
||||
chording = false;
|
||||
// Chord Dictionary
|
||||
if (keys_chord((uint8_t[]){KC_ENTER, KC_SPACE})) {
|
||||
register_code(KC_A);
|
||||
unregister_code(KC_A);
|
||||
return false;
|
||||
}
|
||||
for (uint8_t i = 0; i < chord_key_count; i++) {
|
||||
register_code(chord_keys[i]);
|
||||
unregister_code(chord_keys[i]);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
|
@ -1,32 +0,0 @@
|
|||
/* Copyright 2016 Jack Humbert
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef PROCESS_CHORDING_H
|
||||
#define PROCESS_CHORDING_H
|
||||
|
||||
#include "quantum.h"
|
||||
|
||||
// Chording stuff
|
||||
#define CHORDING_MAX 4
|
||||
bool chording = false;
|
||||
|
||||
uint8_t chord_keys[CHORDING_MAX] = {0};
|
||||
uint8_t chord_key_count = 0;
|
||||
uint8_t chord_key_down = 0;
|
||||
|
||||
bool process_chording(uint16_t keycode, keyrecord_t *record);
|
||||
|
||||
#endif
|
|
@ -14,7 +14,7 @@
|
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef DISABLE_LEADER
|
||||
#ifdef LEADER_ENABLE
|
||||
|
||||
#include "process_leader.h"
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue