[PATCH] [weston, v4] weston.ini: Add natural scroll support to weston.ini This adds support for enabling/disabling natural scrolling via a boolean in weston.ini:

Jiayi Zhao jeff.no.zhao at gmail.com
Sat Jan 28 02:46:49 UTC 2017


[libinput]
natural_scroll=true

CHANGES:
 - libinput_device_config_scroll_has_natural_scroll() is no longer compared to != 0
 - added configuration option to weston.ini man page

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 4bd6e68..84bb8dd 100644
--- a/compositor/main.c
+++ b/compositor/main.c
@@ -1133,6 +1133,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);
@@ -1147,6 +1149,17 @@ configure_input_device(struct weston_compositor *compositor,
 		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);
+	}
 }
 
 static void
diff --git a/man/weston.ini.man b/man/weston.ini.man
index 2edb085..62e0f92 100644
--- a/man/weston.ini.man
+++ b/man/weston.ini.man
@@ -187,6 +187,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 257c4ec..f957ec6 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.10.2



More information about the wayland-devel mailing list