Cancel pending AutoShift key if another key toggles on

Signed-off-by: Michael Richters <gedankenexperimenter@gmail.com>
pull/1075/head
Michael Richters 3 years ago
parent cb955c7d09
commit c66d252cae
No known key found for this signature in database
GPG Key ID: 1288FD13E4EEF0C0

@ -137,17 +137,26 @@ EventHandlerResult AutoShift::onKeyswitchEvent(KeyEvent &event) {
if (!queue_.isEmpty()) {
// There's an unresolved AutoShift key press.
if (queue_.isFull()) {
if (keyToggledOn(event.state) ||
event.addr == queue_.addr(0) ||
queue_.isFull()) {
// If a new key toggled on, the unresolved key toggled off (it was a
// "tap"), or if the queue is full, we clear the queue, and the key event
// does not get modified.
flushEvent(false);
flushQueue();
} else {
// Otherwise, add the release event to the queue. We do this so that
// rollover from a modifier to an auto-shifted key will result in the
// modifier being applied to the key.
queue_.append(event);
return EventHandlerResult::ABORT;
}
if (queue_.isEmpty())
return EventHandlerResult::OK;
queue_.append(event);
return EventHandlerResult::ABORT;
}
if (keyToggledOn(event.state) && isAutoShiftable(event.key)) {
// The key is eligible to be auto-shifted, so we add it to the queue and
// defer processing of the event.
queue_.append(event);
return EventHandlerResult::ABORT;
}

Loading…
Cancel
Save