12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455 |
- #include "process_unicodemap.h"
- #include "unicode.h"
- #include "quantum_keycodes.h"
- #include "keycode.h"
- #include "action_util.h"
- #include "host.h"
- __attribute__((weak)) uint16_t unicodemap_index(uint16_t keycode) {
- if (keycode >= QK_UNICODEMAP_PAIR) {
-
- uint16_t index;
- uint8_t mods = get_mods() | get_weak_mods();
- #ifndef NO_ACTION_ONESHOT
- mods |= get_oneshot_mods();
- #endif
- bool shift = mods & MOD_MASK_SHIFT;
- bool caps = host_keyboard_led_state().caps_lock;
- if (shift ^ caps) {
- index = QK_UNICODEMAP_PAIR_GET_SHIFTED_INDEX(keycode);
- } else {
- index = QK_UNICODEMAP_PAIR_GET_UNSHIFTED_INDEX(keycode);
- }
- return index;
- } else {
-
- return QK_UNICODEMAP_GET_INDEX(keycode);
- }
- }
- bool process_unicodemap(uint16_t keycode, keyrecord_t *record) {
- if (keycode >= QK_UNICODEMAP && keycode <= QK_UNICODEMAP_PAIR_MAX && record->event.pressed) {
- uint32_t code_point = pgm_read_dword(unicode_map + unicodemap_index(keycode));
- register_unicode(code_point);
- }
- return true;
- }
|