Merge pull request #341 from keyboardio/h/example-fixes

Fix the AppSwitcher and Kaleidoscope examples
pull/345/head
Jesse Vincent 7 years ago committed by GitHub
commit 88c1d3d7e1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -64,5 +64,6 @@ void setup() {
} }
void loop() { void loop() {
macroAppSwitchLoop();
Kaleidoscope.loop(); Kaleidoscope.loop();
} }

@ -41,11 +41,6 @@ const macro_t *macroAppSwitch(uint8_t keyState) {
if (keyToggledOff(keyState)) { if (keyToggledOff(keyState)) {
return MACRO(U(Tab), Dr(mod)); return MACRO(U(Tab), Dr(mod));
} }
// Key is not pressed, and was not just released.
// if appSwitchActive is true, we continue holding Alt.
if (appSwitchActive) {
return MACRO(Dr(mod));
}
// otherwise we do nothing // otherwise we do nothing
return MACRO_NONE; return MACRO_NONE;
} }
@ -55,3 +50,15 @@ const macro_t *macroAppCancel(uint8_t keyState) {
appSwitchActive = false; appSwitchActive = false;
return MACRO_NONE; return MACRO_NONE;
} }
void macroAppSwitchLoop() {
Key mod = Key_LeftAlt;
if (HostOS.os() == H::OSX)
mod = Key_LeftGui;
// if appSwitchActive is true, we continue holding Alt.
if (appSwitchActive) {
handleKeyswitchEvent(mod, UNKNOWN_KEYSWITCH_LOCATION, IS_PRESSED);
}
}

@ -28,3 +28,4 @@ enum {
const macro_t *macroAppSwitch(uint8_t keyState); const macro_t *macroAppSwitch(uint8_t keyState);
const macro_t *macroAppCancel(uint8_t keyState); const macro_t *macroAppCancel(uint8_t keyState);
void macroAppSwitchLoop();

@ -7,7 +7,7 @@
#include "Kaleidoscope-MouseKeys.h" #include "Kaleidoscope-MouseKeys.h"
#include "Kaleidoscope-Macros.h" #include "Kaleidoscope-Macros.h"
#include "Kaleidoscope-LEDControl.h" #include "Kaleidoscope-LEDControl.h"
#include "Kaleidoscope-Numlock.h" #include "Kaleidoscope-NumPad.h"
#include "Kaleidoscope.h" #include "Kaleidoscope.h"
#include "LED-Off.h" #include "LED-Off.h"
@ -87,14 +87,14 @@ const macro_t *macroAction(uint8_t macroIndex, uint8_t keyState) {
KALEIDOSCOPE_INIT_PLUGINS(TestMode, KALEIDOSCOPE_INIT_PLUGINS(TestMode,
LEDControl, LEDOff, LEDControl, LEDOff,
solidRed, solidOrange, solidYellow, solidGreen, solidBlue, solidIndigo, solidViolet, solidRed, solidOrange, solidYellow, solidGreen, solidBlue, solidIndigo, solidViolet,
LEDBreatheEffect, LEDRainbowEffect, LEDChaseEffect, NumLock, LEDBreatheEffect, LEDRainbowEffect, LEDChaseEffect, NumPad,
Macros, Macros,
MouseKeys); MouseKeys);
void setup() { void setup() {
Kaleidoscope.setup(); Kaleidoscope.setup();
NumLock.numPadLayer = NUMPAD_KEYMAP; NumPad.numPadLayer = NUMPAD_KEYMAP;
LEDOff.activate(); LEDOff.activate();
} }

Loading…
Cancel
Save