Fix overload bug. (Fixes #34)

If an interposed key up event is detected after an overloaded key is
pressed the overloaded key up event is not interpreted as a tap. This is
especially noticeable in cases where the overloaded key is struck
quickly in succession. This patch modifies the behaviour so only an
interposed key down resolves the overloaded key in favour of its
associated layer.
master
Raheman Vaiya 4 years ago
parent 7ad410d69d
commit ec423d0c01
  1. 2
      Makefile
  2. 6
      src/main.c

@ -7,7 +7,7 @@ LOCK_FILE="/var/lock/keyd.lock"
LOG_FILE="/var/log/keyd.log"
CONFIG_DIR="/etc/keyd"
VERSION=1.3.0
VERSION=1.3.1
GIT_HASH=$(shell git describe --no-match --always --abbrev=40 --dirty)
CFLAGS=-DVERSION=\"$(VERSION)\" \

@ -465,6 +465,10 @@ static void process_key_event(struct keyboard *kbd, uint16_t code, int pressed)
static uint8_t oneshot_layers[MAX_LAYERS] = {0};
static uint64_t last_keyseq_timestamp = 0;
static uint16_t swapped_keycode = 0;
static uint16_t last_keydown = 0;
if(pressed)
last_keydown = code;
uint16_t mods = 0;
@ -488,7 +492,7 @@ static void process_key_event(struct keyboard *kbd, uint16_t code, int pressed)
} else {
layer->active = 0;
if(lastd == d) { //If tapped
if(last_keydown == code) { //If tapped
uint16_t key = keyseq & 0xFFFF;
mods |= keyseq >> 16;

Loading…
Cancel
Save