diff options
author | dakkar <dakkar@thenautilus.net> | 2019-02-08 21:18:29 +0000 |
---|---|---|
committer | dakkar <dakkar@thenautilus.net> | 2019-02-08 21:18:29 +0000 |
commit | d91f0ada0d8f85e9ee7b9fa82a6665c0b3b26d27 (patch) | |
tree | ac771193113b73681530ec73aba66f44c3ac4089 | |
parent | add "rearrange window" key (diff) | |
download | keyboardio-model01-d91f0ada0d8f85e9ee7b9fa82a6665c0b3b26d27.tar.gz keyboardio-model01-d91f0ada0d8f85e9ee7b9fa82a6665c0b3b26d27.tar.bz2 keyboardio-model01-d91f0ada0d8f85e9ee7b9fa82a6665c0b3b26d27.zip |
simpler "layer colouring"
maybe I should just have a position-dependent map of colors? like they
keymap, but with cRGB elements
-rw-r--r-- | Model01-Firmware.ino | 27 |
1 files changed, 13 insertions, 14 deletions
diff --git a/Model01-Firmware.ino b/Model01-Firmware.ino index 42cf4b4..fff564c 100644 --- a/Model01-Firmware.ino +++ b/Model01-Firmware.ino @@ -267,23 +267,22 @@ protected: Key k = Layer.lookupOnActiveLayer(r, c); uint8_t current_layer = Layer.top(); Key layer_key = Layer.getKey(current_layer, r, c); + bool is_on_layer = (k == layer_key && k != Key_NoKey); cRGB color = color_off; if (current_layer == FVWM) { // FVWM keys - if (k.flags & LALT_HELD) { - switch (k.keyCode) { - case Key_F1.keyCode ... Key_F12.keyCode: case Key_Backtick.keyCode: - color = color_lauch; break; - - case Key_Keypad1.keyCode ... Key_Keypad0.keyCode: case Key_KeypadDivide.keyCode ... Key_KeypadEnter.keyCode: case Key_M.keyCode: - color = color_window; break; + if (is_on_layer) { + color = color_window; + } + switch (k.keyCode) { + case Key_F1.keyCode ... Key_F12.keyCode: case Key_Backtick.keyCode: + color = color_lauch; break; - case Key_LeftArrow.keyCode: case Key_RightArrow.keyCode: case Key_UpArrow.keyCode: case Key_DownArrow.keyCode: - color = color_viewport; break; - } - if (k.flags & SHIFT_HELD) { - color.r >>= 1; color.g >>= 1; color.b >>= 1; - } + case Key_LeftArrow.keyCode: case Key_RightArrow.keyCode: case Key_UpArrow.keyCode: case Key_DownArrow.keyCode: + color = color_viewport; break; + } + if (k.flags & SHIFT_HELD) { + color.r >>= 1; color.g >>= 1; color.b >>= 1; } } else if (current_layer == FUNCTION) { @@ -295,7 +294,7 @@ protected: if (k.keyCode & KEY_MOUSE_WARP) { color = color_mouse_warp; } else if (k.keyCode & KEY_MOUSE_BUTTON) { color = color_mouse_button; } } - else if (k == layer_key && k != Key_NoKey) { + else if (is_on_layer) { color = color_function; } } |