summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormonsta <[email protected]>2016-12-22 19:40:26 +0300
committermonsta <[email protected]>2016-12-22 19:45:36 +0300
commitbe168388a752fe61ba213751435e67fbc955c9fe (patch)
tree121f4f46d679787f97b507d15806e72b68a4b24e
parent7a7640f62d9994077260f6db343a3ae1b1f69eef (diff)
downloadmate-settings-daemon-be168388a752fe61ba213751435e67fbc955c9fe.tar.bz2
mate-settings-daemon-be168388a752fe61ba213751435e67fbc955c9fe.tar.xz
mouse: split helper for setting bool property into two separate ones
one is for touchpads, another is for generic bool properties same as done in: https://github.com/linuxmint/cinnamon-settings-daemon/commit/cdcea69868ea082cfa620b87cc6cfad4279dadc1
-rw-r--r--plugins/mouse/msd-mouse-manager.c44
1 files changed, 29 insertions, 15 deletions
diff --git a/plugins/mouse/msd-mouse-manager.c b/plugins/mouse/msd-mouse-manager.c
index 9c7a56c..9be3397 100644
--- a/plugins/mouse/msd-mouse-manager.c
+++ b/plugins/mouse/msd-mouse-manager.c
@@ -822,12 +822,12 @@ set_natural_scroll_all (MsdMouseManager *manager)
}
static void
-synaptics_set_bool (XDeviceInfo *device_info,
- const char *property_name,
- int property_index,
- gboolean enabled)
+property_set_bool (XDeviceInfo *device_info,
+ XDevice *device,
+ const char *property_name,
+ int property_index,
+ gboolean enabled)
{
- XDevice *device;
int rc;
unsigned long nitems, bytes_after;
unsigned char *data;
@@ -838,11 +838,6 @@ synaptics_set_bool (XDeviceInfo *device_info,
if (!property)
return;
- device = device_is_touchpad (device_info);
- if (device == NULL) {
- return;
- }
-
gdk_error_trap_push ();
rc = XGetDeviceProperty (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), device,
property, 0, 1, False,
@@ -859,20 +854,39 @@ synaptics_set_bool (XDeviceInfo *device_info,
if (rc == Success)
XFree (data);
- XCloseDevice (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), device);
if (gdk_error_trap_pop ()) {
g_warning ("Error while setting %s on \"%s\"", property_name, device_info->name);
}
}
static void
+touchpad_set_bool (XDeviceInfo *device_info,
+ const char *property_name,
+ int property_index,
+ gboolean enabled)
+{
+ XDevice *device;
+
+ device = device_is_touchpad (device_info);
+ if (device == NULL) {
+ return;
+ }
+
+ property_set_bool (device_info, device, property_name, property_index, enabled);
+
+ gdk_error_trap_push ();
+ XCloseDevice (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), device);
+ gdk_error_trap_pop_ignored ();
+}
+
+static void
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));
+ touchpad_set_bool (device_info, "Synaptics Edge Scrolling", 0, g_settings_get_boolean (settings, KEY_VERT_EDGE_SCROLL));
+ touchpad_set_bool (device_info, "Synaptics Edge Scrolling", 1, g_settings_get_boolean (settings, KEY_HORIZ_EDGE_SCROLL));
+ touchpad_set_bool (device_info, "Synaptics Two-Finger Scrolling", 0, g_settings_get_boolean (settings, KEY_VERT_TWO_FINGER_SCROLL));
+ touchpad_set_bool (device_info, "Synaptics Two-Finger Scrolling", 1, g_settings_get_boolean (settings, KEY_HORIZ_TWO_FINGER_SCROLL));
}
static void