Lift out the `isOS` macro into `OneShot.isOneShotKey`.

Signed-off-by: Gergely Nagy <kaleidoscope@gergo.csillger.hu>
pull/389/head
Gergely Nagy 7 years ago
parent 5cd5eab50d
commit f39cb776a3

@ -36,7 +36,7 @@ bool OneShot::should_mask_on_interrupt_ = false;
// --- helper macros ------
#define isOS(key) (key.raw >= ranges::OS_FIRST && key.raw <= ranges::OS_LAST)
#define isOneShotKey(key) (key.raw >= ranges::OS_FIRST && key.raw <= ranges::OS_LAST)
#define isModifier(key) (key.raw >= Key_LeftControl.raw && key.raw <= Key_RightGui.raw)
#define isLayerKey(key) (key.flags == (KEY_FLAGS | SYNTHETIC | SWITCH_TO_KEYMAP) && key.keyCode >= MOMENTARY_OFFSET && key.keyCode <= MOMENTARY_OFFSET + 23)
@ -88,7 +88,7 @@ Key OneShot::eventHandlerHook(Key mapped_key, byte row, byte col, uint8_t key_st
return mapped_key;
if (!state_.all) {
if (!isOS(mapped_key)) {
if (!isOneShotKey(mapped_key)) {
return mapped_key;
}
@ -113,7 +113,7 @@ Key OneShot::eventHandlerHook(Key mapped_key, byte row, byte col, uint8_t key_st
if (!keyIsPressed(key_state) && !keyWasPressed(key_state))
return mapped_key;
if (isOS(mapped_key)) {
if (isOneShotKey(mapped_key)) {
if (isSticky(idx)) {
if (keyToggledOn(key_state)) { // maybe on _off instead?
saveAsPrevious(mapped_key);

@ -32,6 +32,9 @@ class OneShot : public KaleidoscopePlugin {
void begin(void) final;
static bool isOneShotKey(Key key) {
return (key.raw >= kaleidoscope::ranges::OS_FIRST && key.raw <= kaleidoscope::ranges::OS_LAST);
}
static bool isActive(void);
static void cancel(bool with_stickies);
static void cancel(void) {

Loading…
Cancel
Save