Support smooth scroll and horizontal scroll

note that this changes Scroll mousebinds from taking a "button"
attribute to taking a "direction" attribute
This commit is contained in:
bi4k8 2022-11-09 05:18:14 +00:00 committed by Johan Malm
parent 6164ba73ff
commit 2b753a98b8
7 changed files with 119 additions and 20 deletions

View file

@ -34,16 +34,44 @@ mousebind_button_from_str(const char *str, uint32_t *modifiers)
return BTN_RIGHT;
} else if (!strcasecmp(str, "Middle")) {
return BTN_MIDDLE;
} else if (!strcasecmp(str, "Up")) {
return BTN_GEAR_UP;
} else if (!strcasecmp(str, "Down")) {
return BTN_GEAR_DOWN;
}
invalid:
wlr_log(WLR_ERROR, "unknown button (%s)", str);
return UINT32_MAX;
}
enum direction
mousebind_direction_from_str(const char *str, uint32_t *modifiers)
{
assert(str);
if (modifiers) {
*modifiers = 0;
while (strlen(str) >= 2 && str[1] == '-') {
char modname[2] = {str[0], 0};
uint32_t parsed_modifier = parse_modifier(modname);
if (!parsed_modifier) {
goto invalid;
}
*modifiers |= parsed_modifier;
str += 2;
}
}
if (!strcasecmp(str, "Left")) {
return LAB_DIRECTION_LEFT;
} else if (!strcasecmp(str, "Right")) {
return LAB_DIRECTION_RIGHT;
} else if (!strcasecmp(str, "Up")) {
return LAB_DIRECTION_UP;
} else if (!strcasecmp(str, "Down")) {
return LAB_DIRECTION_DOWN;
}
invalid:
wlr_log(WLR_ERROR, "unknown direction (%s)", str);
return LAB_DIRECTION_INVALID;
}
enum mouse_event
mousebind_event_from_str(const char *str)
{