[PATCH] libinput: enable natural scroll for touchpad devices Enable by setting natural_scroll=true under [libinput] in weston.ini

Jiayi Zhao jeff.no.zhao at gmail.com
Wed Jan 3 02:00:13 UTC 2018


Changes:
- no longer affects all devices that support natural scroll, only for touchpad devices (devices that supports tap to click)

Signed-off-by: Jiayi Zhao <jeff.no.zhao at gmail.com>
---
 compositor/main.c  | 13 +++++++++++++
 man/weston.ini.man |  3 +++
 weston.ini.in      |  1 +
 3 files changed, 17 insertions(+)

diff --git a/compositor/main.c b/compositor/main.c
index 7feb4cb0..4b0dae0d 100644
--- a/compositor/main.c
+++ b/compositor/main.c
@@ -1136,6 +1136,8 @@ configure_input_device(struct weston_compositor *compositor,
 	struct weston_config *config = wet_get_config(compositor);
 	int enable_tap;
 	int enable_tap_default;
+	int natural_scroll;
+	int natural_scroll_default;
 
 	s = weston_config_get_section(config,
 				      "libinput", NULL, NULL);
@@ -1149,6 +1151,17 @@ configure_input_device(struct weston_compositor *compositor,
 					       enable_tap_default);
 		libinput_device_config_tap_set_enabled(device,
 						       enable_tap);
+
+		if (libinput_device_config_scroll_has_natural_scroll(device)) {
+			natural_scroll_default =
+				libinput_device_config_scroll_get_default_natural_scroll_enabled(
+					device);
+			weston_config_section_get_bool(s, "natural_scroll",
+						&natural_scroll,
+						natural_scroll_default);
+			libinput_device_config_scroll_set_natural_scroll_enabled(
+						device, natural_scroll);
+		}
 	}
 }
 
diff --git a/man/weston.ini.man b/man/weston.ini.man
index f237fd60..ce4dd2ee 100644
--- a/man/weston.ini.man
+++ b/man/weston.ini.man
@@ -200,6 +200,9 @@ Available configuration are:
 .TP 7
 .BI "enable_tap=" true
 enables tap to click on touchpad devices
+.TP 7
+.BI "natural_scroll=" true
+enables natural scrolling on touchpad devices
 .RS
 .PP
 
diff --git a/weston.ini.in b/weston.ini.in
index 257c4ec4..f957ec6c 100644
--- a/weston.ini.in
+++ b/weston.ini.in
@@ -61,6 +61,7 @@ path=@libexecdir@/weston-keyboard
 
 #[libinput]
 #enable_tap=true
+#natural_scroll=false
 
 #[touchpad]
 #constant_accel_factor = 50
-- 
2.13.6



More information about the wayland-devel mailing list