summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormonsta <[email protected]>2016-12-23 14:48:55 +0300
committermonsta <[email protected]>2017-01-02 16:53:33 +0300
commitdb375a597e33b1c8fbc20a0e9dcecc93ba59fa7a (patch)
treec9dcb720295861b30e3119d9af06b1abb822cbd8
parentb8cc7f47feb9f6c102bc40ac16d7248327a7c2e0 (diff)
downloadmate-settings-daemon-db375a597e33b1c8fbc20a0e9dcecc93ba59fa7a.tar.bz2
mate-settings-daemon-db375a597e33b1c8fbc20a0e9dcecc93ba59fa7a.tar.xz
mouse: libinput - hook up left-handed setting
note: libinput function doesn't have button remapping code, it's handled in libinput already adapted from: https://github.com/linuxmint/cinnamon-settings-daemon/commit/c35f95210f025132e2e551024a01f6102371a0a0
-rw-r--r--plugins/mouse/msd-mouse-manager.c50
1 files changed, 46 insertions, 4 deletions
diff --git a/plugins/mouse/msd-mouse-manager.c b/plugins/mouse/msd-mouse-manager.c
index 71d691f..823c448 100644
--- a/plugins/mouse/msd-mouse-manager.c
+++ b/plugins/mouse/msd-mouse-manager.c
@@ -336,10 +336,10 @@ touchpad_set_bool (XDeviceInfo *device_info,
}
static void
-set_left_handed (MsdMouseManager *manager,
- XDeviceInfo *device_info,
- gboolean mouse_left_handed,
- gboolean touchpad_left_handed)
+set_left_handed_legacy_driver (MsdMouseManager *manager,
+ XDeviceInfo *device_info,
+ gboolean mouse_left_handed,
+ gboolean touchpad_left_handed)
{
XDevice *device;
guchar *buttons;
@@ -409,6 +409,48 @@ set_left_handed (MsdMouseManager *manager,
}
static void
+set_left_handed_libinput (XDeviceInfo *device_info,
+ gboolean mouse_left_handed,
+ gboolean touchpad_left_handed)
+{
+ XDevice *device;
+ gboolean want_lefthanded;
+
+ device = device_is_touchpad (device_info);
+ if (device == NULL) {
+ gdk_error_trap_push ();
+ device = XOpenDevice (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), device_info->id);
+ if ((gdk_error_trap_pop () != 0) || (device == NULL))
+ return;
+
+ want_lefthanded = mouse_left_handed;
+ } else {
+ /* touchpad device is already open after
+ * return from device_is_touchpad function
+ */
+ want_lefthanded = touchpad_left_handed;
+ }
+
+ property_set_bool (device_info, device, "libinput Left Handed Enabled", 0, want_lefthanded);
+
+ gdk_error_trap_push ();
+ XCloseDevice (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), device);
+ gdk_error_trap_pop_ignored ();
+}
+
+static void
+set_left_handed (MsdMouseManager *manager,
+ XDeviceInfo *device_info,
+ gboolean mouse_left_handed,
+ gboolean touchpad_left_handed)
+{
+ if (property_exists_on_device (device_info, "libinput Left Handed Enabled"))
+ set_left_handed_libinput (device_info, mouse_left_handed, touchpad_left_handed);
+ else
+ set_left_handed_legacy_driver (manager, device_info, mouse_left_handed, touchpad_left_handed);
+}
+
+static void
set_left_handed_all (MsdMouseManager *manager,
gboolean mouse_left_handed,
gboolean touchpad_left_handed)