config+particle: add support for mouse wheel up/down

This commit is contained in:
Daniel Eklöf 2021-06-22 19:30:41 +02:00
parent c79ffbe057
commit 34d832cd22
No known key found for this signature in database
GPG key ID: 5BBD4992C116573F
4 changed files with 10 additions and 0 deletions

View file

@ -164,6 +164,8 @@ conf_verify_on_click(keychain_t *chain, const struct yml_node *node)
{"left", false, &conf_verify_string},
{"middle", false, &conf_verify_string},
{"right", false, &conf_verify_string},
{"wheel-up", false, &conf_verify_string},
{"wheel-down", false, &conf_verify_string},
{NULL, false, NULL},
};

View file

@ -160,6 +160,10 @@ conf_to_particle(const struct yml_node *node, struct conf_inherit inherited)
on_click_templates[MOUSE_BTN_MIDDLE] = template;
else if (strcmp(key, "right") == 0)
on_click_templates[MOUSE_BTN_RIGHT] = template;
else if (strcmp(key, "wheel-up") == 0)
on_click_templates[MOUSE_BTN_WHEEL_UP] = template;
else if (strcmp(key, "wheel-down") == 0)
on_click_templates[MOUSE_BTN_WHEEL_DOWN] = template;
else
assert(false);
}

View file

@ -161,6 +161,8 @@ exposable_default_on_mouse(struct exposable *exposable, struct bar *bar,
[MOUSE_BTN_MIDDLE] = "middle",
[MOUSE_BTN_RIGHT] = "right",
[MOUSE_BTN_COUNT] = "count",
[MOUSE_BTN_WHEEL_UP] = "wheel-up",
[MOUSE_BTN_WHEEL_DOWN] = "wheel-down",
};
LOG_DBG("on_mouse: exposable=%p, event=%s, btn=%s, x=%d, y=%d (on-click=%s)",
exposable, event == ON_MOUSE_MOTION ? "motion" : "click",

View file

@ -17,6 +17,8 @@ enum mouse_button {
MOUSE_BTN_LEFT,
MOUSE_BTN_MIDDLE,
MOUSE_BTN_RIGHT,
MOUSE_BTN_WHEEL_UP,
MOUSE_BTN_WHEEL_DOWN,
MOUSE_BTN_COUNT,
};