From 7e81c5d8871270e353a3312099beb6e70c574ece Mon Sep 17 00:00:00 2001 From: ReFil <31960031+ReFil@users.noreply.github.com> Date: Mon, 13 Jan 2025 11:24:02 +0000 Subject: [PATCH] feat(pointing): Add metadata to mouse button press behavior --- app/src/behaviors/behavior_mouse_key_press.c | 42 ++++++++++++++++++++ 1 file changed, 42 insertions(+) diff --git a/app/src/behaviors/behavior_mouse_key_press.c b/app/src/behaviors/behavior_mouse_key_press.c index 66b54fce05b..3abc669a7da 100644 --- a/app/src/behaviors/behavior_mouse_key_press.c +++ b/app/src/behaviors/behavior_mouse_key_press.c @@ -19,6 +19,48 @@ LOG_MODULE_DECLARE(zmk, CONFIG_ZMK_LOG_LEVEL); #if DT_HAS_COMPAT_STATUS_OKAY(DT_DRV_COMPAT) +#if IS_ENABLED(CONFIG_ZMK_BEHAVIOR_METADATA) + +static const struct behavior_parameter_value_metadata param_values[] = { + { + .value = BIT(0), + .display_name = "Left click", + .type = BEHAVIOR_PARAMETER_VALUE_TYPE_VALUE, + }, + { + .value = BIT(1), + .display_name = "Right click", + .type = BEHAVIOR_PARAMETER_VALUE_TYPE_VALUE, + }, + { + .value = BIT(2), + .display_name = "Middle click", + .type = BEHAVIOR_PARAMETER_VALUE_TYPE_VALUE, + }, + { + .value = BIT(3), + .display_name = "MB4 click", + .type = BEHAVIOR_PARAMETER_VALUE_TYPE_VALUE, + }, + { + .value = BIT(4), + .display_name = "MB5 click", + .type = BEHAVIOR_PARAMETER_VALUE_TYPE_VALUE, + }, +}; + +static const struct behavior_parameter_metadata_set param_metadata_set[] = {{ + .param1_values = param_values, + .param1_values_len = ARRAY_SIZE(param_values), +}}; + +static const struct behavior_parameter_metadata metadata = { + .sets_len = ARRAY_SIZE(param_metadata_set), + .sets = param_metadata_set, +}; + +#endif + static int behavior_mouse_key_press_init(const struct device *dev) { return 0; }; static void process_key_state(const struct device *dev, int32_t val, bool pressed) {