summaryrefslogtreecommitdiff
path: root/capplets
diff options
context:
space:
mode:
authormonsta <[email protected]>2017-01-03 21:21:11 +0300
committermonsta <[email protected]>2017-01-20 11:31:59 +0300
commit9d6f50fb73baabce06063e6f377aefd1e82a4f7d (patch)
tree295204a55dcb8ebf8ac690027a1c48d5ac503de0 /capplets
parent678aa95188f518c05169084d04aa31e49035ee6b (diff)
downloadmate-control-center-9d6f50fb73baabce06063e6f377aefd1e82a4f7d.tar.bz2
mate-control-center-9d6f50fb73baabce06063e6f377aefd1e82a4f7d.tar.xz
mouse: use input helper to detect both libinput and synaptics touchpads
same as done upstream: https://git.gnome.org/browse/gnome-control-center/commit/?id=01fbd4fee0271571d8d685be124e7c6e7c48dbde
Diffstat (limited to 'capplets')
-rw-r--r--capplets/mouse/mate-mouse-properties.c67
1 files changed, 2 insertions, 65 deletions
diff --git a/capplets/mouse/mate-mouse-properties.c b/capplets/mouse/mate-mouse-properties.c
index 732e5e8d..5d8b5ee9 100644
--- a/capplets/mouse/mate-mouse-properties.c
+++ b/capplets/mouse/mate-mouse-properties.c
@@ -34,6 +34,7 @@
#include "capplet-util.h"
#include "activate-settings-daemon.h"
#include "capplet-stock-icons.h"
+#include "msd-input-helper.h"
#include <sys/types.h>
#include <sys/stat.h>
@@ -217,70 +218,6 @@ synaptics_check_capabilities (GtkBuilder *dialog)
XFreeDeviceList (devicelist);
}
-static gboolean
-have_xinput_extension (void)
-{
- XExtensionVersion *version;
- gboolean result;
-
- /* Input device properties require version 1.5 or higher */
- version = XGetExtensionVersion (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), "XInputExtension");
- result = version->present && ((version->major_version * 1000 + version->minor_version) >= 1005);
- XFree (version);
-
- return result;
-}
-
-static gboolean
-find_synaptics (void)
-{
- gboolean ret = FALSE;
- int numdevices, i;
- XDeviceInfo *devicelist;
- Atom realtype, prop;
- int realformat;
- unsigned long nitems, bytes_after;
- unsigned char *data;
-
- if (!have_xinput_extension ())
- return FALSE;
-
- prop = XInternAtom (GDK_DISPLAY_XDISPLAY(gdk_display_get_default()), "Synaptics Off", True);
- if (!prop)
- return FALSE;
-
- devicelist = XListInputDevices (GDK_DISPLAY_XDISPLAY(gdk_display_get_default()), &numdevices);
- for (i = 0; i < numdevices; i++) {
- if (devicelist[i].use != IsXExtensionPointer)
- continue;
-
- gdk_error_trap_push();
- XDevice *device = XOpenDevice (GDK_DISPLAY_XDISPLAY(gdk_display_get_default()),
- devicelist[i].id);
- if (gdk_error_trap_pop ())
- continue;
-
- gdk_error_trap_push ();
- if ((XGetDeviceProperty (GDK_DISPLAY_XDISPLAY(gdk_display_get_default()), device, prop, 0, 1, False,
- XA_INTEGER, &realtype, &realformat, &nitems,
- &bytes_after, &data) == Success) && (realtype != None)) {
- XFree (data);
- ret = TRUE;
- }
-
- gdk_error_trap_pop_ignored ();
-
- XCloseDevice (GDK_DISPLAY_XDISPLAY(gdk_display_get_default()), device);
-
- if (ret)
- break;
- }
-
- XFreeDeviceList (devicelist);
-
- return ret;
-}
-
static void
comboxbox_changed_callback (GtkWidget *combobox, void *data)
{
@@ -335,7 +272,7 @@ setup_dialog (GtkBuilder *dialog)
G_SETTINGS_BIND_DEFAULT);
/* Trackpad page */
- if (find_synaptics () == FALSE)
+ if (touchpad_is_present () == FALSE)
gtk_notebook_remove_page (GTK_NOTEBOOK (WID ("prefs_widget")), -1);
else {
g_settings_bind (touchpad_settings, "touchpad-enabled",