Update OneShot library to use new key defs

pull/389/head
Jesse Vincent 8 years ago
parent 14ed3a2b18
commit c892b4a30a
No known key found for this signature in database
GPG Key ID: 122F5DF7108E4046

@ -36,7 +36,7 @@ plugin:
#include <Kaleidoscope-OneShot.h> #include <Kaleidoscope-OneShot.h>
// somewhere in the keymap... // somewhere in the keymap...
OSM(LCtrl), OSL(_FN) OSM(LeftControl), OSL(_FN)
void setup () { void setup () {
Kaleidoscope.setup (); Kaleidoscope.setup ();

@ -25,9 +25,9 @@ const Key keymaps[][ROWS][COLS] PROGMEM = {
Key_NoKey, Key_1, Key_2, Key_3, Key_4, Key_5, Key_NoKey, Key_NoKey, Key_1, Key_2, Key_3, Key_4, Key_5, Key_NoKey,
Key_Backtick, Key_Q, Key_W, Key_E, Key_R, Key_T, Key_Tab, Key_Backtick, Key_Q, Key_W, Key_E, Key_R, Key_T, Key_Tab,
Key_PageUp, Key_A, Key_S, Key_D, Key_F, Key_G, Key_PageUp, Key_A, Key_S, Key_D, Key_F, Key_G,
Key_PageDn, Key_Z, Key_X, Key_C, Key_V, Key_B, Key_Esc, Key_PageDown, Key_Z, Key_X, Key_C, Key_V, Key_B, Key_Escape,
OSM(LCtrl), Key_Backspace, OSM(LGUI), Key_LShift, OSM(LeftControl), Key_Backspace, OSM(LeftGui), Key_LeftShift,
Key_Keymap1_Momentary, Key_Keymap1_Momentary,
Key_skip, Key_6, Key_7, Key_8, Key_9, Key_0, Key_skip, Key_skip, Key_6, Key_7, Key_8, Key_9, Key_0, Key_skip,
@ -35,7 +35,7 @@ const Key keymaps[][ROWS][COLS] PROGMEM = {
Key_H, Key_J, Key_K, Key_L, Key_Semicolon, Key_Quote, Key_H, Key_J, Key_K, Key_L, Key_Semicolon, Key_Quote,
Key_skip, Key_N, Key_M, Key_Comma, Key_Period, Key_Slash, Key_Minus, Key_skip, Key_N, Key_M, Key_Comma, Key_Period, Key_Slash, Key_Minus,
Key_RShift, OSM(RAlt), Key_Space, OSM(RCtrl), Key_RightShift, OSM(RoghtAlt), Key_Spacebar, OSM(RightControl),
OSL(1) OSL(1)
), ),
@ -49,10 +49,10 @@ const Key keymaps[][ROWS][COLS] PROGMEM = {
___, ___, ___, ___, ___, ___, ___, ___,
___, ___,
___, ___, ___, ___, ___, ___, ___, ___, ___, ___, ___, ___, ___, ___,
___, ___, ___, ___, ___, ___, ___, ___, ___, ___, ___, ___, ___, ___,
Key_UpArrow, Key_DnArrow, Key_LArrow, Key_RArrow, ___, ___, Key_UpArrow, Key_DownArrow, Key_LeftArrow, Key_RightArrow, ___, ___,
___, ___, ___, ___, ___, ___, ___, ___, ___, ___, ___, ___, ___, ___,
___, ___, ___, ___, ___, ___, ___, ___,
___ ___

@ -38,7 +38,7 @@ namespace KaleidoscopePlugins {
// --- helper macros ------ // --- helper macros ------
#define isOS(key) (key.raw >= OS_FIRST && key.raw <= OS_LAST) #define isOS(key) (key.raw >= OS_FIRST && key.raw <= OS_LAST)
#define isModifier(key) (key.raw >= Key_LCtrl.raw && key.raw <= Key_RGUI.raw) #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) #define isLayerKey(key) (key.flags == (KEY_FLAGS | SYNTHETIC | SWITCH_TO_KEYMAP) && key.keyCode >= MOMENTARY_OFFSET && key.keyCode <= MOMENTARY_OFFSET + 23)
#define isOneShot(idx) (bitRead (State.all, (idx))) #define isOneShot(idx) (bitRead (State.all, (idx)))
@ -64,8 +64,8 @@ namespace KaleidoscopePlugins {
Key key; Key key;
if (idx < 8) { if (idx < 8) {
key.flags = Key_LCtrl.flags; key.flags = Key_LeftControl.flags;
key.keyCode = Key_LCtrl.keyCode + idx; key.keyCode = Key_LeftControl.keyCode + idx;
} else { } else {
key.flags = KEY_FLAGS | SYNTHETIC | SWITCH_TO_KEYMAP; key.flags = KEY_FLAGS | SYNTHETIC | SWITCH_TO_KEYMAP;
key.keyCode = MOMENTARY_OFFSET + idx - 8; key.keyCode = MOMENTARY_OFFSET + idx - 8;
@ -257,10 +257,10 @@ namespace KaleidoscopePlugins {
bool bool
OneShot::isModifierActive (Key key) { OneShot::isModifierActive (Key key) {
if (key.raw < Key_LCtrl.raw || key.raw > Key_RGUI.raw) if (key.raw < Key_LeftControl.raw || key.raw > Key_RightGui.raw)
return false; return false;
return isOneShot (key.keyCode - Key_LCtrl.keyCode); return isOneShot (key.keyCode - Key_LeftControl.keyCode);
} }
void void

@ -21,7 +21,7 @@
#include <Kaleidoscope.h> #include <Kaleidoscope.h>
#include <Kaleidoscope-Ranges.h> #include <Kaleidoscope-Ranges.h>
#define OSM(kc) (Key) {.raw = KaleidoscopePlugins::Ranges::OSM_FIRST + (Key_ ## kc).keyCode - Key_LCtrl.keyCode} #define OSM(kc) (Key) {.raw = KaleidoscopePlugins::Ranges::OSM_FIRST + (Key_ ## kc).keyCode - Key_LeftControl.keyCode}
#define OSL(n) (Key) {.raw = KaleidoscopePlugins::Ranges::OSL_FIRST + n} #define OSL(n) (Key) {.raw = KaleidoscopePlugins::Ranges::OSL_FIRST + n}
namespace KaleidoscopePlugins { namespace KaleidoscopePlugins {

Loading…
Cancel
Save