Remove now-obsolete idle checks from a few plugins

A long-long time ago, Kaleidoscope used to call `onKeyswitchEvent` (or rather,
it's then-current incarnation) even when keys were idle. For a number of
plugins, this was a case they didn't want to handle, and bailed out early.

When we changed Kaleidoscope to not call the event handlers for idle keys, these
plugins weren't modified at the same time, and the superfluous check remained,
making the firmware both larger and marginally slower.

Since the event handlers are never called when idle, it is safe to remove these
checks.

Affected plugins are `Leader`, `OneShot`, and `TapDance`.

Signed-off-by: Gergely Nagy <algernon@keyboard.io>
pull/437/head
Gergely Nagy 6 years ago
parent 5319898e78
commit aad2dfe2cc
No known key found for this signature in database
GPG Key ID: AC1E90BAC433F68F

@ -85,13 +85,6 @@ EventHandlerResult Leader::onKeyswitchEvent(Key &mapped_key, byte row, byte col,
if (keyState & INJECTED) if (keyState & INJECTED)
return EventHandlerResult::OK; return EventHandlerResult::OK;
if (!keyIsPressed(keyState) && !keyWasPressed(keyState)) {
if (isLeader(mapped_key)) {
return EventHandlerResult::EVENT_CONSUMED;
}
return EventHandlerResult::OK;
}
if (!isActive() && !isLeader(mapped_key)) if (!isActive() && !isLeader(mapped_key))
return EventHandlerResult::OK; return EventHandlerResult::OK;

@ -121,9 +121,6 @@ EventHandlerResult OneShot::onKeyswitchEvent(Key &mapped_key, byte row, byte col
return EventHandlerResult::EVENT_CONSUMED; return EventHandlerResult::EVENT_CONSUMED;
} }
if (!keyIsPressed(keyState) && !keyWasPressed(keyState))
return EventHandlerResult::OK;
if (isOneShotKey(mapped_key)) { if (isOneShotKey(mapped_key)) {
if (isSticky_(idx)) { if (isSticky_(idx)) {
if (keyToggledOn(keyState)) { // maybe on _off instead? if (keyToggledOn(keyState)) { // maybe on _off instead?

@ -123,14 +123,6 @@ EventHandlerResult TapDance::onKeyswitchEvent(Key &mapped_key, byte row, byte co
if (keyState & INJECTED) if (keyState & INJECTED)
return EventHandlerResult::OK; return EventHandlerResult::OK;
if (!keyIsPressed(keyState) && !keyWasPressed(keyState)) {
if (isTapDance(mapped_key)) {
return EventHandlerResult::EVENT_CONSUMED;
}
return EventHandlerResult::OK;
}
if (!isTapDance(mapped_key)) { if (!isTapDance(mapped_key)) {
if (!isActive()) if (!isActive())
return EventHandlerResult::OK; return EventHandlerResult::OK;

Loading…
Cancel
Save