Skip to content

Commit

Permalink
feat(pointing): Add metadata to mouse button press behavior
Browse files Browse the repository at this point in the history
  • Loading branch information
ReFil committed Jan 13, 2025
1 parent 022603e commit 7e81c5d
Showing 1 changed file with 42 additions and 0 deletions.
42 changes: 42 additions & 0 deletions app/src/behaviors/behavior_mouse_key_press.c
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit 7e81c5d

Please sign in to comment.