Fix layer + overload bug.

Pressing an overloaded key while the layer it is bound to is active
causes permanent activation since it is first cleared by the overloaded
key up event and then subsequently reset by the layer key up event.

In most cases the user is unlikely to have multiple keys corresponding
to the same layer active at the same time, however in the case of
overloaded keys it is sometimes desirable to combine the keycodes to
which they are bound with the same modifier layer to which they are also
bound.

To achieve this we toggle on the overload key down/up rather than
explicitly set the layer to achieve the desired effect in the unusual
case where it is combined with another activation key for the same
layer. This is the same technique we use for layer + layert combos
acting on the same layer.
master
Raheman Vaiya 5 years ago
parent b8d6f5a347
commit 0f9db2eb94
  1. 4
      src/main.c

@ -407,10 +407,10 @@ static void process_event(struct keyboard *kbd, struct input_event *ev)
layer = kbd->layers[d->arg2.layer];
if(pressed) {
layer->active = 1;
layer->active = !layer->active;
layer->timestamp = get_time();
} else {
layer->active = 0;
layer->active = !layer->active;
if(lastd == d) { //If tapped
uint16_t key = keyseq & 0xFFFF;

Loading…
Cancel
Save