diff options
author | Drashna Jaelre <drashna@live.com> | 2022-12-31 16:55:14 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-01-01 11:55:14 +1100 |
commit | ac561b9473559b7880bcf2510ae5a0ac5cabde7a (patch) | |
tree | 9341305bf6a04e6c8c9274d023cdc9b83f002dc3 | |
parent | d0ebafaea6847926e6391a6920821bcb17b3c39c (diff) |
[Bug] Prevent dynamic keymaps from processing layers that don't exist (#19225)
-rw-r--r-- | keyboards/boardsource/4x12/keymaps/via/keymap.c | 6 | ||||
-rw-r--r-- | keyboards/canary/canary60rgb/keymaps/via/config.h | 1 | ||||
-rw-r--r-- | keyboards/dm9records/tartan/keymaps/via/keymap.c | 8 | ||||
-rw-r--r-- | keyboards/dztech/dz60rgb/keymaps/via/keymap.c | 7 | ||||
-rw-r--r-- | keyboards/edc40/keymaps/via/keymap.c | 14 | ||||
-rw-r--r-- | keyboards/gray_studio/hb85/keymaps/via/keymap.c | 11 | ||||
-rw-r--r-- | keyboards/keebio/sinc/keymaps/via/keymap.c | 17 | ||||
-rw-r--r-- | keyboards/montsinger/rebound/rev4/keymaps/via/config.h | 6 | ||||
-rw-r--r-- | keyboards/orthocode/keymaps/via/keymap.c | 15 | ||||
-rw-r--r-- | quantum/action_layer.h | 1 | ||||
-rw-r--r-- | quantum/keymap_introspection.c | 4 |
11 files changed, 21 insertions, 69 deletions
diff --git a/keyboards/boardsource/4x12/keymaps/via/keymap.c b/keyboards/boardsource/4x12/keymaps/via/keymap.c index b6e26fbeca..6a9621e508 100644 --- a/keyboards/boardsource/4x12/keymaps/via/keymap.c +++ b/keyboards/boardsource/4x12/keymaps/via/keymap.c @@ -29,11 +29,5 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { KC_DEL, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_MINS, KC_EQL, KC_LBRC, KC_RBRC, KC_BSLS, _______, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_NUHS, KC_NUBS, KC_PGUP, KC_PGDN, _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_MNXT, KC_VOLD, KC_VOLU, KC_MPLY - ), - [4] = LAYOUT_ortho_4x12( - _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, - _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, - _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, - _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ ) }; diff --git a/keyboards/canary/canary60rgb/keymaps/via/config.h b/keyboards/canary/canary60rgb/keymaps/via/config.h index 452510f79b..d3256bff33 100644 --- a/keyboards/canary/canary60rgb/keymaps/via/config.h +++ b/keyboards/canary/canary60rgb/keymaps/via/config.h @@ -17,3 +17,4 @@ #pragma once #define DISABLE_RGB_MATRIX_PIXEL_FLOW +#define DYNAMIC_KEYMAP_LAYER_COUNT 5 diff --git a/keyboards/dm9records/tartan/keymaps/via/keymap.c b/keyboards/dm9records/tartan/keymaps/via/keymap.c index e98b8385c9..6ea5c328a0 100644 --- a/keyboards/dm9records/tartan/keymaps/via/keymap.c +++ b/keyboards/dm9records/tartan/keymaps/via/keymap.c @@ -19,7 +19,6 @@ enum tartan_via_layers { _QWERTY, _FN, - _L2, _L3, _L4, _L5, @@ -42,13 +41,6 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { _______, _______, _______, _______, _______, _______, _______, _______, KC_END, KC_PGDN, KC_DOWN, _______, _______, _______, _______, _______, _______, _______, _______, _______ ), - [_L2] = LAYOUT_60_ansi( - _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, - _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, - _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, - _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, - _______, _______, _______, _______, _______, _______, _______, _______ - ), [_L3] = LAYOUT_60_ansi( _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, diff --git a/keyboards/dztech/dz60rgb/keymaps/via/keymap.c b/keyboards/dztech/dz60rgb/keymaps/via/keymap.c index da128eec4f..b00f4094f1 100644 --- a/keyboards/dztech/dz60rgb/keymaps/via/keymap.c +++ b/keyboards/dztech/dz60rgb/keymaps/via/keymap.c @@ -28,12 +28,5 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { _______, KC_P4, KC_P5, KC_P6, _______, _______, _______, _______, KC_P4, KC_P5, KC_P6, _______, KC_PENT, _______, KC_P1, KC_P2, KC_P3, _______, _______, _______, _______, KC_P1, KC_P2, KC_P3, _______, _______, _______, KC_P0, KC_PDOT, KC_PENT, KC_P0, KC_PDOT, _______, _______, _______ - ), - [4] = LAYOUT( - QK_GESC, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC, - KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_BSLS, - CTL_T(KC_CAPS), KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_ENT, - KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, RSFT_T(KC_SLSH), KC_UP, LT(2, KC_DEL), - KC_LCTL, KC_LALT, KC_LGUI, KC_SPC, KC_RALT, TO(0), KC_LEFT, KC_DOWN, KC_RGHT ) }; diff --git a/keyboards/edc40/keymaps/via/keymap.c b/keyboards/edc40/keymaps/via/keymap.c index 022970cd0c..a5f6bc5b36 100644 --- a/keyboards/edc40/keymaps/via/keymap.c +++ b/keyboards/edc40/keymaps/via/keymap.c @@ -16,7 +16,7 @@ #include QMK_KEYBOARD_H const uint16_t PROGMEM keymaps [][MATRIX_ROWS][MATRIX_COLS] = { - + /* Default Layer*/ [0] = LAYOUT( KC_ESC, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_BSPC, @@ -25,7 +25,7 @@ KC_LCTL, KC_LGUI, KC_SPC, KC_RALT, KC_RCTL ), /* Num Layer */ - [1] = LAYOUT( + [1] = LAYOUT( KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, @@ -44,12 +44,6 @@ KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS - ), - /* Random Layer */ - [4] = LAYOUT( - KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, - KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, - KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, - KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS ) -};
\ No newline at end of file +}; + diff --git a/keyboards/gray_studio/hb85/keymaps/via/keymap.c b/keyboards/gray_studio/hb85/keymaps/via/keymap.c index 5e1693a516..d641577199 100644 --- a/keyboards/gray_studio/hb85/keymaps/via/keymap.c +++ b/keyboards/gray_studio/hb85/keymaps/via/keymap.c @@ -43,14 +43,5 @@ _______, _______, _______, _______, _______, _______, _______, _______, ____ _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ - ), - - [3] = LAYOUT_all( - _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, -_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, -_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, -_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, -_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, - _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ - ), + ) }; diff --git a/keyboards/keebio/sinc/keymaps/via/keymap.c b/keyboards/keebio/sinc/keymaps/via/keymap.c index 8101c82bfb..fe44ef04f2 100644 --- a/keyboards/keebio/sinc/keymaps/via/keymap.c +++ b/keyboards/keebio/sinc/keymaps/via/keymap.c @@ -26,23 +26,14 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ - ), - - [3] = LAYOUT_all( - _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, - _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, - _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, - _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, - _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, - _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ ) + }; #ifdef ENCODER_MAP_ENABLE const uint16_t PROGMEM encoder_map[][NUM_ENCODERS][2] = { - [0] = { ENCODER_CCW_CW(KC_VOLU, KC_VOLD), ENCODER_CCW_CW(KC_PGUP, KC_PGDN) }, - [1] = { ENCODER_CCW_CW(RGB_MOD, RGB_RMOD), ENCODER_CCW_CW(KC_MNXT, KC_MPRV) }, - [2] = { ENCODER_CCW_CW(_______, _______), ENCODER_CCW_CW(_______, _______) }, - [3] = { ENCODER_CCW_CW(_______, _______), ENCODER_CCW_CW(_______, _______) }, + [0] = { ENCODER_CCW_CW(KC_VOLU, KC_VOLD), ENCODER_CCW_CW(KC_PGUP, KC_PGDN) }, + [1] = { ENCODER_CCW_CW(RGB_MOD, RGB_RMOD), ENCODER_CCW_CW(KC_MNXT, KC_MPRV) }, + [2] = { ENCODER_CCW_CW(_______, _______), ENCODER_CCW_CW(_______, _______) }, }; #endif diff --git a/keyboards/montsinger/rebound/rev4/keymaps/via/config.h b/keyboards/montsinger/rebound/rev4/keymaps/via/config.h new file mode 100644 index 0000000000..7460bef840 --- /dev/null +++ b/keyboards/montsinger/rebound/rev4/keymaps/via/config.h @@ -0,0 +1,6 @@ +// Copyright 2020 Ross Montsinger +// SPDX-License-Identifier: GPL-2.0-or-later + +#pragma once + +#define DYNAMIC_KEYMAP_LAYER_COUNT 6 diff --git a/keyboards/orthocode/keymaps/via/keymap.c b/keyboards/orthocode/keymaps/via/keymap.c index 177f5ad190..1666fbc7e9 100644 --- a/keyboards/orthocode/keymaps/via/keymap.c +++ b/keyboards/orthocode/keymaps/via/keymap.c @@ -73,20 +73,5 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { /* ctrl win alt fn th1 th2 th3 th4 fn alt ctrl left down right */ KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS - ), - [4] = LAYOUT( - /* Rotary */ - KC_TRNS, - /* esc 1 2 3 4 5 6 7 8 9 0 - = home */ - KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, - /* tab Q W E R T Y U I O P \ delete end */ - KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, - /* caps A S D F G H J K L ; ' enter */ - KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_RBRC, KC_TRNS, KC_TRNS, KC_TRNS, - /* shift Z X C V B N M , . / up */ - KC_LSFT, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, - /* ctrl win alt fn th1 th2 th3 th4 fn alt ctrl left down right */ - KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS - ) }; diff --git a/quantum/action_layer.h b/quantum/action_layer.h index bd1085a70f..3fe2726529 100644 --- a/quantum/action_layer.h +++ b/quantum/action_layer.h @@ -25,6 +25,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. # ifndef DYNAMIC_KEYMAP_LAYER_COUNT # define DYNAMIC_KEYMAP_LAYER_COUNT 4 # endif +# define MAX_LAYER DYNAMIC_KEYMAP_LAYER_COUNT # if DYNAMIC_KEYMAP_LAYER_COUNT <= 8 # ifndef LAYER_STATE_8BIT # define LAYER_STATE_8BIT diff --git a/quantum/keymap_introspection.c b/quantum/keymap_introspection.c index 93aab82fcc..1529ab9fe2 100644 --- a/quantum/keymap_introspection.c +++ b/quantum/keymap_introspection.c @@ -17,7 +17,11 @@ uint8_t keymap_layer_count(void) { return NUM_KEYMAP_LAYERS; } +#ifdef DYNAMIC_KEYMAP_ENABLE +_Static_assert(NUM_KEYMAP_LAYERS <= MAX_LAYER, "Number of keymap layers exceeds maximum set by DYNAMIC_KEYMAP_LAYER_COUNT"); +#else _Static_assert(NUM_KEYMAP_LAYERS <= MAX_LAYER, "Number of keymap layers exceeds maximum set by LAYER_STATE_(8|16|32)BIT"); +#endif uint16_t keycode_at_keymap_location_raw(uint8_t layer_num, uint8_t row, uint8_t column) { if (layer_num < NUM_KEYMAP_LAYERS && row < MATRIX_ROWS && column < MATRIX_COLS) { |