logo

qmk_firmware

custom branch of QMK firmware git clone https://anongit.hacktivis.me/git/qmk_firmware.git

process_unicode_common.c (2689B)


  1. /* Copyright 2017 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. #include "process_unicode_common.h"
  17. #include "unicode.h"
  18. #include "action_util.h"
  19. #include "keycodes.h"
  20. #include "modifiers.h"
  21. #if defined(UNICODE_ENABLE)
  22. # include "process_unicode.h"
  23. #elif defined(UNICODEMAP_ENABLE)
  24. # include "process_unicodemap.h"
  25. #elif defined(UCIS_ENABLE)
  26. # include "process_ucis.h"
  27. #endif
  28. bool process_unicode_common(uint16_t keycode, keyrecord_t *record) {
  29. if (record->event.pressed) {
  30. bool shifted = get_mods() & MOD_MASK_SHIFT;
  31. switch (keycode) {
  32. case QK_UNICODE_MODE_NEXT:
  33. if (shifted) {
  34. unicode_input_mode_step_reverse();
  35. } else {
  36. unicode_input_mode_step();
  37. }
  38. break;
  39. case QK_UNICODE_MODE_PREVIOUS:
  40. if (shifted) {
  41. unicode_input_mode_step();
  42. } else {
  43. unicode_input_mode_step_reverse();
  44. }
  45. break;
  46. case QK_UNICODE_MODE_MACOS:
  47. set_unicode_input_mode(UNICODE_MODE_MACOS);
  48. break;
  49. case QK_UNICODE_MODE_LINUX:
  50. set_unicode_input_mode(UNICODE_MODE_LINUX);
  51. break;
  52. case QK_UNICODE_MODE_WINDOWS:
  53. set_unicode_input_mode(UNICODE_MODE_WINDOWS);
  54. break;
  55. case QK_UNICODE_MODE_BSD:
  56. set_unicode_input_mode(UNICODE_MODE_BSD);
  57. break;
  58. case QK_UNICODE_MODE_WINCOMPOSE:
  59. set_unicode_input_mode(UNICODE_MODE_WINCOMPOSE);
  60. break;
  61. case QK_UNICODE_MODE_EMACS:
  62. set_unicode_input_mode(UNICODE_MODE_EMACS);
  63. break;
  64. }
  65. }
  66. #if defined(UNICODE_ENABLE)
  67. return process_unicode(keycode, record);
  68. #elif defined(UNICODEMAP_ENABLE)
  69. return process_unicodemap(keycode, record);
  70. #elif defined(UCIS_ENABLE)
  71. return process_ucis(keycode, record);
  72. #else
  73. return true;
  74. #endif
  75. }