mirror of
https://github.com/qmk/qmk_firmware.git
synced 2025-07-16 04:41:28 +00:00
Move Unicode proccessing to unicode common
This commit is contained in:
parent
a6e66f09ca
commit
9698e3f262
@ -22,6 +22,7 @@
|
|||||||
unicode_config_t unicode_config;
|
unicode_config_t unicode_config;
|
||||||
static uint8_t saved_mods;
|
static uint8_t saved_mods;
|
||||||
|
|
||||||
|
|
||||||
void set_unicode_input_mode(uint8_t os_target) {
|
void set_unicode_input_mode(uint8_t os_target) {
|
||||||
unicode_config.input_mode = os_target;
|
unicode_config.input_mode = os_target;
|
||||||
eeprom_update_byte(EECONFIG_UNICODEMODE, os_target);
|
eeprom_update_byte(EECONFIG_UNICODEMODE, os_target);
|
||||||
@ -36,7 +37,7 @@ void unicode_input_mode_init(void) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
__attribute__((weak))
|
__attribute__((weak))
|
||||||
void unicode_input_start (void) {
|
void unicode_input_start(void) {
|
||||||
saved_mods = get_mods(); // Save current mods
|
saved_mods = get_mods(); // Save current mods
|
||||||
clear_mods(); // Unregister mods to start from a clean state
|
clear_mods(); // Unregister mods to start from a clean state
|
||||||
|
|
||||||
@ -131,3 +132,35 @@ void send_unicode_hex_string(const char *str) {
|
|||||||
str += n; // Move to the first ' ' (or '\0') after the current token
|
str += n; // Move to the first ' ' (or '\0') after the current token
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool process_record_unicode_common(uint16_t keycode, keyrecord_t *record) {
|
||||||
|
if (record->event.pressed) {
|
||||||
|
switch (keycode) {
|
||||||
|
case UNI_OSX:
|
||||||
|
set_unicode_input_mode(UC_OSX);
|
||||||
|
break;
|
||||||
|
case UNI_LINUX:
|
||||||
|
set_unicode_input_mode(UC_LNX);
|
||||||
|
break;
|
||||||
|
case UNI_WIN:
|
||||||
|
set_unicode_input_mode(UC_WIN);
|
||||||
|
break;
|
||||||
|
case UNI_WINC:
|
||||||
|
set_unicode_input_mode(UC_WINC);
|
||||||
|
break;
|
||||||
|
case UNI_OSX_RALT:
|
||||||
|
set_unicode_input_mode(UC_OSX_RALT);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#ifdef UNICODE_ENABLE
|
||||||
|
return process_unicode(keycode, record);
|
||||||
|
#endif
|
||||||
|
#ifdef UCIS_ENABLE
|
||||||
|
return process_ucis(keycode, record);
|
||||||
|
#endif
|
||||||
|
#ifdef UNICODEMAP_ENABLE
|
||||||
|
return process_unicode_map(keycode, record);
|
||||||
|
#endif
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
@ -38,6 +38,7 @@ void unicode_input_start(void);
|
|||||||
void unicode_input_finish(void);
|
void unicode_input_finish(void);
|
||||||
void register_hex(uint16_t hex);
|
void register_hex(uint16_t hex);
|
||||||
void send_unicode_hex_string(const char *str);
|
void send_unicode_hex_string(const char *str);
|
||||||
|
bool process_record_unicode_common(uint16_t keycode, keyrecord_t *record);
|
||||||
|
|
||||||
#define UC_OSX 0 // Mac OS X
|
#define UC_OSX 0 // Mac OS X
|
||||||
#define UC_LNX 1 // Linux
|
#define UC_LNX 1 // Linux
|
||||||
|
@ -256,27 +256,21 @@ bool process_record_quantum(keyrecord_t *record) {
|
|||||||
#ifdef TAP_DANCE_ENABLE
|
#ifdef TAP_DANCE_ENABLE
|
||||||
process_tap_dance(keycode, record) &&
|
process_tap_dance(keycode, record) &&
|
||||||
#endif
|
#endif
|
||||||
|
#if (defined(UNICODE_ENABLE) || defined(UNICODEMAP_ENABLE) || defined(UCIS_ENABLE))
|
||||||
|
process_record_unicode_common(keycode, record) &&
|
||||||
|
#endif
|
||||||
#ifdef LEADER_ENABLE
|
#ifdef LEADER_ENABLE
|
||||||
process_leader(keycode, record) &&
|
process_leader(keycode, record) &&
|
||||||
#endif
|
#endif
|
||||||
#ifdef COMBO_ENABLE
|
#ifdef COMBO_ENABLE
|
||||||
process_combo(keycode, record) &&
|
process_combo(keycode, record) &&
|
||||||
#endif
|
#endif
|
||||||
#ifdef UNICODE_ENABLE
|
|
||||||
process_unicode(keycode, record) &&
|
|
||||||
#endif
|
|
||||||
#ifdef UCIS_ENABLE
|
|
||||||
process_ucis(keycode, record) &&
|
|
||||||
#endif
|
|
||||||
#ifdef PRINTING_ENABLE
|
#ifdef PRINTING_ENABLE
|
||||||
process_printer(keycode, record) &&
|
process_printer(keycode, record) &&
|
||||||
#endif
|
#endif
|
||||||
#ifdef AUTO_SHIFT_ENABLE
|
#ifdef AUTO_SHIFT_ENABLE
|
||||||
process_auto_shift(keycode, record) &&
|
process_auto_shift(keycode, record) &&
|
||||||
#endif
|
#endif
|
||||||
#ifdef UNICODEMAP_ENABLE
|
|
||||||
process_unicode_map(keycode, record) &&
|
|
||||||
#endif
|
|
||||||
#ifdef TERMINAL_ENABLE
|
#ifdef TERMINAL_ENABLE
|
||||||
process_terminal(keycode, record) &&
|
process_terminal(keycode, record) &&
|
||||||
#endif
|
#endif
|
||||||
|
@ -453,7 +453,11 @@ enum quantum_keycodes {
|
|||||||
TERM_ON,
|
TERM_ON,
|
||||||
TERM_OFF,
|
TERM_OFF,
|
||||||
#endif
|
#endif
|
||||||
|
UNI_OSX,
|
||||||
|
UNI_LINUX,
|
||||||
|
UNI_WIN,
|
||||||
|
UNI_WINC,
|
||||||
|
UNI_OSX_RALT,
|
||||||
// always leave at the end
|
// always leave at the end
|
||||||
SAFE_RANGE
|
SAFE_RANGE
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user