usable workaround against shifted keys bleeding into next key
parent
24891b6108
commit
a051172412
|
@ -78,6 +78,12 @@ class Key
|
|||
"ctrl" => "&kbfun_control_press_release",
|
||||
"alt" => "&kbfun_alt_press_release",
|
||||
"win" => "&kbfun_win_press_release",
|
||||
#
|
||||
"shift_once" => "&kbfun_shift_press_release_once",
|
||||
"ctrl_once" => "&kbfun_control_press_release_once",
|
||||
"alt_once" => "&kbfun_alt_press_release_once",
|
||||
"win_once" => "&kbfun_win_press_release_once",
|
||||
#
|
||||
"shift_layer" => "&kbfun_shift_layer_press_release",
|
||||
"ctrl_layer" => "&kbfun_control_layer_press_release",
|
||||
"alt_layer" => "&kbfun_alt_layer_press_release",
|
||||
|
@ -139,8 +145,8 @@ class Key
|
|||
"9" => "KEY_9_LeftParenthesis",
|
||||
# punctuation
|
||||
"\\" => "KEY_Backslash_Pipe",
|
||||
"{" => ["KEY_LeftBracket_LeftBrace", "shift"],
|
||||
"}" => ["KEY_RightBracket_RightBrace", "shift"],
|
||||
"{" => ["KEY_LeftBracket_LeftBrace", "shift_once"],
|
||||
"}" => ["KEY_RightBracket_RightBrace", "shift_once"],
|
||||
"[" => "KEY_LeftBracket_LeftBrace",
|
||||
"]" => "KEY_RightBracket_RightBrace",
|
||||
"," => "KEY_Comma_LessThan",
|
||||
|
@ -151,27 +157,27 @@ class Key
|
|||
"\'" => "KEY_SingleQuote_DoubleQuote",
|
||||
";" => "KEY_Semicolon_Colon",
|
||||
"/" => "KEY_Slash_Question",
|
||||
"~" => ["KEY_GraveAccent_Tilde", "shift"],
|
||||
"%" => ["KEY_5_Percent", "shift"],
|
||||
"*" => ["KEY_8_Asterisk", "shift"],
|
||||
":" => ["KEY_Semicolon_Colon", "shift"],
|
||||
"^" => ["KEY_6_Caret", "shift"],
|
||||
"<" => ["KEY_Comma_LessThan", "shift"],
|
||||
">" => ["KEY_Period_GreaterThan", "shift"],
|
||||
"?" => ["KEY_Slash_Question", "shift"],
|
||||
"!" => ["KEY_1_Exclamation", "shift"],
|
||||
"(" => ["KEY_9_LeftParenthesis", "shift"],
|
||||
")" => ["KEY_0_RightParenthesis", "shift"],
|
||||
"|" => ["KEY_Backslash_Pipe", "shift"],
|
||||
"@" => ["KEY_2_At", "shift"],
|
||||
"\"" => ["KEY_SingleQuote_DoubleQuote", "shift"],
|
||||
"_" => ["KEY_Dash_Underscore", "shift"],
|
||||
"+" => ["KEY_Equal_Plus", "shift"],
|
||||
"$" => ["KEY_4_Dollar", "shift"],
|
||||
"&" => ["KEY_7_Ampersand", "shift"],
|
||||
"#" => ["KEY_3_Pound", "shift"],
|
||||
"hash" => ["KEY_3_Pound", "shift"],
|
||||
"hsh" => ["KEY_3_Pound", "shift"],
|
||||
"~" => ["KEY_GraveAccent_Tilde", "shift_once"],
|
||||
"%" => ["KEY_5_Percent", "shift_once"],
|
||||
"*" => ["KEY_8_Asterisk", "shift_once"],
|
||||
":" => ["KEY_Semicolon_Colon", "shift_once"],
|
||||
"^" => ["KEY_6_Caret", "shift_once"],
|
||||
"<" => ["KEY_Comma_LessThan", "shift_once"],
|
||||
">" => ["KEY_Period_GreaterThan", "shift_once"],
|
||||
"?" => ["KEY_Slash_Question", "shift_once"],
|
||||
"!" => ["KEY_1_Exclamation", "shift_once"],
|
||||
"(" => ["KEY_9_LeftParenthesis", "shift_once"],
|
||||
")" => ["KEY_0_RightParenthesis", "shift_once"],
|
||||
"|" => ["KEY_Backslash_Pipe", "shift_once"],
|
||||
"@" => ["KEY_2_At", "shift_once"],
|
||||
"\"" => ["KEY_SingleQuote_DoubleQuote", "shift_once"],
|
||||
"_" => ["KEY_Dash_Underscore", "shift_once"],
|
||||
"+" => ["KEY_Equal_Plus", "shift_once"],
|
||||
"$" => ["KEY_4_Dollar", "shift_once"],
|
||||
"&" => ["KEY_7_Ampersand", "shift_once"],
|
||||
"#" => ["KEY_3_Pound", "shift_once"],
|
||||
"hash" => ["KEY_3_Pound", "shift_once"],
|
||||
"hsh" => ["KEY_3_Pound", "shift_once"],
|
||||
# enter etc
|
||||
"enter" => "KEY_ReturnEnter",
|
||||
"return" => "KEY_ReturnEnter",
|
||||
|
|
|
@ -815,22 +815,22 @@ static const keyfunc PROGMEM _kb_layout_func[KB_ROWS][KB_COLUMNS][KB_LAYERS] = {
|
|||
(keyfunc) &kbfun_capslock_press_release, // Lb┳o on LD
|
||||
},
|
||||
{ // row 2 x col 1
|
||||
(keyfunc) &kbfun_shift_press_release, // Lb┳4 on LB
|
||||
(keyfunc) &kbfun_shift_press_release_once, // Lb┳4 on LB
|
||||
(keyfunc) &kbfun_normal_press_release, // Lb┳4 on LP
|
||||
(keyfunc) &kbfun_normal_press_release, // Lb┳4 on LN
|
||||
(keyfunc) &kbfun_normal_press_release, // Lb┳4 on LF
|
||||
(keyfunc) &kbfun_normal_press_release, // Lb┳4 on LD
|
||||
},
|
||||
{ // row 2 x col 2
|
||||
(keyfunc) &kbfun_shift_press_release, // Lb┳3 on LB
|
||||
(keyfunc) &kbfun_shift_press_release, // Lb┳3 on LP
|
||||
(keyfunc) &kbfun_shift_press_release_once, // Lb┳3 on LB
|
||||
(keyfunc) &kbfun_shift_press_release_once, // Lb┳3 on LP
|
||||
(keyfunc) &kbfun_normal_press_release, // Lb┳3 on LN
|
||||
(keyfunc) &kbfun_normal_press_release, // Lb┳3 on LF
|
||||
(keyfunc) &kbfun_normal_press_release, // Lb┳3 on LD
|
||||
},
|
||||
{ // row 2 x col 3
|
||||
(keyfunc) &kbfun_shift_press_release, // Lb┳2 on LB
|
||||
(keyfunc) &kbfun_shift_press_release, // Lb┳2 on LP
|
||||
(keyfunc) &kbfun_shift_press_release_once, // Lb┳2 on LB
|
||||
(keyfunc) &kbfun_shift_press_release_once, // Lb┳2 on LP
|
||||
(keyfunc) &kbfun_normal_press_release, // Lb┳2 on LN
|
||||
(keyfunc) &kbfun_normal_press_release, // Lb┳2 on LF
|
||||
(keyfunc) &kbfun_normal_press_release, // Lb┳2 on LD
|
||||
|
@ -844,7 +844,7 @@ static const keyfunc PROGMEM _kb_layout_func[KB_ROWS][KB_COLUMNS][KB_LAYERS] = {
|
|||
},
|
||||
{ // row 2 x col 5
|
||||
(keyfunc) &kbfun_normal_press_release, // Lb┳0 on LB
|
||||
(keyfunc) &kbfun_shift_press_release, // Lb┳0 on LP
|
||||
(keyfunc) &kbfun_shift_press_release_once, // Lb┳0 on LP
|
||||
(keyfunc) &kbfun_normal_press_release, // Lb┳0 on LN
|
||||
(keyfunc) &kbfun_normal_press_release, // Lb┳0 on LF
|
||||
(keyfunc) &kbfun_normal_press_release, // Lb┳0 on LD
|
||||
|
@ -865,35 +865,35 @@ static const keyfunc PROGMEM _kb_layout_func[KB_ROWS][KB_COLUMNS][KB_LAYERS] = {
|
|||
},
|
||||
{ // row 2 x col 8
|
||||
(keyfunc) &kbfun_normal_press_release, // Rb┳0 on LB
|
||||
(keyfunc) &kbfun_shift_press_release, // Rb┳0 on LP
|
||||
(keyfunc) &kbfun_shift_press_release_once, // Rb┳0 on LP
|
||||
(keyfunc) &kbfun_normal_press_release, // Rb┳0 on LN
|
||||
(keyfunc) &kbfun_normal_press_release, // Rb┳0 on LF
|
||||
(keyfunc) &kbfun_normal_press_release, // Rb┳0 on LD
|
||||
},
|
||||
{ // row 2 x col 9
|
||||
(keyfunc) &kbfun_normal_press_release, // Rb┳1 on LB
|
||||
(keyfunc) &kbfun_shift_press_release, // Rb┳1 on LP
|
||||
(keyfunc) &kbfun_shift_press_release_once, // Rb┳1 on LP
|
||||
(keyfunc) &kbfun_normal_press_release, // Rb┳1 on LN
|
||||
(keyfunc) &kbfun_normal_press_release, // Rb┳1 on LF
|
||||
(keyfunc) &kbfun_normal_press_release, // Rb┳1 on LD
|
||||
},
|
||||
{ // row 2 x col 10
|
||||
(keyfunc) &kbfun_normal_press_release, // Rb┳2 on LB
|
||||
(keyfunc) &kbfun_shift_press_release, // Rb┳2 on LP
|
||||
(keyfunc) &kbfun_shift_press_release_once, // Rb┳2 on LP
|
||||
(keyfunc) &kbfun_normal_press_release, // Rb┳2 on LN
|
||||
(keyfunc) &kbfun_normal_press_release, // Rb┳2 on LF
|
||||
(keyfunc) &kbfun_normal_press_release, // Rb┳2 on LD
|
||||
},
|
||||
{ // row 2 x col 11
|
||||
(keyfunc) &kbfun_normal_press_release, // Rb┳3 on LB
|
||||
(keyfunc) &kbfun_shift_press_release, // Rb┳3 on LP
|
||||
(keyfunc) &kbfun_shift_press_release_once, // Rb┳3 on LP
|
||||
(keyfunc) &kbfun_normal_press_release, // Rb┳3 on LN
|
||||
(keyfunc) &kbfun_normal_press_release, // Rb┳3 on LF
|
||||
(keyfunc) &kbfun_normal_press_release, // Rb┳3 on LD
|
||||
},
|
||||
{ // row 2 x col 12
|
||||
(keyfunc) &kbfun_normal_press_release, // Rb┳4 on LB
|
||||
(keyfunc) &kbfun_shift_press_release, // Rb┳4 on LP
|
||||
(keyfunc) &kbfun_shift_press_release_once, // Rb┳4 on LP
|
||||
(keyfunc) &kbfun_normal_press_release, // Rb┳4 on LN
|
||||
(keyfunc) &kbfun_normal_press_release, // Rb┳4 on LF
|
||||
(keyfunc) &kbfun_normal_press_release, // Rb┳4 on LD
|
||||
|
@ -923,28 +923,28 @@ static const keyfunc PROGMEM _kb_layout_func[KB_ROWS][KB_COLUMNS][KB_LAYERS] = {
|
|||
},
|
||||
{ // row 3 x col 2
|
||||
(keyfunc) &kbfun_normal_press_release, // Lh┳3 on LB
|
||||
(keyfunc) &kbfun_shift_press_release, // Lh┳3 on LP
|
||||
(keyfunc) &kbfun_shift_press_release_once, // Lh┳3 on LP
|
||||
(keyfunc) &kbfun_normal_press_release, // Lh┳3 on LN
|
||||
(keyfunc) &kbfun_normal_press_release, // Lh┳3 on LF
|
||||
(keyfunc) &kbfun_normal_press_release, // Lh┳3 on LD
|
||||
},
|
||||
{ // row 3 x col 3
|
||||
(keyfunc) &kbfun_normal_press_release, // Lh┳2 on LB
|
||||
(keyfunc) &kbfun_shift_press_release, // Lh┳2 on LP
|
||||
(keyfunc) &kbfun_shift_press_release_once, // Lh┳2 on LP
|
||||
(keyfunc) &kbfun_normal_press_release, // Lh┳2 on LN
|
||||
(keyfunc) &kbfun_normal_press_release, // Lh┳2 on LF
|
||||
(keyfunc) &kbfun_normal_press_release, // Lh┳2 on LD
|
||||
},
|
||||
{ // row 3 x col 4
|
||||
(keyfunc) &kbfun_normal_press_release, // Lh┳1 on LB
|
||||
(keyfunc) &kbfun_shift_press_release, // Lh┳1 on LP
|
||||
(keyfunc) &kbfun_shift_press_release_once, // Lh┳1 on LP
|
||||
(keyfunc) &kbfun_normal_press_release, // Lh┳1 on LN
|
||||
(keyfunc) &kbfun_normal_press_release, // Lh┳1 on LF
|
||||
(keyfunc) &kbfun_normal_press_release, // Lh┳1 on LD
|
||||
},
|
||||
{ // row 3 x col 5
|
||||
(keyfunc) &kbfun_normal_press_release, // Lh┳0 on LB
|
||||
(keyfunc) &kbfun_shift_press_release, // Lh┳0 on LP
|
||||
(keyfunc) &kbfun_shift_press_release_once, // Lh┳0 on LP
|
||||
(keyfunc) &kbfun_normal_press_release, // Lh┳0 on LN
|
||||
(keyfunc) &kbfun_normal_press_release, // Lh┳0 on LF
|
||||
(keyfunc) &kbfun_normal_press_release, // Lh┳0 on LD
|
||||
|
@ -965,14 +965,14 @@ static const keyfunc PROGMEM _kb_layout_func[KB_ROWS][KB_COLUMNS][KB_LAYERS] = {
|
|||
},
|
||||
{ // row 3 x col 8
|
||||
(keyfunc) &kbfun_normal_press_release, // Rh┳0 on LB
|
||||
(keyfunc) &kbfun_shift_press_release, // Rh┳0 on LP
|
||||
(keyfunc) &kbfun_shift_press_release_once, // Rh┳0 on LP
|
||||
(keyfunc) &kbfun_normal_press_release, // Rh┳0 on LN
|
||||
(keyfunc) &kbfun_normal_press_release, // Rh┳0 on LF
|
||||
(keyfunc) &kbfun_normal_press_release, // Rh┳0 on LD
|
||||
},
|
||||
{ // row 3 x col 9
|
||||
(keyfunc) &kbfun_normal_press_release, // Rh┳1 on LB
|
||||
(keyfunc) &kbfun_shift_press_release, // Rh┳1 on LP
|
||||
(keyfunc) &kbfun_shift_press_release_once, // Rh┳1 on LP
|
||||
(keyfunc) &kbfun_normal_press_release, // Rh┳1 on LN
|
||||
(keyfunc) &kbfun_normal_press_release, // Rh┳1 on LF
|
||||
(keyfunc) &kbfun_normal_press_release, // Rh┳1 on LD
|
||||
|
@ -986,7 +986,7 @@ static const keyfunc PROGMEM _kb_layout_func[KB_ROWS][KB_COLUMNS][KB_LAYERS] = {
|
|||
},
|
||||
{ // row 3 x col 11
|
||||
(keyfunc) &kbfun_normal_press_release, // Rh┳3 on LB
|
||||
(keyfunc) &kbfun_shift_press_release, // Rh┳3 on LP
|
||||
(keyfunc) &kbfun_shift_press_release_once, // Rh┳3 on LP
|
||||
(keyfunc) &kbfun_normal_press_release, // Rh┳3 on LN
|
||||
(keyfunc) &kbfun_normal_press_release, // Rh┳3 on LF
|
||||
(keyfunc) &kbfun_normal_press_release, // Rh┳3 on LD
|
||||
|
@ -1016,7 +1016,7 @@ static const keyfunc PROGMEM _kb_layout_func[KB_ROWS][KB_COLUMNS][KB_LAYERS] = {
|
|||
},
|
||||
{ // row 4 x col 1
|
||||
(keyfunc) &kbfun_normal_press_release, // Lt┳4 on LB
|
||||
(keyfunc) &kbfun_shift_press_release, // Lt┳4 on LP
|
||||
(keyfunc) &kbfun_shift_press_release_once, // Lt┳4 on LP
|
||||
(keyfunc) &kbfun_normal_press_release, // Lt┳4 on LN
|
||||
(keyfunc) &kbfun_normal_press_release, // Lt┳4 on LF
|
||||
(keyfunc) &kbfun_normal_press_release, // Lt┳4 on LD
|
||||
|
@ -1037,7 +1037,7 @@ static const keyfunc PROGMEM _kb_layout_func[KB_ROWS][KB_COLUMNS][KB_LAYERS] = {
|
|||
},
|
||||
{ // row 4 x col 4
|
||||
(keyfunc) &kbfun_normal_press_release, // Lt┳1 on LB
|
||||
(keyfunc) &kbfun_shift_press_release, // Lt┳1 on LP
|
||||
(keyfunc) &kbfun_shift_press_release_once, // Lt┳1 on LP
|
||||
(keyfunc) &kbfun_normal_press_release, // Lt┳1 on LN
|
||||
(keyfunc) &kbfun_normal_press_release, // Lt┳1 on LF
|
||||
(keyfunc) &kbfun_normal_press_release, // Lt┳1 on LD
|
||||
|
@ -1072,14 +1072,14 @@ static const keyfunc PROGMEM _kb_layout_func[KB_ROWS][KB_COLUMNS][KB_LAYERS] = {
|
|||
},
|
||||
{ // row 4 x col 9
|
||||
(keyfunc) &kbfun_normal_press_release, // Rt┳1 on LB
|
||||
(keyfunc) &kbfun_shift_press_release, // Rt┳1 on LP
|
||||
(keyfunc) &kbfun_shift_press_release_once, // Rt┳1 on LP
|
||||
(keyfunc) &kbfun_normal_press_release, // Rt┳1 on LN
|
||||
(keyfunc) &kbfun_normal_press_release, // Rt┳1 on LF
|
||||
(keyfunc) &kbfun_normal_press_release, // Rt┳1 on LD
|
||||
},
|
||||
{ // row 4 x col 10
|
||||
(keyfunc) &kbfun_normal_press_release, // Rt┳2 on LB
|
||||
(keyfunc) &kbfun_shift_press_release, // Rt┳2 on LP
|
||||
(keyfunc) &kbfun_shift_press_release_once, // Rt┳2 on LP
|
||||
(keyfunc) &kbfun_normal_press_release, // Rt┳2 on LN
|
||||
(keyfunc) &kbfun_normal_press_release, // Rt┳2 on LF
|
||||
(keyfunc) &kbfun_normal_press_release, // Rt┳2 on LD
|
||||
|
|
28
src/main.c
28
src/main.c
|
@ -471,6 +471,29 @@ void _kbfun_combo_normal_press_release(keycode combo_key, keycode key, bool is_p
|
|||
kbfun_normal_press_release(key, is_pressed);
|
||||
}
|
||||
|
||||
void _kbfun_combo_normal_press_release_once(keycode combo_key, keycode key, bool is_pressed) {
|
||||
// FIXME this should be cleaner when we have actual key repeats
|
||||
|
||||
if (is_pressed) {
|
||||
// avoid messing with independently pressed modifiers
|
||||
bool mod_already_pressed = _kbfun_modifier_is_pressed(combo_key);
|
||||
|
||||
if (!mod_already_pressed) {
|
||||
_kbfun_modifier_press_release(combo_key, true);
|
||||
}
|
||||
|
||||
kbfun_normal_press_release(key, true);
|
||||
|
||||
if (!mod_already_pressed) {
|
||||
// we force a keyboard send to prevent the modifier from bleeding into the next key press
|
||||
usb_keyboard_send();
|
||||
_kbfun_modifier_press_release(combo_key, false);
|
||||
}
|
||||
} else {
|
||||
kbfun_normal_press_release(key, false);
|
||||
}
|
||||
}
|
||||
|
||||
void _kbfun_combo_layer_press_release(keycode combo_key, keycode key, bool is_pressed) {
|
||||
kbfun_layer_press_release(key, is_pressed);
|
||||
_kbfun_modifier_press_release(combo_key, is_pressed);
|
||||
|
@ -481,6 +504,11 @@ void kbfun_control_press_release(keycode key, bool is_pressed) { _kbfun_combo_no
|
|||
void kbfun_alt_press_release(keycode key, bool is_pressed) { _kbfun_combo_normal_press_release(MOD_KEY_LeftAlt, key, is_pressed); } // +alt
|
||||
void kbfun_win_press_release(keycode key, bool is_pressed) { _kbfun_combo_normal_press_release(MOD_KEY_LeftGUI, key, is_pressed); } // +win
|
||||
|
||||
void kbfun_shift_press_release_once(keycode key, bool is_pressed) { _kbfun_combo_normal_press_release_once(MOD_KEY_LeftShift, key, is_pressed); } // +shift once
|
||||
void kbfun_control_press_release_once(keycode key, bool is_pressed) { _kbfun_combo_normal_press_release_once(MOD_KEY_LeftControl, key, is_pressed); } // +control once
|
||||
void kbfun_alt_press_release_once(keycode key, bool is_pressed) { _kbfun_combo_normal_press_release_once(MOD_KEY_LeftAlt, key, is_pressed); } // +alt once
|
||||
void kbfun_win_press_release_once(keycode key, bool is_pressed) { _kbfun_combo_normal_press_release_once(MOD_KEY_LeftGUI, key, is_pressed); } // +win once
|
||||
|
||||
void kbfun_shift_layer_press_release(keycode key, bool is_pressed) { _kbfun_combo_layer_press_release(MOD_KEY_LeftShift, key, is_pressed); } // +shift + layer
|
||||
void kbfun_control_layer_press_release(keycode key, bool is_pressed) { _kbfun_combo_layer_press_release(MOD_KEY_LeftControl, key, is_pressed); } // +control + layer
|
||||
void kbfun_alt_layer_press_release(keycode key, bool is_pressed) { _kbfun_combo_layer_press_release(MOD_KEY_LeftAlt, key, is_pressed); } // +alt + layer
|
||||
|
|
|
@ -1,10 +1,15 @@
|
|||
/* This file was automatically generated. Do not edit! */
|
||||
void kbfun_capslock_press_release(keycode key,bool is_pressed);
|
||||
void kbfun_win_press_release_once(keycode key,bool is_pressed);
|
||||
void kbfun_alt_press_release_once(keycode key,bool is_pressed);
|
||||
void kbfun_control_press_release_once(keycode key,bool is_pressed);
|
||||
void kbfun_shift_press_release_once(keycode key,bool is_pressed);
|
||||
void kbfun_win_press_release(keycode key,bool is_pressed);
|
||||
void kbfun_alt_press_release(keycode key,bool is_pressed);
|
||||
void kbfun_control_press_release(keycode key,bool is_pressed);
|
||||
void kbfun_shift_press_release(keycode key,bool is_pressed);
|
||||
void _kbfun_combo_layer_press_release(keycode combo_key,keycode key,bool is_pressed);
|
||||
void _kbfun_combo_normal_press_release_once(keycode combo_key,keycode key,bool is_pressed);
|
||||
void _kbfun_combo_normal_press_release(keycode combo_key,keycode key,bool is_pressed);
|
||||
void kbfun_modifier_sticky(keycode key,bool is_pressed);
|
||||
void kbfun_modifier_press_release(keycode key,bool is_pressed);
|
||||
|
|
Loading…
Reference in New Issue