From 3694ff85a039fa49722655b0f656219623a01d3a Mon Sep 17 00:00:00 2001 From: Peter Johanson Date: Fri, 5 Jul 2024 12:56:33 -0600 Subject: [PATCH] fix: Fix up layer metadata, move to layer IDs. * Studio will use stable layer IDs to refer to layers, so that layer reordering doesn't affect behavior bindings, so update to match. * Fix a few layer metadata entries that missed being refactored. --- app/include/drivers/behavior.h | 2 +- app/src/behavior.c | 2 +- app/src/behaviors/behavior_momentary_layer.c | 2 +- app/src/behaviors/behavior_to_layer.c | 3 +-- app/src/behaviors/behavior_toggle_layer.c | 3 +-- 5 files changed, 5 insertions(+), 7 deletions(-) diff --git a/app/include/drivers/behavior.h b/app/include/drivers/behavior.h index 0b814ff2828..7c99f04ed74 100644 --- a/app/include/drivers/behavior.h +++ b/app/include/drivers/behavior.h @@ -39,7 +39,7 @@ struct behavior_parameter_value_metadata { BEHAVIOR_PARAMETER_VALUE_TYPE_VALUE = 1, BEHAVIOR_PARAMETER_VALUE_TYPE_RANGE = 2, BEHAVIOR_PARAMETER_VALUE_TYPE_HID_USAGE = 3, - BEHAVIOR_PARAMETER_VALUE_TYPE_LAYER_INDEX = 4, + BEHAVIOR_PARAMETER_VALUE_TYPE_LAYER_ID = 4, } type; }; diff --git a/app/src/behavior.c b/app/src/behavior.c index 0d9a4cdf38f..e69cdf88702 100644 --- a/app/src/behavior.c +++ b/app/src/behavior.c @@ -99,7 +99,7 @@ static int check_param_matches_value(const struct behavior_parameter_value_metad } break; - case BEHAVIOR_PARAMETER_VALUE_TYPE_LAYER_INDEX: + case BEHAVIOR_PARAMETER_VALUE_TYPE_LAYER_ID: if (param >= 0 && param < ZMK_KEYMAP_LEN) { return PARAM_MATCHES; } diff --git a/app/src/behaviors/behavior_momentary_layer.c b/app/src/behaviors/behavior_momentary_layer.c index e27889df96f..b781a953771 100644 --- a/app/src/behaviors/behavior_momentary_layer.c +++ b/app/src/behaviors/behavior_momentary_layer.c @@ -20,7 +20,7 @@ LOG_MODULE_DECLARE(zmk, CONFIG_ZMK_LOG_LEVEL); static const struct behavior_parameter_value_metadata param_values[] = { { .display_name = "Layer", - .type = BEHAVIOR_PARAMETER_VALUE_TYPE_LAYER_INDEX, + .type = BEHAVIOR_PARAMETER_VALUE_TYPE_LAYER_ID, }, }; diff --git a/app/src/behaviors/behavior_to_layer.c b/app/src/behaviors/behavior_to_layer.c index d260087efce..f739ec8debf 100644 --- a/app/src/behaviors/behavior_to_layer.c +++ b/app/src/behaviors/behavior_to_layer.c @@ -37,8 +37,7 @@ static int to_keymap_binding_released(struct zmk_behavior_binding *binding, static const struct behavior_parameter_value_metadata param_values[] = { { .display_name = "Layer", - .type = BEHAVIOR_PARAMETER_VALUE_TYPE_STANDARD, - .standard = BEHAVIOR_PARAMETER_STANDARD_DOMAIN_LAYER_INDEX, + .type = BEHAVIOR_PARAMETER_VALUE_TYPE_LAYER_ID, }, }; diff --git a/app/src/behaviors/behavior_toggle_layer.c b/app/src/behaviors/behavior_toggle_layer.c index df261ed3a34..ea46c79faa4 100644 --- a/app/src/behaviors/behavior_toggle_layer.c +++ b/app/src/behaviors/behavior_toggle_layer.c @@ -39,8 +39,7 @@ static int tog_keymap_binding_released(struct zmk_behavior_binding *binding, static const struct behavior_parameter_value_metadata param_values[] = { { .display_name = "Layer", - .type = BEHAVIOR_PARAMETER_VALUE_TYPE_STANDARD, - .standard = BEHAVIOR_PARAMETER_STANDARD_DOMAIN_LAYER_INDEX, + .type = BEHAVIOR_PARAMETER_VALUE_TYPE_LAYER_ID, }, };