From a8e0248f477f39a05491a0592a4faedbf7092e79 Mon Sep 17 00:00:00 2001 From: Johan Malm Date: Sat, 25 Mar 2023 15:57:47 +0000 Subject: [PATCH] config: support scroll-factor Fixes: issue #846 --- docs/labwc-config.5.scd | 3 +++ docs/rc.xml.all | 1 + include/config/rcxml.h | 1 + src/config/rcxml.c | 3 +++ src/cursor.c | 3 ++- 5 files changed, 10 insertions(+), 1 deletion(-) diff --git a/docs/labwc-config.5.scd b/docs/labwc-config.5.scd index 1b61d385..63bd9cc8 100644 --- a/docs/labwc-config.5.scd +++ b/docs/labwc-config.5.scd @@ -210,6 +210,9 @@ The rest of this man page describes configuration options. ** Set double click time in milliseconds. Default is 500. +** + Set scroll factor. Default is 1.0. + ** Multiple ** can exist within one **; and multiple ** can exist within one ** diff --git a/docs/rc.xml.all b/docs/rc.xml.all index f1558d4b..0ff8a88e 100644 --- a/docs/rc.xml.all +++ b/docs/rc.xml.all @@ -199,6 +199,7 @@ 500 + 1.0 diff --git a/include/config/rcxml.h b/include/config/rcxml.h index c9ddbcbe..18f79ea2 100644 --- a/include/config/rcxml.h +++ b/include/config/rcxml.h @@ -41,6 +41,7 @@ struct rcxml { /* mouse */ long doubleclick_time; /* in ms */ struct wl_list mousebinds; /* struct mousebind.link */ + double scroll_factor; /* libinput */ struct wl_list libinput_categories; diff --git a/src/config/rcxml.c b/src/config/rcxml.c index 78515e69..176b5737 100644 --- a/src/config/rcxml.c +++ b/src/config/rcxml.c @@ -420,6 +420,8 @@ entry(xmlNode *node, char *nodename, char *content) } else { wlr_log(WLR_ERROR, "invalid doubleClickTime"); } + } else if (!strcasecmp(nodename, "scrollFactor.mouse")) { + rc.scroll_factor = atof(content); } else if (!strcasecmp(nodename, "name.context.mouse")) { current_mouse_context = content; current_mousebind = NULL; @@ -573,6 +575,7 @@ rcxml_init(void) init_font_defaults(&rc.font_osd); rc.doubleclick_time = 500; + rc.scroll_factor = 1.0; rc.repeat_rate = 25; rc.repeat_delay = 600; rc.screen_edge_strength = 20; diff --git a/src/cursor.c b/src/cursor.c index 016b47a1..2255a5ec 100644 --- a/src/cursor.c +++ b/src/cursor.c @@ -1054,7 +1054,8 @@ cursor_axis(struct wl_listener *listener, void *data) /* Notify the client with pointer focus of the axis event. */ wlr_seat_pointer_notify_axis(seat->seat, event->time_msec, - event->orientation, event->delta, event->delta_discrete, + event->orientation, rc.scroll_factor * event->delta, + round(rc.scroll_factor * event->delta_discrete), event->source); } }