1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253 |
- #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 = keycode - QK_UNICODEMAP_PAIR;
- 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 >>= 7;
- }
- return index & 0x7F;
- } else {
-
- return keycode - QK_UNICODEMAP;
- }
- }
- 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;
- }
|