|
|
@ -23,21 +23,19 @@
|
|
|
|
namespace kaleidoscope {
|
|
|
|
namespace kaleidoscope {
|
|
|
|
namespace plugin {
|
|
|
|
namespace plugin {
|
|
|
|
|
|
|
|
|
|
|
|
bool EscapeOneShot::did_escape_;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
EventHandlerResult EscapeOneShot::onKeyswitchEvent(Key &mapped_key, KeyAddr key_addr, uint8_t keyState) {
|
|
|
|
EventHandlerResult EscapeOneShot::onKeyswitchEvent(Key &mapped_key, KeyAddr key_addr, uint8_t keyState) {
|
|
|
|
if (mapped_key != Key_Escape || (keyState & INJECTED))
|
|
|
|
if (mapped_key != Key_Escape || (keyState & INJECTED))
|
|
|
|
return EventHandlerResult::OK;
|
|
|
|
return EventHandlerResult::OK;
|
|
|
|
|
|
|
|
|
|
|
|
if (did_escape_)
|
|
|
|
if (!keyToggledOn(keyState))
|
|
|
|
mapped_key = Key_NoKey;
|
|
|
|
return EventHandlerResult::OK;
|
|
|
|
did_escape_ = !keyToggledOff(keyState);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if ((!::OneShot.isActive() || ::OneShot.isPressed()) && !::OneShot.isSticky()) {
|
|
|
|
if ((!::OneShot.isActive() || ::OneShot.isPressed()) && !::OneShot.isSticky()) {
|
|
|
|
return EventHandlerResult::OK;
|
|
|
|
return EventHandlerResult::OK;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
::OneShot.cancel(true);
|
|
|
|
::OneShot.cancel(true);
|
|
|
|
|
|
|
|
mapped_key = Key_NoKey;
|
|
|
|
return EventHandlerResult::EVENT_CONSUMED;
|
|
|
|
return EventHandlerResult::EVENT_CONSUMED;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|