re-break layer switches to unbreak repeats
parent
fc3a0906f9
commit
5a33a1c21b
35
src/main.c
35
src/main.c
|
@ -68,6 +68,16 @@ static bool layer_sticky_done;
|
|||
static u8 mod_sticky;
|
||||
static bool mod_sticky_done;
|
||||
|
||||
// TODO this only exists as a workaround until we handle our own key repeats
|
||||
static const keyfunc _kb_layer_funcs[] = {
|
||||
&kbfun_layer_press_release,
|
||||
&kbfun_layer_sticky,
|
||||
&kbfun_shift_layer_press_release,
|
||||
&kbfun_control_layer_press_release,
|
||||
&kbfun_alt_layer_press_release,
|
||||
&kbfun_win_layer_press_release,
|
||||
};
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
int main() {
|
||||
|
@ -220,19 +230,32 @@ void layer_disable(layer l) {
|
|||
for (u8 row=0; row<KB_ROWS; row++) {
|
||||
for (u8 col=0; col<KB_COLUMNS; col++) {
|
||||
if (layers_pressed[row][col] == l) {
|
||||
// FIXME this kinda shouldn't be here and it privileges layer 0 even more
|
||||
layers_pressed[row][col] = 0;
|
||||
exec_key(l, row, col, false);
|
||||
keyfunc func = (kb_keyfunc_press(l, row, col));
|
||||
// FIXME don't re-send normal keys until we have key repeats
|
||||
if (is_layer_keyfunc(func)) {
|
||||
// FIXME this kinda shouldn't be here and it privileges layer 0 even more
|
||||
layers_pressed[row][col] = 0;
|
||||
exec_key(l, row, col, false);
|
||||
|
||||
if (! layer_sticky[l]) { // don't resend for sticky keys
|
||||
layers_pressed[row][col] = layers_top;
|
||||
exec_key(layers_top, row, col, true);
|
||||
if (! layer_sticky[l]) { // don't resend for sticky keys
|
||||
layers_pressed[row][col] = layers_top;
|
||||
exec_key(layers_top, row, col, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bool is_layer_keyfunc(keyfunc f) {
|
||||
for (int i=0; i<array_length(_kb_layer_funcs); i++) {
|
||||
if (f == _kb_layer_funcs[i]) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// layout info
|
||||
// ----------------------------------------------------------------------------
|
||||
|
|
15
src/main.h
15
src/main.h
|
@ -1,9 +1,5 @@
|
|||
/* This file was automatically generated. Do not edit! */
|
||||
void kbfun_capslock_press_release(keycode key,bool is_pressed);
|
||||
void kbfun_win_layer_press_release(keycode key,bool is_pressed);
|
||||
void kbfun_alt_layer_press_release(keycode key,bool is_pressed);
|
||||
void kbfun_control_layer_press_release(keycode key,bool is_pressed);
|
||||
void kbfun_shift_layer_press_release(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);
|
||||
|
@ -11,8 +7,6 @@ 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(keycode combo_key,keycode key,bool is_pressed);
|
||||
void kbfun_modifier_sticky(keycode key,bool is_pressed);
|
||||
void kbfun_layer_sticky(keycode key,bool is_pressed);
|
||||
void kbfun_layer_press_release(keycode key,bool is_pressed);
|
||||
void kbfun_modifier_press_release(keycode key,bool is_pressed);
|
||||
void kbfun_mediakey_press_release(keycode key,bool is_pressed);
|
||||
void kbfun_normal_press_release(keycode key,bool is_pressed);
|
||||
|
@ -24,8 +18,9 @@ void _kbfun_modifier_press_release(keycode key,bool is_pressed);
|
|||
void _kbfun_mediakey_press_release(keycode key,bool is_pressed);
|
||||
void _kbfun_normal_press_release(keycode key,bool is_pressed);
|
||||
keyfunc kb_keyfunc_release(layer l,u8 row,u8 col);
|
||||
keyfunc kb_keyfunc_press(layer l,u8 row,u8 col);
|
||||
keycode kb_keycode(layer l,u8 row,u8 col);
|
||||
bool is_layer_keyfunc(keyfunc f);
|
||||
keyfunc kb_keyfunc_press(layer l,u8 row,u8 col);
|
||||
void layer_enable(layer l);
|
||||
layer highest_active_layer();
|
||||
void layer_disable(layer l);
|
||||
|
@ -35,3 +30,9 @@ void init_sticky();
|
|||
void init_layers();
|
||||
void init_hw();
|
||||
int main();
|
||||
void kbfun_win_layer_press_release(keycode key,bool is_pressed);
|
||||
void kbfun_alt_layer_press_release(keycode key,bool is_pressed);
|
||||
void kbfun_control_layer_press_release(keycode key,bool is_pressed);
|
||||
void kbfun_shift_layer_press_release(keycode key,bool is_pressed);
|
||||
void kbfun_layer_sticky(keycode key,bool is_pressed);
|
||||
void kbfun_layer_press_release(keycode key,bool is_pressed);
|
||||
|
|
Loading…
Reference in New Issue