summaryrefslogtreecommitdiff
path: root/quantum
diff options
context:
space:
mode:
Diffstat (limited to 'quantum')
-rw-r--r--quantum/keymap_extras/keymap_dvp.h82
-rw-r--r--quantum/process_keycode/process_unicode.c39
-rw-r--r--quantum/process_keycode/process_unicode.h9
3 files changed, 119 insertions, 11 deletions
diff --git a/quantum/keymap_extras/keymap_dvp.h b/quantum/keymap_extras/keymap_dvp.h
new file mode 100644
index 0000000000..83f49a52b5
--- /dev/null
+++ b/quantum/keymap_extras/keymap_dvp.h
@@ -0,0 +1,82 @@
+#ifndef KEYMAP_DVP_H
+#define KEYMAP_DVP_H
+
+#include "keymap.h"
+
+// Normal characters
+#define DP_DLR KC_GRV
+#define DP_AMPR KC_1
+#define DP_LBRC KC_2
+#define DP_LCBR KC_3
+#define DP_RCBR KC_4
+#define DP_LPRN KC_5
+#define DP_EQL KC_6
+#define DP_ASTR KC_7
+#define DP_RPRN KC_8
+#define DP_PLUS KC_9
+#define DP_RBRC KC_0
+#define DP_EXLM KC_MINS
+#define DP_HASH KC_EQL
+
+#define DP_SCLN KC_Q
+#define DP_COMM KC_W
+#define DP_DOT KC_E
+#define DP_P KC_R
+#define DP_Y KC_T
+#define DP_F KC_Y
+#define DP_G KC_U
+#define DP_C KC_I
+#define DP_R KC_O
+#define DP_L KC_P
+#define DP_SLSH KC_LBRC
+#define DP_AT KC_RBRC
+#define DP_BSLS KC_BSLS
+
+#define DP_A KC_A
+#define DP_O KC_S
+#define DP_E KC_D
+#define DP_U KC_F
+#define DP_I KC_G
+#define DP_D KC_H
+#define DP_H KC_J
+#define DP_T KC_K
+#define DP_N KC_L
+#define DP_S KC_SCLN
+#define DP_MINS KC_QUOT
+
+#define DP_QUOT KC_Z
+#define DP_Q KC_X
+#define DP_J KC_C
+#define DP_K KC_V
+#define DP_X KC_B
+#define DP_B KC_N
+#define DP_M KC_M
+#define DP_W KC_COMM
+#define DP_V KC_DOT
+#define DP_Z KC_SLSH
+
+// Shifted characters
+#define DP_TILD LSFT(DP_DLR)
+#define DP_PERC LSFT(DP_AMPR)
+#define DP_7 LSFT(DP_LBRC)
+#define DP_5 LSFT(DP_LCBR)
+#define DP_3 LSFT(DP_RCBR)
+#define DP_1 LSFT(DP_LPRN)
+#define DP_9 LSFT(DP_EQL)
+#define DP_0 LSFT(DP_ASTR)
+#define DP_2 LSFT(DP_RPRN)
+#define DP_4 LSFT(DP_PLUS)
+#define DP_6 LSFT(DP_RBRC)
+#define DP_8 LSFT(DP_EXLM)
+#define DP_GRV LSFT(DP_HASH)
+
+#define DP_COLN LSFT(DP_SCLN)
+#define DP_LABK LSFT(DP_COMM)
+#define DP_RABK LSFT(DP_DOT)
+#define DP_QUES LSFT(DP_SLSH)
+#define DP_CIRC LSFT(DP_AT)
+#define DP_PIPE LSFT(DP_BSLS)
+#define DP_UNDS LSFT(DP_MINS)
+#define DP_DQUO LSFT(DP_QUOT)
+
+#endif
diff --git a/quantum/process_keycode/process_unicode.c b/quantum/process_keycode/process_unicode.c
index 37dd471ffd..cd3a610b4d 100644
--- a/quantum/process_keycode/process_unicode.c
+++ b/quantum/process_keycode/process_unicode.c
@@ -42,6 +42,11 @@ void unicode_input_start (void) {
register_code(KC_PPLS);
unregister_code(KC_PPLS);
break;
+ case UC_WINC:
+ register_code(KC_RALT);
+ unregister_code(KC_RALT);
+ register_code(KC_U);
+ unregister_code(KC_U);
}
wait_ms(UNICODE_TYPE_DELAY);
}
@@ -83,22 +88,42 @@ __attribute__((weak))
const uint32_t PROGMEM unicode_map[] = {
};
-// 5 digit max because of linux limitation
void register_hex32(uint32_t hex) {
- for(int i = 4; i >= 0; i--) {
+ uint8_t onzerostart = 1;
+ for(int i = 7; i >= 0; i--) {
+ if (i <= 3) {
+ onzerostart = 0;
+ }
uint8_t digit = ((hex >> (i*4)) & 0xF);
- register_code(hex_to_keycode(digit));
- unregister_code(hex_to_keycode(digit));
+ if (digit == 0) {
+ if (onzerostart == 0) {
+ register_code(hex_to_keycode(digit));
+ unregister_code(hex_to_keycode(digit));
+ }
+ } else {
+ register_code(hex_to_keycode(digit));
+ unregister_code(hex_to_keycode(digit));
+ onzerostart = 0;
+ }
}
}
+__attribute__((weak))
+void unicode_map_input_error() {}
+
bool process_unicode_map(uint16_t keycode, keyrecord_t *record) {
if ((keycode & QK_UNICODE_MAP) == QK_UNICODE_MAP && record->event.pressed) {
const uint32_t* map = unicode_map;
uint16_t index = keycode & 0x7FF;
- unicode_input_start();
- register_hex32(pgm_read_dword_far(&map[index]));
- unicode_input_finish();
+ uint32_t code = pgm_read_dword_far(&map[index]);
+ if ((code > 0xFFFF && input_mode == UC_OSX) || (code > 0xFFFFF && input_mode == UC_LNX)) {
+ // when character is out of range supported by the OS
+ unicode_map_input_error();
+ } else {
+ unicode_input_start();
+ register_hex32(code);
+ unicode_input_finish();
+ }
}
return true;
}
diff --git a/quantum/process_keycode/process_unicode.h b/quantum/process_keycode/process_unicode.h
index a6c7e45845..065eeb5f6a 100644
--- a/quantum/process_keycode/process_unicode.h
+++ b/quantum/process_keycode/process_unicode.h
@@ -3,10 +3,11 @@
#include "quantum.h"
-#define UC_OSX 0
-#define UC_LNX 1
-#define UC_WIN 2
-#define UC_BSD 3
+#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
#ifndef UNICODE_TYPE_DELAY
#define UNICODE_TYPE_DELAY 10