Add onbutton scrollMethod, scrollButton

This commit is contained in:
diniamo 2026-04-25 20:44:02 +02:00 committed by Johan Malm
parent 7d264c907f
commit 5c7bfe3c67
6 changed files with 33 additions and 4 deletions

View file

@ -25,6 +25,7 @@ libinput_category_init(struct libinput_category *l)
l->dwt = -1;
l->click_method = -1;
l->scroll_method = -1;
l->scroll_button = -1;
l->send_events_mode = -1;
l->have_calibration_matrix = false;
l->scroll_factor = 1.0;

View file

@ -891,9 +891,19 @@ fill_libinput_category(xmlNode *node)
} else if (!strcasecmp(content, "twofinger")) {
category->scroll_method =
LIBINPUT_CONFIG_SCROLL_2FG;
} else if (!strcasecmp(content, "onbutton")) {
category->scroll_method =
LIBINPUT_CONFIG_SCROLL_ON_BUTTON_DOWN;
} else {
wlr_log(WLR_ERROR, "invalid scrollMethod");
}
} else if (!strcasecmp(key, "scrollButton")) {
int button = atoi(content);
if (button != 0) {
category->scroll_button = button;
} else {
wlr_log(WLR_ERROR, "invalid scrollButton");
}
} else if (!strcasecmp(key, "sendEventsMode")) {
category->send_events_mode =
get_send_events_mode(content);

View file

@ -328,6 +328,16 @@ configure_libinput(struct wlr_input_device *wlr_input_device)
libinput_device_config_scroll_set_method(libinput_dev, dc->scroll_method);
}
libinput_device_config_scroll_set_button(libinput_dev,
libinput_device_config_scroll_get_default_button(libinput_dev));
if (dc->scroll_button < 0) {
wlr_log(WLR_INFO, "scroll button not configured");
} else {
wlr_log(WLR_INFO, "scroll button configured (%d)",
dc->scroll_button);
libinput_device_config_scroll_set_button(libinput_dev, dc->scroll_button);
}
libinput_device_config_send_events_set_mode(libinput_dev,
libinput_device_config_send_events_get_default_mode(libinput_dev));
if ((dc->send_events_mode != LIBINPUT_CONFIG_SEND_EVENTS_ENABLED