From 28d68cffb504d62bb2610cdb5aecdbc44bc59bd6 Mon Sep 17 00:00:00 2001
From: monsta <monsta@inbox.ru>
Date: Thu, 22 Dec 2016 20:12:48 +0300
Subject: mouse: libinput - hook up natural scroll configuration

adapted from:
https://github.com/linuxmint/cinnamon-settings-daemon/commit/2f87c56c4b57923c8992908ea9394ab170c507dd
---
 plugins/mouse/msd-mouse-manager.c | 23 +++++++++++++++++++++--
 1 file changed, 21 insertions(+), 2 deletions(-)

(limited to 'plugins/mouse')

diff --git a/plugins/mouse/msd-mouse-manager.c b/plugins/mouse/msd-mouse-manager.c
index 43ed9c1..612f481 100644
--- a/plugins/mouse/msd-mouse-manager.c
+++ b/plugins/mouse/msd-mouse-manager.c
@@ -811,8 +811,8 @@ set_click_actions_all (MsdMouseManager *manager)
 }
 
 static void
-set_natural_scroll (XDeviceInfo     *device_info,
-                    gboolean         natural_scroll)
+set_natural_scroll_synaptics (XDeviceInfo *device_info,
+                              gboolean     natural_scroll)
 {
         XDevice *device;
         int format, rc;
@@ -860,6 +860,25 @@ set_natural_scroll (XDeviceInfo     *device_info,
         }
 }
 
+static void
+set_natural_scroll_libinput (XDeviceInfo *device_info,
+                             gboolean     natural_scroll)
+{
+        g_debug ("Trying to set %s for \"%s\"", natural_scroll ? "natural (reverse) scroll" : "normal scroll", device_info->name);
+
+        touchpad_set_bool (device_info, "libinput Natural Scrolling Enabled", 0, natural_scroll);
+}
+
+static void
+set_natural_scroll (XDeviceInfo *device_info,
+                    gboolean     natural_scroll)
+{
+        if (property_from_name ("Synaptics Scrolling Distance"))
+                set_natural_scroll_synaptics (device_info, natural_scroll);
+
+        if (property_from_name ("libinput Natural Scrolling Enabled"))
+                set_natural_scroll_libinput (device_info, natural_scroll);
+}
 
 static void
 set_natural_scroll_all (MsdMouseManager *manager)
-- 
cgit v1.2.1