diff options
Diffstat (limited to 'quantum/process_keycode')
| -rw-r--r-- | quantum/process_keycode/process_auto_shift.c | 24 | ||||
| -rw-r--r-- | quantum/process_keycode/process_haptic.c | 30 | ||||
| -rw-r--r-- | quantum/process_keycode/process_music.c | 6 | ||||
| -rw-r--r-- | quantum/process_keycode/process_printer.c | 32 | ||||
| -rw-r--r-- | quantum/process_keycode/process_printer_bb.c | 32 | ||||
| -rw-r--r-- | quantum/process_keycode/process_programmable_button.c | 31 | ||||
| -rw-r--r-- | quantum/process_keycode/process_programmable_button.h | 23 | ||||
| -rw-r--r-- | quantum/process_keycode/process_space_cadet.c | 24 | ||||
| -rw-r--r-- | quantum/process_keycode/process_terminal.c | 10 | ||||
| -rw-r--r-- | quantum/process_keycode/process_ucis.c | 18 | ||||
| -rw-r--r-- | quantum/process_keycode/process_unicode_common.c | 53 | ||||
| -rw-r--r-- | quantum/process_keycode/process_unicode_common.h | 4 |
12 files changed, 188 insertions, 99 deletions
diff --git a/quantum/process_keycode/process_auto_shift.c b/quantum/process_keycode/process_auto_shift.c index 51b0efdb4..4d928edb5 100644 --- a/quantum/process_keycode/process_auto_shift.c +++ b/quantum/process_keycode/process_auto_shift.c | |||
| @@ -21,6 +21,12 @@ | |||
| 21 | 21 | ||
| 22 | # include "process_auto_shift.h" | 22 | # include "process_auto_shift.h" |
| 23 | 23 | ||
| 24 | # ifndef AUTO_SHIFT_DISABLED_AT_STARTUP | ||
| 25 | # define AUTO_SHIFT_STARTUP_STATE true /* enabled */ | ||
| 26 | # else | ||
| 27 | # define AUTO_SHIFT_STARTUP_STATE false /* disabled */ | ||
| 28 | # endif | ||
| 29 | |||
| 24 | static uint16_t autoshift_time = 0; | 30 | static uint16_t autoshift_time = 0; |
| 25 | static uint16_t autoshift_timeout = AUTO_SHIFT_TIMEOUT; | 31 | static uint16_t autoshift_timeout = AUTO_SHIFT_TIMEOUT; |
| 26 | static uint16_t autoshift_lastkey = KC_NO; | 32 | static uint16_t autoshift_lastkey = KC_NO; |
| @@ -34,7 +40,7 @@ static struct { | |||
| 34 | bool in_progress : 1; | 40 | bool in_progress : 1; |
| 35 | // Whether the auto-shifted keypress has been registered. | 41 | // Whether the auto-shifted keypress has been registered. |
| 36 | bool holding_shift : 1; | 42 | bool holding_shift : 1; |
| 37 | } autoshift_flags = {true, false, false, false}; | 43 | } autoshift_flags = {AUTO_SHIFT_STARTUP_STATE, false, false, false}; |
| 38 | 44 | ||
| 39 | /** \brief Record the press of an autoshiftable key | 45 | /** \brief Record the press of an autoshiftable key |
| 40 | * | 46 | * |
| @@ -61,7 +67,7 @@ static bool autoshift_press(uint16_t keycode, uint16_t now, keyrecord_t *record) | |||
| 61 | register_code(autoshift_lastkey); | 67 | register_code(autoshift_lastkey); |
| 62 | } else { | 68 | } else { |
| 63 | // Simulate pressing the shift key. | 69 | // Simulate pressing the shift key. |
| 64 | add_weak_mods(MOD_BIT(KC_LSFT)); | 70 | add_weak_mods(MOD_BIT(KC_LEFT_SHIFT)); |
| 65 | register_code(autoshift_lastkey); | 71 | register_code(autoshift_lastkey); |
| 66 | } | 72 | } |
| 67 | return false; | 73 | return false; |
| @@ -102,7 +108,7 @@ static void autoshift_end(uint16_t keycode, uint16_t now, bool matrix_trigger) { | |||
| 102 | autoshift_flags.lastshifted = false; | 108 | autoshift_flags.lastshifted = false; |
| 103 | } else { | 109 | } else { |
| 104 | // Simulate pressing the shift key. | 110 | // Simulate pressing the shift key. |
| 105 | add_weak_mods(MOD_BIT(KC_LSFT)); | 111 | add_weak_mods(MOD_BIT(KC_LEFT_SHIFT)); |
| 106 | register_code(autoshift_lastkey); | 112 | register_code(autoshift_lastkey); |
| 107 | autoshift_flags.lastshifted = true; | 113 | autoshift_flags.lastshifted = true; |
| 108 | # if defined(AUTO_SHIFT_REPEAT) && !defined(AUTO_SHIFT_NO_AUTO_REPEAT) | 114 | # if defined(AUTO_SHIFT_REPEAT) && !defined(AUTO_SHIFT_NO_AUTO_REPEAT) |
| @@ -117,7 +123,7 @@ static void autoshift_end(uint16_t keycode, uint16_t now, bool matrix_trigger) { | |||
| 117 | wait_ms(TAP_CODE_DELAY); | 123 | wait_ms(TAP_CODE_DELAY); |
| 118 | # endif | 124 | # endif |
| 119 | unregister_code(autoshift_lastkey); | 125 | unregister_code(autoshift_lastkey); |
| 120 | del_weak_mods(MOD_BIT(KC_LSFT)); | 126 | del_weak_mods(MOD_BIT(KC_LEFT_SHIFT)); |
| 121 | } else { | 127 | } else { |
| 122 | // Release after keyrepeat. | 128 | // Release after keyrepeat. |
| 123 | unregister_code(keycode); | 129 | unregister_code(keycode); |
| @@ -125,7 +131,7 @@ static void autoshift_end(uint16_t keycode, uint16_t now, bool matrix_trigger) { | |||
| 125 | // This will only fire when the key was the last auto-shiftable | 131 | // This will only fire when the key was the last auto-shiftable |
| 126 | // pressed. That prevents aaaaBBBB then releasing a from unshifting | 132 | // pressed. That prevents aaaaBBBB then releasing a from unshifting |
| 127 | // later Bs (if B wasn't auto-shiftable). | 133 | // later Bs (if B wasn't auto-shiftable). |
| 128 | del_weak_mods(MOD_BIT(KC_LSFT)); | 134 | del_weak_mods(MOD_BIT(KC_LEFT_SHIFT)); |
| 129 | } | 135 | } |
| 130 | } | 136 | } |
| 131 | send_keyboard_report(); // del_weak_mods doesn't send one. | 137 | send_keyboard_report(); // del_weak_mods doesn't send one. |
| @@ -151,14 +157,14 @@ void autoshift_matrix_scan(void) { | |||
| 151 | 157 | ||
| 152 | void autoshift_toggle(void) { | 158 | void autoshift_toggle(void) { |
| 153 | autoshift_flags.enabled = !autoshift_flags.enabled; | 159 | autoshift_flags.enabled = !autoshift_flags.enabled; |
| 154 | del_weak_mods(MOD_BIT(KC_LSFT)); | 160 | del_weak_mods(MOD_BIT(KC_LEFT_SHIFT)); |
| 155 | } | 161 | } |
| 156 | 162 | ||
| 157 | void autoshift_enable(void) { autoshift_flags.enabled = true; } | 163 | void autoshift_enable(void) { autoshift_flags.enabled = true; } |
| 158 | 164 | ||
| 159 | void autoshift_disable(void) { | 165 | void autoshift_disable(void) { |
| 160 | autoshift_flags.enabled = false; | 166 | autoshift_flags.enabled = false; |
| 161 | del_weak_mods(MOD_BIT(KC_LSFT)); | 167 | del_weak_mods(MOD_BIT(KC_LEFT_SHIFT)); |
| 162 | } | 168 | } |
| 163 | 169 | ||
| 164 | # ifndef AUTO_SHIFT_NO_SETUP | 170 | # ifndef AUTO_SHIFT_NO_SETUP |
| @@ -189,7 +195,7 @@ bool process_auto_shift(uint16_t keycode, keyrecord_t *record) { | |||
| 189 | autoshift_end(KC_NO, now, false); | 195 | autoshift_end(KC_NO, now, false); |
| 190 | } | 196 | } |
| 191 | // For pressing another key while keyrepeating shifted autoshift. | 197 | // For pressing another key while keyrepeating shifted autoshift. |
| 192 | del_weak_mods(MOD_BIT(KC_LSFT)); | 198 | del_weak_mods(MOD_BIT(KC_LEFT_SHIFT)); |
| 193 | 199 | ||
| 194 | switch (keycode) { | 200 | switch (keycode) { |
| 195 | case KC_ASTG: | 201 | case KC_ASTG: |
| @@ -238,7 +244,7 @@ __attribute__((weak)) bool get_auto_shifted_key(uint16_t keycode, keyrecord_t *r | |||
| 238 | # ifndef NO_AUTO_SHIFT_SPECIAL | 244 | # ifndef NO_AUTO_SHIFT_SPECIAL |
| 239 | case KC_TAB: | 245 | case KC_TAB: |
| 240 | case KC_MINUS ... KC_SLASH: | 246 | case KC_MINUS ... KC_SLASH: |
| 241 | case KC_NONUS_BSLASH: | 247 | case KC_NONUS_BACKSLASH: |
| 242 | # endif | 248 | # endif |
| 243 | return true; | 249 | return true; |
| 244 | } | 250 | } |
diff --git a/quantum/process_keycode/process_haptic.c b/quantum/process_keycode/process_haptic.c index 64d455d00..85b2ffcdd 100644 --- a/quantum/process_keycode/process_haptic.c +++ b/quantum/process_keycode/process_haptic.c | |||
| @@ -17,6 +17,7 @@ | |||
| 17 | #include "process_haptic.h" | 17 | #include "process_haptic.h" |
| 18 | #include "quantum_keycodes.h" | 18 | #include "quantum_keycodes.h" |
| 19 | #include "action_tapping.h" | 19 | #include "action_tapping.h" |
| 20 | #include "usb_device_state.h" | ||
| 20 | 21 | ||
| 21 | __attribute__((weak)) bool get_haptic_enabled_key(uint16_t keycode, keyrecord_t *record) { | 22 | __attribute__((weak)) bool get_haptic_enabled_key(uint16_t keycode, keyrecord_t *record) { |
| 22 | switch (keycode) { | 23 | switch (keycode) { |
| @@ -30,8 +31,9 @@ __attribute__((weak)) bool get_haptic_enabled_key(uint16_t keycode, keyrecord_t | |||
| 30 | case QK_LAYER_TAP ... QK_LAYER_TAP_MAX: | 31 | case QK_LAYER_TAP ... QK_LAYER_TAP_MAX: |
| 31 | if (record->tap.count == 0) return false; | 32 | if (record->tap.count == 0) return false; |
| 32 | break; | 33 | break; |
| 33 | case KC_LCTRL ... KC_RGUI: | 34 | case KC_LEFT_CTRL ... KC_RIGHT_GUI: |
| 34 | case QK_MOMENTARY ... QK_MOMENTARY_MAX: | 35 | case QK_MOMENTARY ... QK_MOMENTARY_MAX: |
| 36 | case QK_LAYER_MOD ... QK_LAYER_MOD_MAX: | ||
| 35 | #endif | 37 | #endif |
| 36 | #ifdef NO_HAPTIC_FN | 38 | #ifdef NO_HAPTIC_FN |
| 37 | case KC_FN0 ... KC_FN31: | 39 | case KC_FN0 ... KC_FN31: |
| @@ -42,34 +44,34 @@ __attribute__((weak)) bool get_haptic_enabled_key(uint16_t keycode, keyrecord_t | |||
| 42 | #ifdef NO_HAPTIC_PUNCTUATION | 44 | #ifdef NO_HAPTIC_PUNCTUATION |
| 43 | case KC_ENTER: | 45 | case KC_ENTER: |
| 44 | case KC_ESCAPE: | 46 | case KC_ESCAPE: |
| 45 | case KC_BSPACE: | 47 | case KC_BACKSPACE: |
| 46 | case KC_SPACE: | 48 | case KC_SPACE: |
| 47 | case KC_MINUS: | 49 | case KC_MINUS: |
| 48 | case KC_EQUAL: | 50 | case KC_EQUAL: |
| 49 | case KC_LBRACKET: | 51 | case KC_LEFT_BRACKET: |
| 50 | case KC_RBRACKET: | 52 | case KC_RIGHT_BRACKET: |
| 51 | case KC_BSLASH: | 53 | case KC_BACKSLASH: |
| 52 | case KC_NONUS_HASH: | 54 | case KC_NONUS_HASH: |
| 53 | case KC_SCOLON: | 55 | case KC_SEMICOLON: |
| 54 | case KC_QUOTE: | 56 | case KC_QUOTE: |
| 55 | case KC_GRAVE: | 57 | case KC_GRAVE: |
| 56 | case KC_COMMA: | 58 | case KC_COMMA: |
| 57 | case KC_SLASH: | 59 | case KC_SLASH: |
| 58 | case KC_DOT: | 60 | case KC_DOT: |
| 59 | case KC_NONUS_BSLASH: | 61 | case KC_NONUS_BACKSLASH: |
| 60 | #endif | 62 | #endif |
| 61 | #ifdef NO_HAPTIC_LOCKKEYS | 63 | #ifdef NO_HAPTIC_LOCKKEYS |
| 62 | case KC_CAPSLOCK: | 64 | case KC_CAPS_LOCK: |
| 63 | case KC_SCROLLLOCK: | 65 | case KC_SCROLL_LOCK: |
| 64 | case KC_NUMLOCK: | 66 | case KC_NUM_LOCK: |
| 65 | #endif | 67 | #endif |
| 66 | #ifdef NO_HAPTIC_NAV | 68 | #ifdef NO_HAPTIC_NAV |
| 67 | case KC_PSCREEN: | 69 | case KC_PRINT_SCREEN: |
| 68 | case KC_PAUSE: | 70 | case KC_PAUSE: |
| 69 | case KC_INSERT: | 71 | case KC_INSERT: |
| 70 | case KC_DELETE: | 72 | case KC_DELETE: |
| 71 | case KC_PGDOWN: | 73 | case KC_PAGE_DOWN: |
| 72 | case KC_PGUP: | 74 | case KC_PAGE_UP: |
| 73 | case KC_LEFT: | 75 | case KC_LEFT: |
| 74 | case KC_UP: | 76 | case KC_UP: |
| 75 | case KC_RIGHT: | 77 | case KC_RIGHT: |
| @@ -130,7 +132,7 @@ bool process_haptic(uint16_t keycode, keyrecord_t *record) { | |||
| 130 | } | 132 | } |
| 131 | } | 133 | } |
| 132 | 134 | ||
| 133 | if (haptic_get_enable()) { | 135 | if (haptic_get_enable() && ((!HAPTIC_OFF_IN_LOW_POWER) || (usb_device_state == USB_DEVICE_STATE_CONFIGURED))) { |
| 134 | if (record->event.pressed) { | 136 | if (record->event.pressed) { |
| 135 | // keypress | 137 | // keypress |
| 136 | if (haptic_get_feedback() < 2 && get_haptic_enabled_key(keycode, record)) { | 138 | if (haptic_get_feedback() < 2 && get_haptic_enabled_key(keycode, record)) { |
diff --git a/quantum/process_keycode/process_music.c b/quantum/process_keycode/process_music.c index 2beccbd8f..6822c5e28 100644 --- a/quantum/process_keycode/process_music.c +++ b/quantum/process_keycode/process_music.c | |||
| @@ -146,7 +146,7 @@ bool process_music(uint16_t keycode, keyrecord_t *record) { | |||
| 146 | 146 | ||
| 147 | if (music_activated || midi_activated) { | 147 | if (music_activated || midi_activated) { |
| 148 | if (record->event.pressed) { | 148 | if (record->event.pressed) { |
| 149 | if (keycode == KC_LCTL) { // Start recording | 149 | if (keycode == KC_LEFT_CTRL) { // Start recording |
| 150 | music_all_notes_off(); | 150 | music_all_notes_off(); |
| 151 | music_sequence_recording = true; | 151 | music_sequence_recording = true; |
| 152 | music_sequence_recorded = false; | 152 | music_sequence_recorded = false; |
| @@ -155,7 +155,7 @@ bool process_music(uint16_t keycode, keyrecord_t *record) { | |||
| 155 | return false; | 155 | return false; |
| 156 | } | 156 | } |
| 157 | 157 | ||
| 158 | if (keycode == KC_LALT) { // Stop recording/playing | 158 | if (keycode == KC_LEFT_ALT) { // Stop recording/playing |
| 159 | music_all_notes_off(); | 159 | music_all_notes_off(); |
| 160 | if (music_sequence_recording) { // was recording | 160 | if (music_sequence_recording) { // was recording |
| 161 | music_sequence_recorded = true; | 161 | music_sequence_recorded = true; |
| @@ -165,7 +165,7 @@ bool process_music(uint16_t keycode, keyrecord_t *record) { | |||
| 165 | return false; | 165 | return false; |
| 166 | } | 166 | } |
| 167 | 167 | ||
| 168 | if (keycode == KC_LGUI && music_sequence_recorded) { // Start playing | 168 | if (keycode == KC_LEFT_GUI && music_sequence_recorded) { // Start playing |
| 169 | music_all_notes_off(); | 169 | music_all_notes_off(); |
| 170 | music_sequence_recording = false; | 170 | music_sequence_recording = false; |
| 171 | music_sequence_playing = true; | 171 | music_sequence_playing = true; |
diff --git a/quantum/process_keycode/process_printer.c b/quantum/process_keycode/process_printer.c index 7c5e4169a..82528cc68 100644 --- a/quantum/process_keycode/process_printer.c +++ b/quantum/process_keycode/process_printer.c | |||
| @@ -31,7 +31,7 @@ uint8_t shifted_numbers[10] = {0x21, 0x40, 0x23, 0x24, 0x25, 0x5E, 0x26, 0x2A, 0 | |||
| 31 | 31 | ||
| 32 | // uint8_t keycode_to_ascii[0xFF][2]; | 32 | // uint8_t keycode_to_ascii[0xFF][2]; |
| 33 | 33 | ||
| 34 | // keycode_to_ascii[KC_MINS] = {0x2D, 0x5F}; | 34 | // keycode_to_ascii[KC_MINUS] = {0x2D, 0x5F}; |
| 35 | 35 | ||
| 36 | void print_char(char c) { | 36 | void print_char(char c) { |
| 37 | USB_Disable(); | 37 | USB_Disable(); |
| @@ -90,8 +90,8 @@ bool process_printer(uint16_t keycode, keyrecord_t *record) { | |||
| 90 | case KC_PIPE: | 90 | case KC_PIPE: |
| 91 | case KC_TILD: | 91 | case KC_TILD: |
| 92 | keycode &= 0xFF; | 92 | keycode &= 0xFF; |
| 93 | case KC_LSFT: | 93 | case KC_LEFT_SHIFT: |
| 94 | case KC_RSFT: | 94 | case KC_RIGHT_SHIFT: |
| 95 | if (record->event.pressed) { | 95 | if (record->event.pressed) { |
| 96 | character_shift++; | 96 | character_shift++; |
| 97 | } else { | 97 | } else { |
| @@ -107,13 +107,13 @@ bool process_printer(uint16_t keycode, keyrecord_t *record) { | |||
| 107 | print_box_string("This is a line of text!"); | 107 | print_box_string("This is a line of text!"); |
| 108 | } | 108 | } |
| 109 | return false; | 109 | return false; |
| 110 | case KC_ESC: | 110 | case KC_ESCAPE: |
| 111 | if (record->event.pressed) { | 111 | if (record->event.pressed) { |
| 112 | print_char(0x1B); | 112 | print_char(0x1B); |
| 113 | } | 113 | } |
| 114 | return false; | 114 | return false; |
| 115 | break; | 115 | break; |
| 116 | case KC_SPC: | 116 | case KC_SPACE: |
| 117 | if (record->event.pressed) { | 117 | if (record->event.pressed) { |
| 118 | print_char(0x20); | 118 | print_char(0x20); |
| 119 | } | 119 | } |
| @@ -139,7 +139,7 @@ bool process_printer(uint16_t keycode, keyrecord_t *record) { | |||
| 139 | } | 139 | } |
| 140 | return false; | 140 | return false; |
| 141 | break; | 141 | break; |
| 142 | case KC_ENT: | 142 | case KC_ENTER: |
| 143 | if (record->event.pressed) { | 143 | if (record->event.pressed) { |
| 144 | if (character_shift) { | 144 | if (character_shift) { |
| 145 | print_char(0x0C); | 145 | print_char(0x0C); |
| @@ -149,7 +149,7 @@ bool process_printer(uint16_t keycode, keyrecord_t *record) { | |||
| 149 | } | 149 | } |
| 150 | return false; | 150 | return false; |
| 151 | break; | 151 | break; |
| 152 | case KC_BSPC: | 152 | case KC_BACKSPACE: |
| 153 | if (record->event.pressed) { | 153 | if (record->event.pressed) { |
| 154 | if (character_shift) { | 154 | if (character_shift) { |
| 155 | print_char(0x18); | 155 | print_char(0x18); |
| @@ -169,7 +169,7 @@ bool process_printer(uint16_t keycode, keyrecord_t *record) { | |||
| 169 | } | 169 | } |
| 170 | return false; | 170 | return false; |
| 171 | break; | 171 | break; |
| 172 | case KC_COMM: | 172 | case KC_COMMA: |
| 173 | if (record->event.pressed) { | 173 | if (record->event.pressed) { |
| 174 | if (character_shift) { | 174 | if (character_shift) { |
| 175 | print_char(0x3C); | 175 | print_char(0x3C); |
| @@ -179,7 +179,7 @@ bool process_printer(uint16_t keycode, keyrecord_t *record) { | |||
| 179 | } | 179 | } |
| 180 | return false; | 180 | return false; |
| 181 | break; | 181 | break; |
| 182 | case KC_SLSH: | 182 | case KC_SLASH: |
| 183 | if (record->event.pressed) { | 183 | if (record->event.pressed) { |
| 184 | if (character_shift) { | 184 | if (character_shift) { |
| 185 | print_char(0x3F); | 185 | print_char(0x3F); |
| @@ -189,7 +189,7 @@ bool process_printer(uint16_t keycode, keyrecord_t *record) { | |||
| 189 | } | 189 | } |
| 190 | return false; | 190 | return false; |
| 191 | break; | 191 | break; |
| 192 | case KC_QUOT: | 192 | case KC_QUOTE: |
| 193 | if (record->event.pressed) { | 193 | if (record->event.pressed) { |
| 194 | if (character_shift) { | 194 | if (character_shift) { |
| 195 | print_char(0x22); | 195 | print_char(0x22); |
| @@ -199,7 +199,7 @@ bool process_printer(uint16_t keycode, keyrecord_t *record) { | |||
| 199 | } | 199 | } |
| 200 | return false; | 200 | return false; |
| 201 | break; | 201 | break; |
| 202 | case KC_GRV: | 202 | case KC_GRAVE: |
| 203 | if (record->event.pressed) { | 203 | if (record->event.pressed) { |
| 204 | if (character_shift) { | 204 | if (character_shift) { |
| 205 | print_char(0x7E); | 205 | print_char(0x7E); |
| @@ -209,7 +209,7 @@ bool process_printer(uint16_t keycode, keyrecord_t *record) { | |||
| 209 | } | 209 | } |
| 210 | return false; | 210 | return false; |
| 211 | break; | 211 | break; |
| 212 | case KC_MINS: | 212 | case KC_MINUS: |
| 213 | if (record->event.pressed) { | 213 | if (record->event.pressed) { |
| 214 | if (character_shift) { | 214 | if (character_shift) { |
| 215 | print_char(0x5F); | 215 | print_char(0x5F); |
| @@ -219,7 +219,7 @@ bool process_printer(uint16_t keycode, keyrecord_t *record) { | |||
| 219 | } | 219 | } |
| 220 | return false; | 220 | return false; |
| 221 | break; | 221 | break; |
| 222 | case KC_EQL: | 222 | case KC_EQUAL: |
| 223 | if (record->event.pressed) { | 223 | if (record->event.pressed) { |
| 224 | if (character_shift) { | 224 | if (character_shift) { |
| 225 | print_char(0x2B); | 225 | print_char(0x2B); |
| @@ -229,7 +229,7 @@ bool process_printer(uint16_t keycode, keyrecord_t *record) { | |||
| 229 | } | 229 | } |
| 230 | return false; | 230 | return false; |
| 231 | break; | 231 | break; |
| 232 | case KC_LBRC: | 232 | case KC_LEFT_BRACKET: |
| 233 | if (record->event.pressed) { | 233 | if (record->event.pressed) { |
| 234 | if (character_shift) { | 234 | if (character_shift) { |
| 235 | print_char(0x7B); | 235 | print_char(0x7B); |
| @@ -239,7 +239,7 @@ bool process_printer(uint16_t keycode, keyrecord_t *record) { | |||
| 239 | } | 239 | } |
| 240 | return false; | 240 | return false; |
| 241 | break; | 241 | break; |
| 242 | case KC_RBRC: | 242 | case KC_RIGHT_BRACKET: |
| 243 | if (record->event.pressed) { | 243 | if (record->event.pressed) { |
| 244 | if (character_shift) { | 244 | if (character_shift) { |
| 245 | print_char(0x7D); | 245 | print_char(0x7D); |
| @@ -249,7 +249,7 @@ bool process_printer(uint16_t keycode, keyrecord_t *record) { | |||
| 249 | } | 249 | } |
| 250 | return false; | 250 | return false; |
| 251 | break; | 251 | break; |
| 252 | case KC_BSLS: | 252 | case KC_BACKSLASH: |
| 253 | if (record->event.pressed) { | 253 | if (record->event.pressed) { |
| 254 | if (character_shift) { | 254 | if (character_shift) { |
| 255 | print_char(0x7C); | 255 | print_char(0x7C); |
diff --git a/quantum/process_keycode/process_printer_bb.c b/quantum/process_keycode/process_printer_bb.c index e482d8259..6c91bd27e 100644 --- a/quantum/process_keycode/process_printer_bb.c +++ b/quantum/process_keycode/process_printer_bb.c | |||
| @@ -45,7 +45,7 @@ uint8_t shifted_numbers[10] = {0x21, 0x40, 0x23, 0x24, 0x25, 0x5E, 0x26, 0x2A, 0 | |||
| 45 | 45 | ||
| 46 | // uint8_t keycode_to_ascii[0xFF][2]; | 46 | // uint8_t keycode_to_ascii[0xFF][2]; |
| 47 | 47 | ||
| 48 | // keycode_to_ascii[KC_MINS] = {0x2D, 0x5F}; | 48 | // keycode_to_ascii[KC_MINUS] = {0x2D, 0x5F}; |
| 49 | 49 | ||
| 50 | void print_char(char c) { | 50 | void print_char(char c) { |
| 51 | uint8_t b = 8; | 51 | uint8_t b = 8; |
| @@ -84,8 +84,8 @@ bool process_printer(uint16_t keycode, keyrecord_t *record) { | |||
| 84 | case KC_PIPE: | 84 | case KC_PIPE: |
| 85 | case KC_TILD: | 85 | case KC_TILD: |
| 86 | keycode &= 0xFF; | 86 | keycode &= 0xFF; |
| 87 | case KC_LSFT: | 87 | case KC_LEFT_SHIFT: |
| 88 | case KC_RSFT: | 88 | case KC_RIGHT_SHIFT: |
| 89 | if (record->event.pressed) { | 89 | if (record->event.pressed) { |
| 90 | character_shift++; | 90 | character_shift++; |
| 91 | } else { | 91 | } else { |
| @@ -101,13 +101,13 @@ bool process_printer(uint16_t keycode, keyrecord_t *record) { | |||
| 101 | print_string("This is a line of text!\n\n\n"); | 101 | print_string("This is a line of text!\n\n\n"); |
| 102 | } | 102 | } |
| 103 | return false; | 103 | return false; |
| 104 | case KC_ESC: | 104 | case KC_ESCAPE: |
| 105 | if (record->event.pressed) { | 105 | if (record->event.pressed) { |
| 106 | print_char(0x1B); | 106 | print_char(0x1B); |
| 107 | } | 107 | } |
| 108 | return false; | 108 | return false; |
| 109 | break; | 109 | break; |
| 110 | case KC_SPC: | 110 | case KC_SPACE: |
| 111 | if (record->event.pressed) { | 111 | if (record->event.pressed) { |
| 112 | print_char(0x20); | 112 | print_char(0x20); |
| 113 | } | 113 | } |
| @@ -133,7 +133,7 @@ bool process_printer(uint16_t keycode, keyrecord_t *record) { | |||
| 133 | } | 133 | } |
| 134 | return false; | 134 | return false; |
| 135 | break; | 135 | break; |
| 136 | case KC_ENT: | 136 | case KC_ENTER: |
| 137 | if (record->event.pressed) { | 137 | if (record->event.pressed) { |
| 138 | if (character_shift) { | 138 | if (character_shift) { |
| 139 | print_char(0x0C); | 139 | print_char(0x0C); |
| @@ -143,7 +143,7 @@ bool process_printer(uint16_t keycode, keyrecord_t *record) { | |||
| 143 | } | 143 | } |
| 144 | return false; | 144 | return false; |
| 145 | break; | 145 | break; |
| 146 | case KC_BSPC: | 146 | case KC_BACKSPACE: |
| 147 | if (record->event.pressed) { | 147 | if (record->event.pressed) { |
| 148 | if (character_shift) { | 148 | if (character_shift) { |
| 149 | print_char(0x18); | 149 | print_char(0x18); |
| @@ -163,7 +163,7 @@ bool process_printer(uint16_t keycode, keyrecord_t *record) { | |||
| 163 | } | 163 | } |
| 164 | return false; | 164 | return false; |
| 165 | break; | 165 | break; |
| 166 | case KC_COMM: | 166 | case KC_COMMA: |
| 167 | if (record->event.pressed) { | 167 | if (record->event.pressed) { |
| 168 | if (character_shift) { | 168 | if (character_shift) { |
| 169 | print_char(0x3C); | 169 | print_char(0x3C); |
| @@ -173,7 +173,7 @@ bool process_printer(uint16_t keycode, keyrecord_t *record) { | |||
| 173 | } | 173 | } |
| 174 | return false; | 174 | return false; |
| 175 | break; | 175 | break; |
| 176 | case KC_SLSH: | 176 | case KC_SLASH: |
| 177 | if (record->event.pressed) { | 177 | if (record->event.pressed) { |
| 178 | if (character_shift) { | 178 | if (character_shift) { |
| 179 | print_char(0x3F); | 179 | print_char(0x3F); |
| @@ -183,7 +183,7 @@ bool process_printer(uint16_t keycode, keyrecord_t *record) { | |||
| 183 | } | 183 | } |
| 184 | return false; | 184 | return false; |
| 185 | break; | 185 | break; |
| 186 | case KC_QUOT: | 186 | case KC_QUOTE: |
| 187 | if (record->event.pressed) { | 187 | if (record->event.pressed) { |
| 188 | if (character_shift) { | 188 | if (character_shift) { |
| 189 | print_char(0x22); | 189 | print_char(0x22); |
| @@ -193,7 +193,7 @@ bool process_printer(uint16_t keycode, keyrecord_t *record) { | |||
| 193 | } | 193 | } |
| 194 | return false; | 194 | return false; |
| 195 | break; | 195 | break; |
| 196 | case KC_GRV: | 196 | case KC_GRAVE: |
| 197 | if (record->event.pressed) { | 197 | if (record->event.pressed) { |
| 198 | if (character_shift) { | 198 | if (character_shift) { |
| 199 | print_char(0x7E); | 199 | print_char(0x7E); |
| @@ -203,7 +203,7 @@ bool process_printer(uint16_t keycode, keyrecord_t *record) { | |||
| 203 | } | 203 | } |
| 204 | return false; | 204 | return false; |
| 205 | break; | 205 | break; |
| 206 | case KC_MINS: | 206 | case KC_MINUS: |
| 207 | if (record->event.pressed) { | 207 | if (record->event.pressed) { |
| 208 | if (character_shift) { | 208 | if (character_shift) { |
| 209 | print_char(0x5F); | 209 | print_char(0x5F); |
| @@ -213,7 +213,7 @@ bool process_printer(uint16_t keycode, keyrecord_t *record) { | |||
| 213 | } | 213 | } |
| 214 | return false; | 214 | return false; |
| 215 | break; | 215 | break; |
| 216 | case KC_EQL: | 216 | case KC_EQUAL: |
| 217 | if (record->event.pressed) { | 217 | if (record->event.pressed) { |
| 218 | if (character_shift) { | 218 | if (character_shift) { |
| 219 | print_char(0x2B); | 219 | print_char(0x2B); |
| @@ -223,7 +223,7 @@ bool process_printer(uint16_t keycode, keyrecord_t *record) { | |||
| 223 | } | 223 | } |
| 224 | return false; | 224 | return false; |
| 225 | break; | 225 | break; |
| 226 | case KC_LBRC: | 226 | case KC_LEFT_BRACKET: |
| 227 | if (record->event.pressed) { | 227 | if (record->event.pressed) { |
| 228 | if (character_shift) { | 228 | if (character_shift) { |
| 229 | print_char(0x7B); | 229 | print_char(0x7B); |
| @@ -233,7 +233,7 @@ bool process_printer(uint16_t keycode, keyrecord_t *record) { | |||
| 233 | } | 233 | } |
| 234 | return false; | 234 | return false; |
| 235 | break; | 235 | break; |
| 236 | case KC_RBRC: | 236 | case KC_RIGHT_BRACKET: |
| 237 | if (record->event.pressed) { | 237 | if (record->event.pressed) { |
| 238 | if (character_shift) { | 238 | if (character_shift) { |
| 239 | print_char(0x7D); | 239 | print_char(0x7D); |
| @@ -243,7 +243,7 @@ bool process_printer(uint16_t keycode, keyrecord_t *record) { | |||
| 243 | } | 243 | } |
| 244 | return false; | 244 | return false; |
| 245 | break; | 245 | break; |
| 246 | case KC_BSLS: | 246 | case KC_BACKSLASH: |
| 247 | if (record->event.pressed) { | 247 | if (record->event.pressed) { |
| 248 | if (character_shift) { | 248 | if (character_shift) { |
| 249 | print_char(0x7C); | 249 | print_char(0x7C); |
diff --git a/quantum/process_keycode/process_programmable_button.c b/quantum/process_keycode/process_programmable_button.c new file mode 100644 index 000000000..c6e77faac --- /dev/null +++ b/quantum/process_keycode/process_programmable_button.c | |||
| @@ -0,0 +1,31 @@ | |||
| 1 | /* | ||
| 2 | Copyright 2021 Thomas Weißschuh <thomas@t-8ch.de> | ||
| 3 | |||
| 4 | This program is free software: you can redistribute it and/or modify | ||
| 5 | it under the terms of the GNU General Public License as published by | ||
| 6 | the Free Software Foundation, either version 2 of the License, or | ||
| 7 | (at your option) any later version. | ||
| 8 | |||
| 9 | This program is distributed in the hope that it will be useful, | ||
| 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 12 | GNU General Public License for more details. | ||
| 13 | |||
| 14 | You should have received a copy of the GNU General Public License | ||
| 15 | along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
| 16 | */ | ||
| 17 | |||
| 18 | #include "process_programmable_button.h" | ||
| 19 | #include "programmable_button.h" | ||
| 20 | |||
| 21 | bool process_programmable_button(uint16_t keycode, keyrecord_t *record) { | ||
| 22 | if (keycode >= PROGRAMMABLE_BUTTON_MIN && keycode <= PROGRAMMABLE_BUTTON_MAX) { | ||
| 23 | uint8_t button = keycode - PROGRAMMABLE_BUTTON_MIN + 1; | ||
| 24 | if (record->event.pressed) { | ||
| 25 | programmable_button_on(button); | ||
| 26 | } else { | ||
| 27 | programmable_button_off(button); | ||
| 28 | } | ||
| 29 | } | ||
| 30 | return true; | ||
| 31 | } | ||
diff --git a/quantum/process_keycode/process_programmable_button.h b/quantum/process_keycode/process_programmable_button.h new file mode 100644 index 000000000..47c6ce561 --- /dev/null +++ b/quantum/process_keycode/process_programmable_button.h | |||
| @@ -0,0 +1,23 @@ | |||
| 1 | /* | ||
| 2 | Copyright 2021 Thomas Weißschuh <thomas@t-8ch.de> | ||
| 3 | |||
| 4 | This program is free software: you can redistribute it and/or modify | ||
| 5 | it under the terms of the GNU General Public License as published by | ||
| 6 | the Free Software Foundation, either version 2 of the License, or | ||
| 7 | (at your option) any later version. | ||
| 8 | |||
| 9 | This program is distributed in the hope that it will be useful, | ||
| 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 12 | GNU General Public License for more details. | ||
| 13 | |||
| 14 | You should have received a copy of the GNU General Public License | ||
| 15 | along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
| 16 | */ | ||
| 17 | |||
| 18 | #pragma once | ||
| 19 | |||
| 20 | #include <stdint.h> | ||
| 21 | #include "quantum.h" | ||
| 22 | |||
| 23 | bool process_programmable_button(uint16_t keycode, keyrecord_t *record); | ||
diff --git a/quantum/process_keycode/process_space_cadet.c b/quantum/process_keycode/process_space_cadet.c index f99db2a87..46b2648c3 100644 --- a/quantum/process_keycode/process_space_cadet.c +++ b/quantum/process_keycode/process_space_cadet.c | |||
| @@ -27,53 +27,53 @@ | |||
| 27 | 27 | ||
| 28 | // Shift / Enter setup | 28 | // Shift / Enter setup |
| 29 | #ifndef SFTENT_KEY | 29 | #ifndef SFTENT_KEY |
| 30 | # define SFTENT_KEY KC_ENT | 30 | # define SFTENT_KEY KC_ENTER |
| 31 | #endif | 31 | #endif |
| 32 | 32 | ||
| 33 | #ifdef DISABLE_SPACE_CADET_MODIFIER | 33 | #ifdef DISABLE_SPACE_CADET_MODIFIER |
| 34 | # ifndef LSPO_MOD | 34 | # ifndef LSPO_MOD |
| 35 | # define LSPO_MOD KC_TRNS | 35 | # define LSPO_MOD KC_TRANSPARENT |
| 36 | # endif | 36 | # endif |
| 37 | # ifndef RSPC_MOD | 37 | # ifndef RSPC_MOD |
| 38 | # define RSPC_MOD KC_TRNS | 38 | # define RSPC_MOD KC_TRANSPARENT |
| 39 | # endif | 39 | # endif |
| 40 | #else | 40 | #else |
| 41 | # ifndef LSPO_MOD | 41 | # ifndef LSPO_MOD |
| 42 | # define LSPO_MOD KC_LSFT | 42 | # define LSPO_MOD KC_LEFT_SHIFT |
| 43 | # endif | 43 | # endif |
| 44 | # ifndef RSPC_MOD | 44 | # ifndef RSPC_MOD |
| 45 | # define RSPC_MOD KC_RSFT | 45 | # define RSPC_MOD KC_RIGHT_SHIFT |
| 46 | # endif | 46 | # endif |
| 47 | #endif | 47 | #endif |
| 48 | // ********************************************************** | 48 | // ********************************************************** |
| 49 | 49 | ||
| 50 | // Shift / paren setup | 50 | // Shift / paren setup |
| 51 | #ifndef LSPO_KEYS | 51 | #ifndef LSPO_KEYS |
| 52 | # define LSPO_KEYS KC_LSFT, LSPO_MOD, LSPO_KEY | 52 | # define LSPO_KEYS KC_LEFT_SHIFT, LSPO_MOD, LSPO_KEY |
| 53 | #endif | 53 | #endif |
| 54 | #ifndef RSPC_KEYS | 54 | #ifndef RSPC_KEYS |
| 55 | # define RSPC_KEYS KC_RSFT, RSPC_MOD, RSPC_KEY | 55 | # define RSPC_KEYS KC_RIGHT_SHIFT, RSPC_MOD, RSPC_KEY |
| 56 | #endif | 56 | #endif |
| 57 | 57 | ||
| 58 | // Control / paren setup | 58 | // Control / paren setup |
| 59 | #ifndef LCPO_KEYS | 59 | #ifndef LCPO_KEYS |
| 60 | # define LCPO_KEYS KC_LCTL, KC_LSFT, KC_9 | 60 | # define LCPO_KEYS KC_LEFT_CTRL, KC_LEFT_SHIFT, KC_9 |
| 61 | #endif | 61 | #endif |
| 62 | #ifndef RCPC_KEYS | 62 | #ifndef RCPC_KEYS |
| 63 | # define RCPC_KEYS KC_RCTL, KC_RSFT, KC_0 | 63 | # define RCPC_KEYS KC_RIGHT_CTRL, KC_RIGHT_SHIFT, KC_0 |
| 64 | #endif | 64 | #endif |
| 65 | 65 | ||
| 66 | // Alt / paren setup | 66 | // Alt / paren setup |
| 67 | #ifndef LAPO_KEYS | 67 | #ifndef LAPO_KEYS |
| 68 | # define LAPO_KEYS KC_LALT, KC_LSFT, KC_9 | 68 | # define LAPO_KEYS KC_LEFT_ALT, KC_LEFT_SHIFT, KC_9 |
| 69 | #endif | 69 | #endif |
| 70 | #ifndef RAPC_KEYS | 70 | #ifndef RAPC_KEYS |
| 71 | # define RAPC_KEYS KC_RALT, KC_RSFT, KC_0 | 71 | # define RAPC_KEYS KC_RIGHT_ALT, KC_RIGHT_SHIFT, KC_0 |
| 72 | #endif | 72 | #endif |
| 73 | 73 | ||
| 74 | // Shift / Enter setup | 74 | // Shift / Enter setup |
| 75 | #ifndef SFTENT_KEYS | 75 | #ifndef SFTENT_KEYS |
| 76 | # define SFTENT_KEYS KC_RSFT, KC_TRNS, SFTENT_KEY | 76 | # define SFTENT_KEYS KC_RIGHT_SHIFT, KC_TRANSPARENT, SFTENT_KEY |
| 77 | #endif | 77 | #endif |
| 78 | 78 | ||
| 79 | static uint8_t sc_last = 0; | 79 | static uint8_t sc_last = 0; |
diff --git a/quantum/process_keycode/process_terminal.c b/quantum/process_keycode/process_terminal.c index 7d1eefa9e..a059f3a52 100644 --- a/quantum/process_keycode/process_terminal.c +++ b/quantum/process_keycode/process_terminal.c | |||
| @@ -257,12 +257,12 @@ bool process_terminal(uint16_t keycode, keyrecord_t *record) { | |||
| 257 | process_terminal_command(); | 257 | process_terminal_command(); |
| 258 | return false; | 258 | return false; |
| 259 | break; | 259 | break; |
| 260 | case KC_ESC: | 260 | case KC_ESCAPE: |
| 261 | SEND_STRING("\n"); | 261 | SEND_STRING("\n"); |
| 262 | enable_terminal(); | 262 | enable_terminal(); |
| 263 | return false; | 263 | return false; |
| 264 | break; | 264 | break; |
| 265 | case KC_BSPC: | 265 | case KC_BACKSPACE: |
| 266 | str_len = strlen(buffer); | 266 | str_len = strlen(buffer); |
| 267 | if (str_len > 0) { | 267 | if (str_len > 0) { |
| 268 | buffer[str_len - 1] = 0; | 268 | buffer[str_len - 1] = 0; |
| @@ -284,7 +284,7 @@ bool process_terminal(uint16_t keycode, keyrecord_t *record) { | |||
| 284 | str_len = strlen(buffer); | 284 | str_len = strlen(buffer); |
| 285 | for (int i = 0; i < str_len; ++i) { | 285 | for (int i = 0; i < str_len; ++i) { |
| 286 | send_string(SS_TAP(X_BSPACE)); // clear w/e is on the line already | 286 | send_string(SS_TAP(X_BSPACE)); // clear w/e is on the line already |
| 287 | // process_terminal(KC_BSPC,record); | 287 | // process_terminal(KC_BACKSPACE,record); |
| 288 | } | 288 | } |
| 289 | strncpy(buffer, cmd_buffer[current_cmd_buffer_pos], 80); | 289 | strncpy(buffer, cmd_buffer[current_cmd_buffer_pos], 80); |
| 290 | 290 | ||
| @@ -299,7 +299,7 @@ bool process_terminal(uint16_t keycode, keyrecord_t *record) { | |||
| 299 | str_len = strlen(buffer); | 299 | str_len = strlen(buffer); |
| 300 | for (int i = 0; i < str_len; ++i) { | 300 | for (int i = 0; i < str_len; ++i) { |
| 301 | send_string(SS_TAP(X_BSPACE)); // clear w/e is on the line already | 301 | send_string(SS_TAP(X_BSPACE)); // clear w/e is on the line already |
| 302 | // process_terminal(KC_BSPC,record); | 302 | // process_terminal(KC_BACKSPACE,record); |
| 303 | } | 303 | } |
| 304 | strncpy(buffer, cmd_buffer[current_cmd_buffer_pos], 79); | 304 | strncpy(buffer, cmd_buffer[current_cmd_buffer_pos], 79); |
| 305 | 305 | ||
| @@ -311,7 +311,7 @@ bool process_terminal(uint16_t keycode, keyrecord_t *record) { | |||
| 311 | default: | 311 | default: |
| 312 | if (keycode <= 58) { | 312 | if (keycode <= 58) { |
| 313 | char_to_add = 0; | 313 | char_to_add = 0; |
| 314 | if (get_mods() & (MOD_BIT(KC_LSHIFT) | MOD_BIT(KC_RSHIFT))) { | 314 | if (get_mods() & (MOD_BIT(KC_LEFT_SHIFT) | MOD_BIT(KC_RIGHT_SHIFT))) { |
| 315 | char_to_add = shifted_keycode_to_ascii_lut[keycode]; | 315 | char_to_add = shifted_keycode_to_ascii_lut[keycode]; |
| 316 | } else if (get_mods() == 0) { | 316 | } else if (get_mods() == 0) { |
| 317 | char_to_add = keycode_to_ascii_lut[keycode]; | 317 | char_to_add = keycode_to_ascii_lut[keycode]; |
diff --git a/quantum/process_keycode/process_ucis.c b/quantum/process_keycode/process_ucis.c index 12b0aba9b..d084d2b66 100644 --- a/quantum/process_keycode/process_ucis.c +++ b/quantum/process_keycode/process_ucis.c | |||
| @@ -46,7 +46,7 @@ static bool is_uni_seq(char *seq) { | |||
| 46 | return false; | 46 | return false; |
| 47 | } | 47 | } |
| 48 | } | 48 | } |
| 49 | return qk_ucis_state.codes[i] == KC_ENT || qk_ucis_state.codes[i] == KC_SPC; | 49 | return qk_ucis_state.codes[i] == KC_ENTER || qk_ucis_state.codes[i] == KC_SPACE; |
| 50 | } | 50 | } |
| 51 | 51 | ||
| 52 | __attribute__((weak)) void qk_ucis_symbol_fallback(void) { | 52 | __attribute__((weak)) void qk_ucis_symbol_fallback(void) { |
| @@ -72,7 +72,7 @@ bool process_ucis(uint16_t keycode, keyrecord_t *record) { | |||
| 72 | return true; | 72 | return true; |
| 73 | } | 73 | } |
| 74 | 74 | ||
| 75 | bool special = keycode == KC_SPC || keycode == KC_ENT || keycode == KC_ESC || keycode == KC_BSPC; | 75 | bool special = keycode == KC_SPACE || keycode == KC_ENTER || keycode == KC_ESCAPE || keycode == KC_BACKSPACE; |
| 76 | if (qk_ucis_state.count >= UCIS_MAX_SYMBOL_LENGTH && !special) { | 76 | if (qk_ucis_state.count >= UCIS_MAX_SYMBOL_LENGTH && !special) { |
| 77 | return false; | 77 | return false; |
| 78 | } | 78 | } |
| @@ -81,7 +81,7 @@ bool process_ucis(uint16_t keycode, keyrecord_t *record) { | |||
| 81 | qk_ucis_state.count++; | 81 | qk_ucis_state.count++; |
| 82 | 82 | ||
| 83 | switch (keycode) { | 83 | switch (keycode) { |
| 84 | case KC_BSPC: | 84 | case KC_BACKSPACE: |
| 85 | if (qk_ucis_state.count >= 2) { | 85 | if (qk_ucis_state.count >= 2) { |
| 86 | qk_ucis_state.count -= 2; | 86 | qk_ucis_state.count -= 2; |
| 87 | return true; | 87 | return true; |
| @@ -90,16 +90,16 @@ bool process_ucis(uint16_t keycode, keyrecord_t *record) { | |||
| 90 | return false; | 90 | return false; |
| 91 | } | 91 | } |
| 92 | 92 | ||
| 93 | case KC_SPC: | 93 | case KC_SPACE: |
| 94 | case KC_ENT: | 94 | case KC_ENTER: |
| 95 | case KC_ESC: | 95 | case KC_ESCAPE: |
| 96 | for (uint8_t i = 0; i < qk_ucis_state.count; i++) { | 96 | for (uint8_t i = 0; i < qk_ucis_state.count; i++) { |
| 97 | register_code(KC_BSPC); | 97 | register_code(KC_BACKSPACE); |
| 98 | unregister_code(KC_BSPC); | 98 | unregister_code(KC_BACKSPACE); |
| 99 | wait_ms(UNICODE_TYPE_DELAY); | 99 | wait_ms(UNICODE_TYPE_DELAY); |
| 100 | } | 100 | } |
| 101 | 101 | ||
| 102 | if (keycode == KC_ESC) { | 102 | if (keycode == KC_ESCAPE) { |
| 103 | qk_ucis_state.in_progress = false; | 103 | qk_ucis_state.in_progress = false; |
| 104 | qk_ucis_cancel(); | 104 | qk_ucis_cancel(); |
| 105 | return false; | 105 | return false; |
diff --git a/quantum/process_keycode/process_unicode_common.c b/quantum/process_keycode/process_unicode_common.c index 889c768a8..7685bb1c9 100644 --- a/quantum/process_keycode/process_unicode_common.c +++ b/quantum/process_keycode/process_unicode_common.c | |||
| @@ -22,6 +22,7 @@ | |||
| 22 | unicode_config_t unicode_config; | 22 | unicode_config_t unicode_config; |
| 23 | uint8_t unicode_saved_mods; | 23 | uint8_t unicode_saved_mods; |
| 24 | bool unicode_saved_caps_lock; | 24 | bool unicode_saved_caps_lock; |
| 25 | bool unicode_saved_num_lock; | ||
| 25 | 26 | ||
| 26 | #if UNICODE_SELECTED_MODES != -1 | 27 | #if UNICODE_SELECTED_MODES != -1 |
| 27 | static uint8_t selected[] = {UNICODE_SELECTED_MODES}; | 28 | static uint8_t selected[] = {UNICODE_SELECTED_MODES}; |
| @@ -79,13 +80,14 @@ void persist_unicode_input_mode(void) { eeprom_update_byte(EECONFIG_UNICODEMODE, | |||
| 79 | 80 | ||
| 80 | __attribute__((weak)) void unicode_input_start(void) { | 81 | __attribute__((weak)) void unicode_input_start(void) { |
| 81 | unicode_saved_caps_lock = host_keyboard_led_state().caps_lock; | 82 | unicode_saved_caps_lock = host_keyboard_led_state().caps_lock; |
| 83 | unicode_saved_num_lock = host_keyboard_led_state().num_lock; | ||
| 82 | 84 | ||
| 83 | // Note the order matters here! | 85 | // Note the order matters here! |
| 84 | // Need to do this before we mess around with the mods, or else | 86 | // Need to do this before we mess around with the mods, or else |
| 85 | // UNICODE_KEY_LNX (which is usually Ctrl-Shift-U) might not work | 87 | // UNICODE_KEY_LNX (which is usually Ctrl-Shift-U) might not work |
| 86 | // correctly in the shifted case. | 88 | // correctly in the shifted case. |
| 87 | if (unicode_config.input_mode == UC_LNX && unicode_saved_caps_lock) { | 89 | if (unicode_config.input_mode == UC_LNX && unicode_saved_caps_lock) { |
| 88 | tap_code(KC_CAPS); | 90 | tap_code(KC_CAPS_LOCK); |
| 89 | } | 91 | } |
| 90 | 92 | ||
| 91 | unicode_saved_mods = get_mods(); // Save current mods | 93 | unicode_saved_mods = get_mods(); // Save current mods |
| @@ -99,9 +101,13 @@ __attribute__((weak)) void unicode_input_start(void) { | |||
| 99 | tap_code16(UNICODE_KEY_LNX); | 101 | tap_code16(UNICODE_KEY_LNX); |
| 100 | break; | 102 | break; |
| 101 | case UC_WIN: | 103 | case UC_WIN: |
| 102 | register_code(KC_LALT); | 104 | // For increased reliability, use numpad keys for inputting digits |
| 105 | if (!unicode_saved_num_lock) { | ||
| 106 | tap_code(KC_NUM_LOCK); | ||
| 107 | } | ||
| 108 | register_code(KC_LEFT_ALT); | ||
| 103 | wait_ms(UNICODE_TYPE_DELAY); | 109 | wait_ms(UNICODE_TYPE_DELAY); |
| 104 | tap_code(KC_PPLS); | 110 | tap_code(KC_KP_PLUS); |
| 105 | break; | 111 | break; |
| 106 | case UC_WINC: | 112 | case UC_WINC: |
| 107 | tap_code(UNICODE_KEY_WINC); | 113 | tap_code(UNICODE_KEY_WINC); |
| @@ -118,13 +124,16 @@ __attribute__((weak)) void unicode_input_finish(void) { | |||
| 118 | unregister_code(UNICODE_KEY_MAC); | 124 | unregister_code(UNICODE_KEY_MAC); |
| 119 | break; | 125 | break; |
| 120 | case UC_LNX: | 126 | case UC_LNX: |
| 121 | tap_code(KC_SPC); | 127 | tap_code(KC_SPACE); |
| 122 | if (unicode_saved_caps_lock) { | 128 | if (unicode_saved_caps_lock) { |
| 123 | tap_code(KC_CAPS); | 129 | tap_code(KC_CAPS_LOCK); |
| 124 | } | 130 | } |
| 125 | break; | 131 | break; |
| 126 | case UC_WIN: | 132 | case UC_WIN: |
| 127 | unregister_code(KC_LALT); | 133 | unregister_code(KC_LEFT_ALT); |
| 134 | if (!unicode_saved_num_lock) { | ||
| 135 | tap_code(KC_NUM_LOCK); | ||
| 136 | } | ||
| 128 | break; | 137 | break; |
| 129 | case UC_WINC: | 138 | case UC_WINC: |
| 130 | tap_code(KC_ENTER); | 139 | tap_code(KC_ENTER); |
| @@ -140,26 +149,44 @@ __attribute__((weak)) void unicode_input_cancel(void) { | |||
| 140 | unregister_code(UNICODE_KEY_MAC); | 149 | unregister_code(UNICODE_KEY_MAC); |
| 141 | break; | 150 | break; |
| 142 | case UC_LNX: | 151 | case UC_LNX: |
| 143 | tap_code(KC_ESC); | 152 | tap_code(KC_ESCAPE); |
| 144 | if (unicode_saved_caps_lock) { | 153 | if (unicode_saved_caps_lock) { |
| 145 | tap_code(KC_CAPS); | 154 | tap_code(KC_CAPS_LOCK); |
| 146 | } | 155 | } |
| 147 | break; | 156 | break; |
| 148 | case UC_WINC: | 157 | case UC_WINC: |
| 149 | tap_code(KC_ESC); | 158 | tap_code(KC_ESCAPE); |
| 150 | break; | 159 | break; |
| 151 | case UC_WIN: | 160 | case UC_WIN: |
| 152 | unregister_code(KC_LALT); | 161 | unregister_code(KC_LEFT_ALT); |
| 162 | if (!unicode_saved_num_lock) { | ||
| 163 | tap_code(KC_NUM_LOCK); | ||
| 164 | } | ||
| 153 | break; | 165 | break; |
| 154 | } | 166 | } |
| 155 | 167 | ||
| 156 | set_mods(unicode_saved_mods); // Reregister previously set mods | 168 | set_mods(unicode_saved_mods); // Reregister previously set mods |
| 157 | } | 169 | } |
| 158 | 170 | ||
| 171 | // clang-format off | ||
| 172 | |||
| 173 | static void send_nibble_wrapper(uint8_t digit) { | ||
| 174 | if (unicode_config.input_mode == UC_WIN) { | ||
| 175 | uint8_t kc = digit < 10 | ||
| 176 | ? KC_KP_1 + (10 + digit - 1) % 10 | ||
| 177 | : KC_A + (digit - 10); | ||
| 178 | tap_code(kc); | ||
| 179 | return; | ||
| 180 | } | ||
| 181 | send_nibble(digit); | ||
| 182 | } | ||
| 183 | |||
| 184 | // clang-format on | ||
| 185 | |||
| 159 | void register_hex(uint16_t hex) { | 186 | void register_hex(uint16_t hex) { |
| 160 | for (int i = 3; i >= 0; i--) { | 187 | for (int i = 3; i >= 0; i--) { |
| 161 | uint8_t digit = ((hex >> (i * 4)) & 0xF); | 188 | uint8_t digit = ((hex >> (i * 4)) & 0xF); |
| 162 | send_nibble(digit); | 189 | send_nibble_wrapper(digit); |
| 163 | } | 190 | } |
| 164 | } | 191 | } |
| 165 | 192 | ||
| @@ -172,10 +199,10 @@ void register_hex32(uint32_t hex) { | |||
| 172 | uint8_t digit = ((hex >> (i * 4)) & 0xF); | 199 | uint8_t digit = ((hex >> (i * 4)) & 0xF); |
| 173 | if (digit == 0) { | 200 | if (digit == 0) { |
| 174 | if (!onzerostart) { | 201 | if (!onzerostart) { |
| 175 | send_nibble(digit); | 202 | send_nibble_wrapper(digit); |
| 176 | } | 203 | } |
| 177 | } else { | 204 | } else { |
| 178 | send_nibble(digit); | 205 | send_nibble_wrapper(digit); |
| 179 | onzerostart = false; | 206 | onzerostart = false; |
| 180 | } | 207 | } |
| 181 | } | 208 | } |
diff --git a/quantum/process_keycode/process_unicode_common.h b/quantum/process_keycode/process_unicode_common.h index c10e171ec..72defb445 100644 --- a/quantum/process_keycode/process_unicode_common.h +++ b/quantum/process_keycode/process_unicode_common.h | |||
| @@ -24,13 +24,13 @@ | |||
| 24 | 24 | ||
| 25 | // Keycodes used for starting Unicode input on different platforms | 25 | // Keycodes used for starting Unicode input on different platforms |
| 26 | #ifndef UNICODE_KEY_MAC | 26 | #ifndef UNICODE_KEY_MAC |
| 27 | # define UNICODE_KEY_MAC KC_LALT | 27 | # define UNICODE_KEY_MAC KC_LEFT_ALT |
| 28 | #endif | 28 | #endif |
| 29 | #ifndef UNICODE_KEY_LNX | 29 | #ifndef UNICODE_KEY_LNX |
| 30 | # define UNICODE_KEY_LNX LCTL(LSFT(KC_U)) | 30 | # define UNICODE_KEY_LNX LCTL(LSFT(KC_U)) |
| 31 | #endif | 31 | #endif |
| 32 | #ifndef UNICODE_KEY_WINC | 32 | #ifndef UNICODE_KEY_WINC |
| 33 | # define UNICODE_KEY_WINC KC_RALT | 33 | # define UNICODE_KEY_WINC KC_RIGHT_ALT |
| 34 | #endif | 34 | #endif |
| 35 | 35 | ||
| 36 | // Comma-delimited, ordered list of input modes selected for use (e.g. in cycle) | 36 | // Comma-delimited, ordered list of input modes selected for use (e.g. in cycle) |
