Move Unicode proccessing to unicode common

pull/4217/head
Drashna Jaelre 7 years ago
parent a6e66f09ca
commit 9698e3f262
No known key found for this signature in database
GPG Key ID: 4C4221222CD5F9F0

@ -22,6 +22,7 @@
unicode_config_t unicode_config;
static uint8_t saved_mods;
void set_unicode_input_mode(uint8_t os_target) {
unicode_config.input_mode = os_target;
eeprom_update_byte(EECONFIG_UNICODEMODE, os_target);
@ -36,7 +37,7 @@ void unicode_input_mode_init(void) {
}
__attribute__((weak))
void unicode_input_start (void) {
void unicode_input_start(void) {
saved_mods = get_mods(); // Save current mods
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
}
}
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 register_hex(uint16_t hex);
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_LNX 1 // Linux

@ -256,27 +256,21 @@ bool process_record_quantum(keyrecord_t *record) {
#ifdef TAP_DANCE_ENABLE
process_tap_dance(keycode, record) &&
#endif
#if (defined(UNICODE_ENABLE) || defined(UNICODEMAP_ENABLE) || defined(UCIS_ENABLE))
process_record_unicode_common(keycode, record) &&
#endif
#ifdef LEADER_ENABLE
process_leader(keycode, record) &&
#endif
#ifdef COMBO_ENABLE
process_combo(keycode, record) &&
#endif
#ifdef UNICODE_ENABLE
process_unicode(keycode, record) &&
#endif
#ifdef UCIS_ENABLE
process_ucis(keycode, record) &&
#endif
#ifdef PRINTING_ENABLE
process_printer(keycode, record) &&
#endif
#ifdef AUTO_SHIFT_ENABLE
process_auto_shift(keycode, record) &&
#endif
#ifdef UNICODEMAP_ENABLE
process_unicode_map(keycode, record) &&
#endif
#ifdef TERMINAL_ENABLE
process_terminal(keycode, record) &&
#endif

@ -453,7 +453,11 @@ enum quantum_keycodes {
TERM_ON,
TERM_OFF,
#endif
UNI_OSX,
UNI_LINUX,
UNI_WIN,
UNI_WINC,
UNI_OSX_RALT,
// always leave at the end
SAFE_RANGE
};

Loading…
Cancel
Save