process_auto_shift.h (2058B)
1 /* Copyright 2017 Jeremy Cowgar 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 #pragma once 18 19 #include <stdint.h> 20 #include <stdbool.h> 21 #include "action.h" 22 #include "keyboard.h" 23 #include "keycodes.h" 24 25 #ifndef AUTO_SHIFT_TIMEOUT 26 # define AUTO_SHIFT_TIMEOUT 175 27 #endif 28 29 #define IS_RETRO(kc) (IS_QK_MOD_TAP(kc) || IS_QK_LAYER_TAP(kc)) 30 31 #define DO_GET_AUTOSHIFT_TIMEOUT(keycode, record, ...) record 32 // clang-format off 33 #define AUTO_SHIFT_ALPHA KC_A ... KC_Z 34 #define AUTO_SHIFT_NUMERIC KC_1 ... KC_0 35 #define AUTO_SHIFT_SYMBOLS \ 36 KC_MINUS ... KC_SLASH: \ 37 case KC_NONUS_BACKSLASH 38 39 // Kept to avoid breaking existing keymaps. 40 #define AUTO_SHIFT_SPECIAL \ 41 KC_TAB: \ 42 case AUTO_SHIFT_SYMBOLS 43 // clang-format on 44 45 bool process_auto_shift(uint16_t keycode, keyrecord_t *record); 46 void retroshift_poll_time(keyevent_t *event); 47 void retroshift_swap_times(void); 48 49 void autoshift_enable(void); 50 void autoshift_disable(void); 51 void autoshift_toggle(void); 52 bool get_autoshift_state(void); 53 uint16_t get_generic_autoshift_timeout(void); 54 // clang-format off 55 uint16_t (get_autoshift_timeout)(uint16_t keycode, keyrecord_t *record); 56 void set_autoshift_timeout(uint16_t timeout); 57 void autoshift_matrix_scan(void); 58 bool get_custom_auto_shifted_key(uint16_t keycode, keyrecord_t *record); 59 bool get_auto_shifted_key(uint16_t keycode, keyrecord_t *record); 60 // clang-format on