process_auto_shift.h 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  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. #pragma once
  17. #include "quantum.h"
  18. #ifndef AUTO_SHIFT_TIMEOUT
  19. # define AUTO_SHIFT_TIMEOUT 175
  20. #endif
  21. #define IS_RETRO(kc) (IS_QK_MOD_TAP(kc) || IS_QK_LAYER_TAP(kc))
  22. #define DO_GET_AUTOSHIFT_TIMEOUT(keycode, record, ...) record
  23. // clang-format off
  24. #define AUTO_SHIFT_ALPHA KC_A ... KC_Z
  25. #define AUTO_SHIFT_NUMERIC KC_1 ... KC_0
  26. #define AUTO_SHIFT_SYMBOLS \
  27. KC_MINUS ... KC_SLASH: \
  28. case KC_NONUS_BACKSLASH
  29. // Kept to avoid breaking existing keymaps.
  30. #define AUTO_SHIFT_SPECIAL \
  31. KC_TAB: \
  32. case AUTO_SHIFT_SYMBOLS
  33. // clang-format on
  34. bool process_auto_shift(uint16_t keycode, keyrecord_t *record);
  35. void retroshift_poll_time(keyevent_t *event);
  36. void retroshift_swap_times(void);
  37. void autoshift_enable(void);
  38. void autoshift_disable(void);
  39. void autoshift_toggle(void);
  40. bool get_autoshift_state(void);
  41. uint16_t get_generic_autoshift_timeout(void);
  42. // clang-format off
  43. uint16_t (get_autoshift_timeout)(uint16_t keycode, keyrecord_t *record);
  44. void set_autoshift_timeout(uint16_t timeout);
  45. void autoshift_matrix_scan(void);
  46. bool get_custom_auto_shifted_key(uint16_t keycode, keyrecord_t *record);
  47. // clang-format on