|
|
|
|
@ -536,7 +536,6 @@ static long process_descriptor(struct keyboard *kbd, uint8_t code, |
|
|
|
|
kbd->delayedphase = 3; // resolve the delay
|
|
|
|
|
if (!pressed && code == kbd->delayedcode0) { |
|
|
|
|
// this is the whole point of the delayed business
|
|
|
|
|
dbg("supposedly not wanting to use it as a mod"); |
|
|
|
|
kbd->keyfrozenstate[kbd->delayedcode0] = 1; |
|
|
|
|
process_descriptor(kbd, kbd->delayedcode0, |
|
|
|
|
&kbd->delayeddescriptor0, dl, 1, time); |
|
|
|
|
@ -717,7 +716,6 @@ static long process_descriptor(struct keyboard *kbd, uint8_t code, |
|
|
|
|
|
|
|
|
|
break; |
|
|
|
|
case OP_OVERLOAD_HACK: |
|
|
|
|
dbg("overload_hack"); |
|
|
|
|
idx = d->args[0].idx; // This is the overloaded layer
|
|
|
|
|
action = &kbd->config.descriptors[d->args[1].idx]; |
|
|
|
|
// This is the key to press, or the action to perform
|
|
|
|
|
@ -729,7 +727,6 @@ static long process_descriptor(struct keyboard *kbd, uint8_t code, |
|
|
|
|
// record that we are pretending this key is a regular key so
|
|
|
|
|
// that we do not get confused on release
|
|
|
|
|
// how do I capture that?
|
|
|
|
|
dbg("here we should implement the hack %d", code); |
|
|
|
|
kbd->keyhackstate[code]=1; |
|
|
|
|
// pretend it is a regular keypress
|
|
|
|
|
process_descriptor(kbd, code, action, dl, 1, time); |
|
|
|
|
@ -769,55 +766,49 @@ static long process_descriptor(struct keyboard *kbd, uint8_t code, |
|
|
|
|
break; |
|
|
|
|
case OP_OVERLOAD_DELAYED: //At the moment this is just a copy of
|
|
|
|
|
//overload
|
|
|
|
|
dbg("overload_delayed - got here"); |
|
|
|
|
idx = d->args[0].idx; |
|
|
|
|
action = &kbd->config.descriptors[d->args[1].idx]; |
|
|
|
|
if (pressed && kbd->delayedphase == 0) { |
|
|
|
|
dbg("overload_delayed - initial press"); |
|
|
|
|
kbd->delayedcode0 = code; |
|
|
|
|
kbd->delayeddescriptor0 = *d; |
|
|
|
|
kbd->delayedphase = 1; |
|
|
|
|
} else if (pressed) { |
|
|
|
|
dbg("overload_delayed - press"); |
|
|
|
|
if (kbd->keyfrozenstate[code]) { |
|
|
|
|
dbg("overload_delayed - frozen press"); |
|
|
|
|
// pressed while frozen; pretend it is the action
|
|
|
|
|
process_descriptor(kbd, code, action, dl, 1, time); |
|
|
|
|
kbd->keyfrozenstate[code] = 0; |
|
|
|
|
} else { |
|
|
|
|
kbd->overload_start_time = time; |
|
|
|
|
activate_layer(kbd, code, idx); |
|
|
|
|
update_mods(kbd, -1, 0); |
|
|
|
|
} |
|
|
|
|
} else { |
|
|
|
|
if (kbd->keyfrozenstate [code]) { |
|
|
|
|
dbg("overload_delayed - frozen release"); |
|
|
|
|
// released while frozen, pretend it is the action
|
|
|
|
|
process_descriptor(kbd, code, action, dl, 0, time); |
|
|
|
|
kbd->keyfrozenstate[code] = 0; |
|
|
|
|
} else { |
|
|
|
|
deactivate_layer(kbd, idx); |
|
|
|
|
update_mods(kbd, -1, 0); |
|
|
|
|
idx = d->args[0].idx; |
|
|
|
|
action = &kbd->config.descriptors[d->args[1].idx]; |
|
|
|
|
if (pressed && kbd->delayedphase == 0) { |
|
|
|
|
kbd->delayedcode0 = code; |
|
|
|
|
kbd->delayeddescriptor0 = *d; |
|
|
|
|
kbd->delayedphase = 1; |
|
|
|
|
} else if (pressed) { |
|
|
|
|
if (kbd->keyfrozenstate[code]) { |
|
|
|
|
// pressed while frozen; pretend it is the action
|
|
|
|
|
process_descriptor(kbd, code, action, dl, 1, time); |
|
|
|
|
kbd->keyfrozenstate[code] = 0; |
|
|
|
|
} else { // pressed but not frozen
|
|
|
|
|
kbd->overload_start_time = time; |
|
|
|
|
activate_layer(kbd, code, idx); |
|
|
|
|
update_mods(kbd, -1, 0); |
|
|
|
|
} |
|
|
|
|
} else { // not pressed
|
|
|
|
|
if (kbd->keyfrozenstate [code]) { // frozen
|
|
|
|
|
// released while frozen, pretend it is the action
|
|
|
|
|
process_descriptor(kbd, code, action, dl, 0, time); |
|
|
|
|
kbd->keyfrozenstate[code] = 0; |
|
|
|
|
} else { // not frozen
|
|
|
|
|
deactivate_layer(kbd, idx); |
|
|
|
|
update_mods(kbd, -1, 0); |
|
|
|
|
|
|
|
|
|
if (kbd->last_pressed_code == code && |
|
|
|
|
(!kbd->config.overload_tap_timeout || |
|
|
|
|
((time - kbd->overload_start_time) < kbd->config.overload_tap_timeout))) { |
|
|
|
|
if (action->op == OP_MACRO) { |
|
|
|
|
/*
|
|
|
|
|
* Macro release relies on event logic, so we can't just synthesize a |
|
|
|
|
* descriptor release. |
|
|
|
|
*/ |
|
|
|
|
struct macro *macro = &kbd->config.macros[action->args[0].idx]; |
|
|
|
|
execute_macro(kbd, dl, macro); |
|
|
|
|
} else { |
|
|
|
|
process_descriptor(kbd, code, action, dl, 1, time); |
|
|
|
|
process_descriptor(kbd, code, action, dl, 0, time); |
|
|
|
|
} |
|
|
|
|
if (kbd->last_pressed_code == code && |
|
|
|
|
(!kbd->config.overload_tap_timeout || |
|
|
|
|
((time - kbd->overload_start_time) < kbd->config.overload_tap_timeout))) { |
|
|
|
|
if (action->op == OP_MACRO) { |
|
|
|
|
/*
|
|
|
|
|
* Macro release relies on event logic, so we can't just synthesize a |
|
|
|
|
* descriptor release. |
|
|
|
|
*/ |
|
|
|
|
struct macro *macro = &kbd->config.macros[action->args[0].idx]; |
|
|
|
|
execute_macro(kbd, dl, macro); |
|
|
|
|
} else { |
|
|
|
|
process_descriptor(kbd, code, action, dl, 1, time); |
|
|
|
|
process_descriptor(kbd, code, action, dl, 0, time); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
break; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
break; |
|
|
|
|
case OP_ONESHOTM: |
|
|
|
|
case OP_ONESHOT: |
|
|
|
|
idx = d->args[0].idx; |
|
|
|
|
|