From 09add35e7f0b17f720862bc9b0f8478763937328 Mon Sep 17 00:00:00 2001 From: Jack Humbert Date: Wed, 15 Feb 2017 17:09:35 -0500 Subject: add unicode common file, get names right --- quantum/process_keycode/process_unicode_common.h | 130 +++++++++++++++++++++++ 1 file changed, 130 insertions(+) create mode 100644 quantum/process_keycode/process_unicode_common.h (limited to 'quantum/process_keycode/process_unicode_common.h') diff --git a/quantum/process_keycode/process_unicode_common.h b/quantum/process_keycode/process_unicode_common.h new file mode 100644 index 000000000..171ecbca1 --- /dev/null +++ b/quantum/process_keycode/process_unicode_common.h @@ -0,0 +1,130 @@ +#ifndef PROCESS_UNICODE_COMMON_H +#define PROCESS_UNICODE_COMMON_H + +#include "quantum.h" + +#ifndef UNICODE_TYPE_DELAY +#define UNICODE_TYPE_DELAY 10 +#endif + +void set_unicode_input_mode(uint8_t os_target); +uint8_t get_unicode_input_mode(void); +void unicode_input_start(void); +void unicode_input_finish(void); +void register_hex(uint16_t hex); + + +#define UC_OSX 0 // Mac OS X +#define UC_LNX 1 // Linux +#define UC_WIN 2 // Windows 'HexNumpad' +#define UC_BSD 3 // BSD (not implemented) +#define UC_WINC 4 // WinCompose https://github.com/samhocevar/wincompose + +#define UC_BSPC UC(0x0008) + +#define UC_SPC UC(0x0020) + +#define UC_EXLM UC(0x0021) +#define UC_DQUT UC(0x0022) +#define UC_HASH UC(0x0023) +#define UC_DLR UC(0x0024) +#define UC_PERC UC(0x0025) +#define UC_AMPR UC(0x0026) +#define UC_QUOT UC(0x0027) +#define UC_LPRN UC(0x0028) +#define UC_RPRN UC(0x0029) +#define UC_ASTR UC(0x002A) +#define UC_PLUS UC(0x002B) +#define UC_COMM UC(0x002C) +#define UC_DASH UC(0x002D) +#define UC_DOT UC(0x002E) +#define UC_SLSH UC(0x002F) + +#define UC_0 UC(0x0030) +#define UC_1 UC(0x0031) +#define UC_2 UC(0x0032) +#define UC_3 UC(0x0033) +#define UC_4 UC(0x0034) +#define UC_5 UC(0x0035) +#define UC_6 UC(0x0036) +#define UC_7 UC(0x0037) +#define UC_8 UC(0x0038) +#define UC_9 UC(0x0039) + +#define UC_COLN UC(0x003A) +#define UC_SCLN UC(0x003B) +#define UC_LT UC(0x003C) +#define UC_EQL UC(0x003D) +#define UC_GT UC(0x003E) +#define UC_QUES UC(0x003F) +#define UC_AT UC(0x0040) + +#define UC_A UC(0x0041) +#define UC_B UC(0x0042) +#define UC_C UC(0x0043) +#define UC_D UC(0x0044) +#define UC_E UC(0x0045) +#define UC_F UC(0x0046) +#define UC_G UC(0x0047) +#define UC_H UC(0x0048) +#define UC_I UC(0x0049) +#define UC_J UC(0x004A) +#define UC_K UC(0x004B) +#define UC_L UC(0x004C) +#define UC_M UC(0x004D) +#define UC_N UC(0x004E) +#define UC_O UC(0x004F) +#define UC_P UC(0x0050) +#define UC_Q UC(0x0051) +#define UC_R UC(0x0052) +#define UC_S UC(0x0053) +#define UC_T UC(0x0054) +#define UC_U UC(0x0055) +#define UC_V UC(0x0056) +#define UC_W UC(0x0057) +#define UC_X UC(0x0058) +#define UC_Y UC(0x0059) +#define UC_Z UC(0x005A) + +#define UC_LBRC UC(0x005B) +#define UC_BSLS UC(0x005C) +#define UC_RBRC UC(0x005D) +#define UC_CIRM UC(0x005E) +#define UC_UNDR UC(0x005F) + +#define UC_GRV UC(0x0060) + +#define UC_a UC(0x0061) +#define UC_b UC(0x0062) +#define UC_c UC(0x0063) +#define UC_d UC(0x0064) +#define UC_e UC(0x0065) +#define UC_f UC(0x0066) +#define UC_g UC(0x0067) +#define UC_h UC(0x0068) +#define UC_i UC(0x0069) +#define UC_j UC(0x006A) +#define UC_k UC(0x006B) +#define UC_l UC(0x006C) +#define UC_m UC(0x006D) +#define UC_n UC(0x006E) +#define UC_o UC(0x006F) +#define UC_p UC(0x0070) +#define UC_q UC(0x0071) +#define UC_r UC(0x0072) +#define UC_s UC(0x0073) +#define UC_t UC(0x0074) +#define UC_u UC(0x0075) +#define UC_v UC(0x0076) +#define UC_w UC(0x0077) +#define UC_x UC(0x0078) +#define UC_y UC(0x0079) +#define UC_z UC(0x007A) + +#define UC_LCBR UC(0x007B) +#define UC_PIPE UC(0x007C) +#define UC_RCBR UC(0x007D) +#define UC_TILD UC(0x007E) +#define UC_DEL UC(0x007F) + +#endif \ No newline at end of file -- cgit v1.2.3 From c2a9acffd712145dc8b924005feb060c5ac3e2ff Mon Sep 17 00:00:00 2001 From: Jack Humbert Date: Wed, 15 Feb 2017 17:39:51 -0500 Subject: publicise variables --- quantum/process_keycode/process_unicode_common.c | 3 --- quantum/process_keycode/process_unicode_common.h | 4 +++- 2 files changed, 3 insertions(+), 4 deletions(-) (limited to 'quantum/process_keycode/process_unicode_common.h') diff --git a/quantum/process_keycode/process_unicode_common.c b/quantum/process_keycode/process_unicode_common.c index 1a9d470c9..baeee6d08 100644 --- a/quantum/process_keycode/process_unicode_common.c +++ b/quantum/process_keycode/process_unicode_common.c @@ -1,8 +1,5 @@ #include "process_unicode_common.h" -static uint8_t input_mode; -uint8_t mods; - void set_unicode_input_mode(uint8_t os_target) { input_mode = os_target; diff --git a/quantum/process_keycode/process_unicode_common.h b/quantum/process_keycode/process_unicode_common.h index 171ecbca1..9c26cfb07 100644 --- a/quantum/process_keycode/process_unicode_common.h +++ b/quantum/process_keycode/process_unicode_common.h @@ -7,13 +7,15 @@ #define UNICODE_TYPE_DELAY 10 #endif +static uint8_t input_mode; +uint8_t mods; + void set_unicode_input_mode(uint8_t os_target); uint8_t get_unicode_input_mode(void); void unicode_input_start(void); void unicode_input_finish(void); void register_hex(uint16_t hex); - #define UC_OSX 0 // Mac OS X #define UC_LNX 1 // Linux #define UC_WIN 2 // Windows 'HexNumpad' -- cgit v1.2.3 From f89499e255afbe5f8adeae5e71367f3d358af527 Mon Sep 17 00:00:00 2001 From: Jack Humbert Date: Wed, 15 Feb 2017 18:14:07 -0500 Subject: unique variable name --- quantum/process_keycode/process_unicode_common.c | 36 ++++++++++++------------ quantum/process_keycode/process_unicode_common.h | 2 +- 2 files changed, 19 insertions(+), 19 deletions(-) (limited to 'quantum/process_keycode/process_unicode_common.h') diff --git a/quantum/process_keycode/process_unicode_common.c b/quantum/process_keycode/process_unicode_common.c index baeee6d08..d924c364a 100644 --- a/quantum/process_keycode/process_unicode_common.c +++ b/quantum/process_keycode/process_unicode_common.c @@ -12,17 +12,17 @@ uint8_t get_unicode_input_mode(void) { __attribute__((weak)) void unicode_input_start (void) { // save current mods - mods = keyboard_report->mods; + unicode_mods = keyboard_report->mods; // unregister all mods to start from clean state - if (mods & MOD_BIT(KC_LSFT)) unregister_code(KC_LSFT); - if (mods & MOD_BIT(KC_RSFT)) unregister_code(KC_RSFT); - if (mods & MOD_BIT(KC_LCTL)) unregister_code(KC_LCTL); - if (mods & MOD_BIT(KC_RCTL)) unregister_code(KC_RCTL); - if (mods & MOD_BIT(KC_LALT)) unregister_code(KC_LALT); - if (mods & MOD_BIT(KC_RALT)) unregister_code(KC_RALT); - if (mods & MOD_BIT(KC_LGUI)) unregister_code(KC_LGUI); - if (mods & MOD_BIT(KC_RGUI)) unregister_code(KC_RGUI); + if (unicode_mods & MOD_BIT(KC_LSFT)) unregister_code(KC_LSFT); + if (unicode_mods & MOD_BIT(KC_RSFT)) unregister_code(KC_RSFT); + if (unicode_mods & MOD_BIT(KC_LCTL)) unregister_code(KC_LCTL); + if (unicode_mods & MOD_BIT(KC_RCTL)) unregister_code(KC_RCTL); + if (unicode_mods & MOD_BIT(KC_LALT)) unregister_code(KC_LALT); + if (unicode_mods & MOD_BIT(KC_RALT)) unregister_code(KC_RALT); + if (unicode_mods & MOD_BIT(KC_LGUI)) unregister_code(KC_LGUI); + if (unicode_mods & MOD_BIT(KC_RGUI)) unregister_code(KC_RGUI); switch(input_mode) { case UC_OSX: @@ -63,15 +63,15 @@ void unicode_input_finish (void) { break; } - // reregister previously set mods - if (mods & MOD_BIT(KC_LSFT)) register_code(KC_LSFT); - if (mods & MOD_BIT(KC_RSFT)) register_code(KC_RSFT); - if (mods & MOD_BIT(KC_LCTL)) register_code(KC_LCTL); - if (mods & MOD_BIT(KC_RCTL)) register_code(KC_RCTL); - if (mods & MOD_BIT(KC_LALT)) register_code(KC_LALT); - if (mods & MOD_BIT(KC_RALT)) register_code(KC_RALT); - if (mods & MOD_BIT(KC_LGUI)) register_code(KC_LGUI); - if (mods & MOD_BIT(KC_RGUI)) register_code(KC_RGUI); + // reregister previously set unicode_mods + if (unicode_mods & MOD_BIT(KC_LSFT)) register_code(KC_LSFT); + if (unicode_mods & MOD_BIT(KC_RSFT)) register_code(KC_RSFT); + if (unicode_mods & MOD_BIT(KC_LCTL)) register_code(KC_LCTL); + if (unicode_mods & MOD_BIT(KC_RCTL)) register_code(KC_RCTL); + if (unicode_mods & MOD_BIT(KC_LALT)) register_code(KC_LALT); + if (unicode_mods & MOD_BIT(KC_RALT)) register_code(KC_RALT); + if (unicode_mods & MOD_BIT(KC_LGUI)) register_code(KC_LGUI); + if (unicode_mods & MOD_BIT(KC_RGUI)) register_code(KC_RGUI); } void register_hex(uint16_t hex) { diff --git a/quantum/process_keycode/process_unicode_common.h b/quantum/process_keycode/process_unicode_common.h index 9c26cfb07..aa233db22 100644 --- a/quantum/process_keycode/process_unicode_common.h +++ b/quantum/process_keycode/process_unicode_common.h @@ -8,7 +8,7 @@ #endif static uint8_t input_mode; -uint8_t mods; +uint8_t unicode_mods; void set_unicode_input_mode(uint8_t os_target); uint8_t get_unicode_input_mode(void); -- cgit v1.2.3 From 58823b4e0324f5b2861fc5a0f74f6faa3673f5dc Mon Sep 17 00:00:00 2001 From: Jack Humbert Date: Wed, 15 Feb 2017 23:20:35 -0500 Subject: fix weirdness with arm and mods --- quantum/process_keycode/process_unicode_common.c | 38 +++++++++++++----------- quantum/process_keycode/process_unicode_common.h | 1 - 2 files changed, 20 insertions(+), 19 deletions(-) (limited to 'quantum/process_keycode/process_unicode_common.h') diff --git a/quantum/process_keycode/process_unicode_common.c b/quantum/process_keycode/process_unicode_common.c index d924c364a..31bc3b7ab 100644 --- a/quantum/process_keycode/process_unicode_common.c +++ b/quantum/process_keycode/process_unicode_common.c @@ -1,5 +1,7 @@ #include "process_unicode_common.h" +uint8_t mods; + void set_unicode_input_mode(uint8_t os_target) { input_mode = os_target; @@ -12,17 +14,17 @@ uint8_t get_unicode_input_mode(void) { __attribute__((weak)) void unicode_input_start (void) { // save current mods - unicode_mods = keyboard_report->mods; + mods = keyboard_report->mods; // unregister all mods to start from clean state - if (unicode_mods & MOD_BIT(KC_LSFT)) unregister_code(KC_LSFT); - if (unicode_mods & MOD_BIT(KC_RSFT)) unregister_code(KC_RSFT); - if (unicode_mods & MOD_BIT(KC_LCTL)) unregister_code(KC_LCTL); - if (unicode_mods & MOD_BIT(KC_RCTL)) unregister_code(KC_RCTL); - if (unicode_mods & MOD_BIT(KC_LALT)) unregister_code(KC_LALT); - if (unicode_mods & MOD_BIT(KC_RALT)) unregister_code(KC_RALT); - if (unicode_mods & MOD_BIT(KC_LGUI)) unregister_code(KC_LGUI); - if (unicode_mods & MOD_BIT(KC_RGUI)) unregister_code(KC_RGUI); + if (mods & MOD_BIT(KC_LSFT)) unregister_code(KC_LSFT); + if (mods & MOD_BIT(KC_RSFT)) unregister_code(KC_RSFT); + if (mods & MOD_BIT(KC_LCTL)) unregister_code(KC_LCTL); + if (mods & MOD_BIT(KC_RCTL)) unregister_code(KC_RCTL); + if (mods & MOD_BIT(KC_LALT)) unregister_code(KC_LALT); + if (mods & MOD_BIT(KC_RALT)) unregister_code(KC_RALT); + if (mods & MOD_BIT(KC_LGUI)) unregister_code(KC_LGUI); + if (mods & MOD_BIT(KC_RGUI)) unregister_code(KC_RGUI); switch(input_mode) { case UC_OSX: @@ -63,15 +65,15 @@ void unicode_input_finish (void) { break; } - // reregister previously set unicode_mods - if (unicode_mods & MOD_BIT(KC_LSFT)) register_code(KC_LSFT); - if (unicode_mods & MOD_BIT(KC_RSFT)) register_code(KC_RSFT); - if (unicode_mods & MOD_BIT(KC_LCTL)) register_code(KC_LCTL); - if (unicode_mods & MOD_BIT(KC_RCTL)) register_code(KC_RCTL); - if (unicode_mods & MOD_BIT(KC_LALT)) register_code(KC_LALT); - if (unicode_mods & MOD_BIT(KC_RALT)) register_code(KC_RALT); - if (unicode_mods & MOD_BIT(KC_LGUI)) register_code(KC_LGUI); - if (unicode_mods & MOD_BIT(KC_RGUI)) register_code(KC_RGUI); + // reregister previously set mods + if (mods & MOD_BIT(KC_LSFT)) register_code(KC_LSFT); + if (mods & MOD_BIT(KC_RSFT)) register_code(KC_RSFT); + if (mods & MOD_BIT(KC_LCTL)) register_code(KC_LCTL); + if (mods & MOD_BIT(KC_RCTL)) register_code(KC_RCTL); + if (mods & MOD_BIT(KC_LALT)) register_code(KC_LALT); + if (mods & MOD_BIT(KC_RALT)) register_code(KC_RALT); + if (mods & MOD_BIT(KC_LGUI)) register_code(KC_LGUI); + if (mods & MOD_BIT(KC_RGUI)) register_code(KC_RGUI); } void register_hex(uint16_t hex) { diff --git a/quantum/process_keycode/process_unicode_common.h b/quantum/process_keycode/process_unicode_common.h index aa233db22..1f25eae7d 100644 --- a/quantum/process_keycode/process_unicode_common.h +++ b/quantum/process_keycode/process_unicode_common.h @@ -8,7 +8,6 @@ #endif static uint8_t input_mode; -uint8_t unicode_mods; void set_unicode_input_mode(uint8_t os_target); uint8_t get_unicode_input_mode(void); -- cgit v1.2.3