From dfb710f705b23bf76c4e33505e054729e8a32b05 Mon Sep 17 00:00:00 2001 From: Jesse Vincent Date: Wed, 16 Dec 2020 16:57:03 -0800 Subject: [PATCH] Move key def sections into a subdirectory to make the codebase a bit cleaner. These should never have been getting called directly by end-user code, although the URLs were referenced as a resource in docs. --- docs/customization/keycodes.md | 8 ++++---- src/kaleidoscope/key_defs.h | 11 +++++------ .../{key_defs_aliases.h => key_defs/aliases.h} | 0 .../consumerctl.h} | 0 .../{key_defs_keyboard.h => key_defs/keyboard.h} | 0 .../{key_defs_keymaps.h => key_defs/keymaps.h} | 0 .../{key_defs_sysctl.h => key_defs/sysctl.h} | 0 testing/setup-googletest.h | 2 +- tests/examples/basic-keypress/basic-keypress.ino | 8 ++++---- .../hid-v1.2-consumer-keys/hid-v1.2-consumer-keys.ino | 8 ++++---- tests/issues/840/840.ino | 8 ++++---- 11 files changed, 22 insertions(+), 23 deletions(-) rename src/kaleidoscope/{key_defs_aliases.h => key_defs/aliases.h} (100%) rename src/kaleidoscope/{key_defs_consumerctl.h => key_defs/consumerctl.h} (100%) rename src/kaleidoscope/{key_defs_keyboard.h => key_defs/keyboard.h} (100%) rename src/kaleidoscope/{key_defs_keymaps.h => key_defs/keymaps.h} (100%) rename src/kaleidoscope/{key_defs_sysctl.h => key_defs/sysctl.h} (100%) diff --git a/docs/customization/keycodes.md b/docs/customization/keycodes.md index f61901e2..6abd36c2 100644 --- a/docs/customization/keycodes.md +++ b/docs/customization/keycodes.md @@ -4,16 +4,16 @@ Eventually there should be a helpful table here with good definitions for the co - Most of the common keyboard key codes are here: - [key_defs_keyboard.h](https://github.com/keyboardio/Kaleidoscope/blob/master/src/kaleidoscope/key_defs_keyboard.h) + [key_defs/keyboard.h](https://github.com/keyboardio/Kaleidoscope/blob/master/src/kaleidoscope/key_defs/keyboard.h) - Key codes for system tasks like shutting down, switching windows, and moving through menus are here: - [key_defs_sysctl.h](https://github.com/keyboardio/Kaleidoscope/blob/master/src/kaleidoscope/key_defs_sysctl.h) + [key_defs/sysctl.h](https://github.com/keyboardio/Kaleidoscope/blob/master/src/kaleidoscope/key_defs/sysctl.h) - A wide range of key codes for controlling consumer electronics, most of which are probably not relevant, are in this file: - [key_defs_consumerctl.h](https://github.com/keyboardio/Kaleidoscope/blob/master/src/kaleidoscope/key_defs_consumerctl.h) + [key_defs/consumerctl.h](https://github.com/keyboardio/Kaleidoscope/blob/master/src/kaleidoscope/key_defs/consumerctl.h) ## In-keymap chorded keys -In addition, the keys in `key_defs_keyboard.h` can be augmented with modifier macros: `LCTRL()`, `LSHIFT()`, `LALT()`, `LGUI()` and `RALT()` to add chorded keys to your keymap. For example `LCTRL(LALT(Key_Delete))` can be used to add control-alt-delete as a single key to your keymap, should you wish. The innermost bracket must be of the standard format as taken from the above key definitions, and all other modifiers must be from the aforementioned list, and in that format. This does allow you to create single keys for multiple modifiers, e.g. `LCTRL(LALT(LSHIFT(Key_LeftGui)))`, when held, would have the effect of all left modifiers at once. These modifier macros only work for standard keys! When applied to any key provided by a plugin, they will have no effect. +In addition, the keys in `key_defs/keyboard.h` can be augmented with modifier macros: `LCTRL()`, `LSHIFT()`, `LALT()`, `LGUI()` and `RALT()` to add chorded keys to your keymap. For example `LCTRL(LALT(Key_Delete))` can be used to add control-alt-delete as a single key to your keymap, should you wish. The innermost bracket must be of the standard format as taken from the above key definitions, and all other modifiers must be from the aforementioned list, and in that format. This does allow you to create single keys for multiple modifiers, e.g. `LCTRL(LALT(LSHIFT(Key_LeftGui)))`, when held, would have the effect of all left modifiers at once. These modifier macros only work for standard keys! When applied to any key provided by a plugin, they will have no effect. diff --git a/src/kaleidoscope/key_defs.h b/src/kaleidoscope/key_defs.h index 30e15385..5c7c6893 100644 --- a/src/kaleidoscope/key_defs.h +++ b/src/kaleidoscope/key_defs.h @@ -19,12 +19,11 @@ #include "kaleidoscope/HIDTables.h" -#include "kaleidoscope/key_defs_keyboard.h" -#include "kaleidoscope/key_defs_sysctl.h" -#include "kaleidoscope/key_defs_consumerctl.h" -#include "kaleidoscope/key_defs_keymaps.h" - -#include "kaleidoscope/key_defs_aliases.h" +#include "kaleidoscope/key_defs/keyboard.h" +#include "kaleidoscope/key_defs/sysctl.h" +#include "kaleidoscope/key_defs/consumerctl.h" +#include "kaleidoscope/key_defs/keymaps.h" +#include "kaleidoscope/key_defs/aliases.h" // ----------------------------------------------------------------------------- // Constant keycode values diff --git a/src/kaleidoscope/key_defs_aliases.h b/src/kaleidoscope/key_defs/aliases.h similarity index 100% rename from src/kaleidoscope/key_defs_aliases.h rename to src/kaleidoscope/key_defs/aliases.h diff --git a/src/kaleidoscope/key_defs_consumerctl.h b/src/kaleidoscope/key_defs/consumerctl.h similarity index 100% rename from src/kaleidoscope/key_defs_consumerctl.h rename to src/kaleidoscope/key_defs/consumerctl.h diff --git a/src/kaleidoscope/key_defs_keyboard.h b/src/kaleidoscope/key_defs/keyboard.h similarity index 100% rename from src/kaleidoscope/key_defs_keyboard.h rename to src/kaleidoscope/key_defs/keyboard.h diff --git a/src/kaleidoscope/key_defs_keymaps.h b/src/kaleidoscope/key_defs/keymaps.h similarity index 100% rename from src/kaleidoscope/key_defs_keymaps.h rename to src/kaleidoscope/key_defs/keymaps.h diff --git a/src/kaleidoscope/key_defs_sysctl.h b/src/kaleidoscope/key_defs/sysctl.h similarity index 100% rename from src/kaleidoscope/key_defs_sysctl.h rename to src/kaleidoscope/key_defs/sysctl.h diff --git a/testing/setup-googletest.h b/testing/setup-googletest.h index 7261cea6..69136f62 100644 --- a/testing/setup-googletest.h +++ b/testing/setup-googletest.h @@ -18,7 +18,7 @@ #pragma once -#include "kaleidoscope/key_defs_keyboard.h" +#include "kaleidoscope/key_defs/keyboard.h" #include "Kaleidoscope.h" // Out of order because `fix-macros.h` clears the preprocessor environment for diff --git a/tests/examples/basic-keypress/basic-keypress.ino b/tests/examples/basic-keypress/basic-keypress.ino index c35a7555..21b6f3cf 100644 --- a/tests/examples/basic-keypress/basic-keypress.ino +++ b/tests/examples/basic-keypress/basic-keypress.ino @@ -102,10 +102,10 @@ enum { MACRO_VERSION_INFO, * defined as part of the USB HID Keyboard specification. You can find the names * (if not yet the explanations) for all the standard `Key_` defintions offered by * Kaleidoscope in these files: - * https://github.com/keyboardio/Kaleidoscope/blob/master/src/key_defs_keyboard.h - * https://github.com/keyboardio/Kaleidoscope/blob/master/src/key_defs_consumerctl.h - * https://github.com/keyboardio/Kaleidoscope/blob/master/src/key_defs_sysctl.h - * https://github.com/keyboardio/Kaleidoscope/blob/master/src/key_defs_keymaps.h + * https://github.com/keyboardio/Kaleidoscope/blob/master/src/key_defs/keyboard.h + * https://github.com/keyboardio/Kaleidoscope/blob/master/src/key_defs/consumerctl.h + * https://github.com/keyboardio/Kaleidoscope/blob/master/src/key_defs/sysctl.h + * https://github.com/keyboardio/Kaleidoscope/blob/master/src/key_defs/keymaps.h * * Additional things that should be documented here include * using ___ to let keypresses fall through to the previously active layer diff --git a/tests/hid/hid-v1.2-consumer-keys/hid-v1.2-consumer-keys.ino b/tests/hid/hid-v1.2-consumer-keys/hid-v1.2-consumer-keys.ino index 5bb24920..2fae10ad 100644 --- a/tests/hid/hid-v1.2-consumer-keys/hid-v1.2-consumer-keys.ino +++ b/tests/hid/hid-v1.2-consumer-keys/hid-v1.2-consumer-keys.ino @@ -102,10 +102,10 @@ enum { MACRO_VERSION_INFO, * defined as part of the USB HID Keyboard specification. You can find the names * (if not yet the explanations) for all the standard `Key_` defintions offered by * Kaleidoscope in these files: - * https://github.com/keyboardio/Kaleidoscope/blob/master/src/key_defs_keyboard.h - * https://github.com/keyboardio/Kaleidoscope/blob/master/src/key_defs_consumerctl.h - * https://github.com/keyboardio/Kaleidoscope/blob/master/src/key_defs_sysctl.h - * https://github.com/keyboardio/Kaleidoscope/blob/master/src/key_defs_keymaps.h + * https://github.com/keyboardio/Kaleidoscope/blob/master/src/key_defs/keyboard.h + * https://github.com/keyboardio/Kaleidoscope/blob/master/src/key_defs/consumerctl.h + * https://github.com/keyboardio/Kaleidoscope/blob/master/src/key_defs/sysctl.h + * https://github.com/keyboardio/Kaleidoscope/blob/master/src/key_defs/keymaps.h * * Additional things that should be documented here include * using ___ to let keypresses fall through to the previously active layer diff --git a/tests/issues/840/840.ino b/tests/issues/840/840.ino index 80ef6bc0..9a8e8be1 100644 --- a/tests/issues/840/840.ino +++ b/tests/issues/840/840.ino @@ -102,10 +102,10 @@ enum { MACRO_VERSION_INFO, * defined as part of the USB HID Keyboard specification. You can find the names * (if not yet the explanations) for all the standard `Key_` defintions offered by * Kaleidoscope in these files: - * https://github.com/keyboardio/Kaleidoscope/blob/master/src/key_defs_keyboard.h - * https://github.com/keyboardio/Kaleidoscope/blob/master/src/key_defs_consumerctl.h - * https://github.com/keyboardio/Kaleidoscope/blob/master/src/key_defs_sysctl.h - * https://github.com/keyboardio/Kaleidoscope/blob/master/src/key_defs_keymaps.h + * https://github.com/keyboardio/Kaleidoscope/blob/master/src/key_defs/keyboard.h + * https://github.com/keyboardio/Kaleidoscope/blob/master/src/key_defs/consumerctl.h + * https://github.com/keyboardio/Kaleidoscope/blob/master/src/key_defs/sysctl.h + * https://github.com/keyboardio/Kaleidoscope/blob/master/src/key_defs/keymaps.h * * Additional things that should be documented here include * using ___ to let keypresses fall through to the previously active layer