summaryrefslogtreecommitdiff
path: root/plugins/mouse/msd-mouse-manager.c
diff options
context:
space:
mode:
authormonsta <[email protected]>2016-12-22 18:44:40 +0300
committermonsta <[email protected]>2016-12-22 19:08:49 +0300
commit7a7640f62d9994077260f6db343a3ae1b1f69eef (patch)
treefb577e91022e790fbd226c65a65a629b5778bf89 /plugins/mouse/msd-mouse-manager.c
parentba6c8b41eb225573c3abc2ae473bd7cdf813763a (diff)
downloadmate-settings-daemon-7a7640f62d9994077260f6db343a3ae1b1f69eef.tar.bz2
mate-settings-daemon-7a7640f62d9994077260f6db343a3ae1b1f69eef.tar.xz
mouse: reorganize helpers for setting touchpad scrolling
Diffstat (limited to 'plugins/mouse/msd-mouse-manager.c')
-rw-r--r--plugins/mouse/msd-mouse-manager.c29
1 files changed, 14 insertions, 15 deletions
diff --git a/plugins/mouse/msd-mouse-manager.c b/plugins/mouse/msd-mouse-manager.c
index 20cfa56..9c7a56c 100644
--- a/plugins/mouse/msd-mouse-manager.c
+++ b/plugins/mouse/msd-mouse-manager.c
@@ -866,9 +866,17 @@ synaptics_set_bool (XDeviceInfo *device_info,
}
static void
-synaptics_set_bool_all (const char *property_name,
- int property_index,
- gboolean enabled)
+set_scrolling (XDeviceInfo *device_info,
+ GSettings *settings)
+{
+ synaptics_set_bool (device_info, "Synaptics Edge Scrolling", 0, g_settings_get_boolean (settings, KEY_VERT_EDGE_SCROLL));
+ synaptics_set_bool (device_info, "Synaptics Edge Scrolling", 1, g_settings_get_boolean (settings, KEY_HORIZ_EDGE_SCROLL));
+ synaptics_set_bool (device_info, "Synaptics Two-Finger Scrolling", 0, g_settings_get_boolean (settings, KEY_VERT_TWO_FINGER_SCROLL));
+ synaptics_set_bool (device_info, "Synaptics Two-Finger Scrolling", 1, g_settings_get_boolean (settings, KEY_HORIZ_TWO_FINGER_SCROLL));
+}
+
+static void
+set_scrolling_all (GSettings *settings)
{
int numdevices, i;
XDeviceInfo *devicelist = XListInputDevices (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), &numdevices);
@@ -877,22 +885,13 @@ synaptics_set_bool_all (const char *property_name,
return;
for (i = 0; i < numdevices; i++) {
- synaptics_set_bool (&devicelist[i], property_name, property_index, enabled);
+ set_scrolling (&devicelist[i], settings);
}
XFreeDeviceList (devicelist);
}
static void
-set_scrolling (GSettings *settings)
-{
- synaptics_set_bool_all ("Synaptics Edge Scrolling", 0, g_settings_get_boolean (settings, KEY_VERT_EDGE_SCROLL));
- synaptics_set_bool_all ("Synaptics Edge Scrolling", 1, g_settings_get_boolean (settings, KEY_HORIZ_EDGE_SCROLL));
- synaptics_set_bool_all ("Synaptics Two-Finger Scrolling", 0, g_settings_get_boolean (settings, KEY_VERT_TWO_FINGER_SCROLL));
- synaptics_set_bool_all ("Synaptics Two-Finger Scrolling", 1, g_settings_get_boolean (settings, KEY_HORIZ_TWO_FINGER_SCROLL));
-}
-
-static void
set_touchpad_enabled (XDeviceInfo *device_info,
gboolean state)
{
@@ -1043,7 +1042,7 @@ set_mouse_settings (MsdMouseManager *manager)
set_tap_to_click_all (manager);
set_click_actions_all (manager);
- set_scrolling (manager->priv->settings_touchpad);
+ set_scrolling_all (manager->priv->settings_touchpad);
set_natural_scroll_all (manager);
set_touchpad_enabled_all (g_settings_get_boolean (manager->priv->settings_touchpad, KEY_TOUCHPAD_ENABLED));
}
@@ -1101,7 +1100,7 @@ touchpad_callback (GSettings *settings,
|| (g_strcmp0 (key, KEY_HORIZ_EDGE_SCROLL) == 0)
|| (g_strcmp0 (key, KEY_VERT_TWO_FINGER_SCROLL) == 0)
|| (g_strcmp0 (key, KEY_HORIZ_TWO_FINGER_SCROLL) == 0)) {
- set_scrolling (manager->priv->settings_touchpad);
+ set_scrolling_all (manager->priv->settings_touchpad);
} else if (g_strcmp0 (key, KEY_TOUCHPAD_NATURAL_SCROLL) == 0) {
set_natural_scroll_all (manager);
} else if (g_strcmp0 (key, KEY_TOUCHPAD_ENABLED) == 0) {