summaryrefslogtreecommitdiff
path: root/plugins
diff options
context:
space:
mode:
authormonsta <[email protected]>2016-12-23 16:16:42 +0300
committermonsta <[email protected]>2017-01-02 16:53:33 +0300
commit3d5b274c60d9ba216bec77fa20992b543be51074 (patch)
tree94abf9e3017015b73f0849dff8b82e5b6fbf329f /plugins
parent2f03aca366d22bd844eb75ebcee47e0c251cee6b (diff)
downloadmate-settings-daemon-3d5b274c60d9ba216bec77fa20992b543be51074.tar.bz2
mate-settings-daemon-3d5b274c60d9ba216bec77fa20992b543be51074.tar.xz
mouse: libinput - hook up disable while typing
adapted from: https://github.com/linuxmint/cinnamon-settings-daemon/commit/4ab4ebab920ee8effb3f83df9318fbd7ad6a371c
Diffstat (limited to 'plugins')
-rw-r--r--plugins/mouse/msd-mouse-manager.c36
1 files changed, 34 insertions, 2 deletions
diff --git a/plugins/mouse/msd-mouse-manager.c b/plugins/mouse/msd-mouse-manager.c
index ab1b116..a7d2de2 100644
--- a/plugins/mouse/msd-mouse-manager.c
+++ b/plugins/mouse/msd-mouse-manager.c
@@ -816,9 +816,9 @@ have_program_in_path (const char *name)
}
static void
-set_disable_w_typing (MsdMouseManager *manager, gboolean state)
+set_disable_w_typing_synaptics (MsdMouseManager *manager,
+ gboolean state)
{
-
if (state && touchpad_is_present ()) {
GError *error = NULL;
char *args[6];
@@ -855,6 +855,38 @@ set_disable_w_typing (MsdMouseManager *manager, gboolean state)
}
}
+static void
+set_disable_w_typing_libinput (MsdMouseManager *manager,
+ gboolean state)
+{
+ XDeviceInfo *device_info;
+ gint n_devices;
+ gint i;
+
+ /* This is only called once for synaptics but for libinput
+ * we need to loop through the list of devices
+ */
+ device_info = XListInputDevices (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), &n_devices);
+
+ for (i = 0; i < n_devices; i++) {
+ touchpad_set_bool (device_info, "libinput Disable While Typing Enabled", 0, state);
+ }
+
+ if (device_info != NULL)
+ XFreeDeviceList (device_info);
+}
+
+static void
+set_disable_w_typing (MsdMouseManager *manager,
+ gboolean state)
+{
+ if (property_from_name ("Synaptics Off"))
+ set_disable_w_typing_synaptics (manager, state);
+
+ if (property_from_name ("libinput Disable While Typing Enabled"))
+ set_disable_w_typing_libinput (manager, state);
+}
+
static gboolean
get_touchpad_handedness (MsdMouseManager *manager,
gboolean mouse_left_handed)