1
0

Move Unicode proccessing to unicode common

This commit is contained in:
Drashna Jaelre
2018-11-02 09:13:08 -07:00
parent a6e66f09ca
commit 9698e3f262
4 changed files with 43 additions and 11 deletions

View File

@@ -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;
}

View File

@@ -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