Use Qukeys min prior interval only after printable characters

Some users have pointed out that certain keys (in particular, `space` &
`backspace`) are inconvenient to require the minimum prior interval to make a
qukey resolve to a modifier (especially `shift`). We could blacklist those keys,
but it's hard to predict what they all might be. The problem is mainly one for
very fast typists, and therefore I expect it to show up when following the
"normal" printable keys, not often other keys.

This could also be made into a configurable list, but I'd prefer not to do so
unless there's serious demand for it, as Qukeys already has too many settings.

Signed-off-by: Michael Richters <gedankenexperimenter@gmail.com>
pull/929/head
Michael Richters 4 years ago
parent 32aa6374ec
commit 83a0037971
No known key found for this signature in database
GPG Key ID: 1288FD13E4EEF0C0

@ -20,8 +20,9 @@ the output, particularly when typing fast:
- `Qukeys.setMinimumHoldTime(ms)` sets the minimum duration of a qukey press
required for it to be eligible to take on its alternate (modifier) value.
- `Qukeys.setMinimumPriorInterval(ms)` sets the minimum interval between the
previous non-modifier key press and the press of the qukey required to make
the qukey eligible to take on its alternate (modifier) value.
previous printable (letters, numbers, and punctuation) key press and the press
of the qukey required to make the qukey eligible to take on its alternate
(modifier) value.
### KALEIDOSCOPE_API_VERSION bump

@ -185,7 +185,7 @@ bool Qukeys::processQueue() {
// key, so we don't need to do it repeatedly later.
bool qukey_is_spacecadet = isModifierKey(queue_head_.primary_key);
// If the qukey press followed a non-modifier key too closely, it's not
// If the qukey press is followed a printable key too closely, it's not
// eligible to take on its alternate value unless it's a SpaceCadet-type key.
if (!Runtime.hasTimeExpired(prior_keypress_timestamp_,
minimum_prior_interval_) &&
@ -291,8 +291,13 @@ void Qukeys::flushEvent(Key event_key) {
KeyAddr queue_head_addr = event_queue_.addr(0);
uint8_t keyswitch_state = event_queue_.isRelease(0) ? WAS_PRESSED : IS_PRESSED;
// If the flushed event is a keypress of a non-modifier, record its timestamp:
if (!event_queue_.isRelease(0) && !isModifierKey(event_key)) {
// If the flushed event is a keypress of a printable symbol, record its
// timestamp. This lets us suppress some unintended alternate values seen by
// fast typists by requiring a minimum interval between this keypress and the
// next qukey press in order for that qukey to become alternate-eligible.
if (!event_queue_.isRelease(0) &&
((event_key >= Key_A && event_key <= Key_0) ||
(event_key >= Key_Minus && event_key <= Key_Slash))) {
prior_keypress_timestamp_ = event_queue_.timestamp(0);
}

Loading…
Cancel
Save