[gnome-settings-daemon] mouse: Enable tap to click on devices without hw buttons



commit 0f41e196509c7c30f48516fa00e3396db565d5e8
Author: Ondrej Holy <oholy redhat com>
Date:   Wed Apr 15 14:54:43 2015 +0200

    mouse: Enable tap to click on devices without hw buttons
    
    We have to be sure that devices without hardware buttons have tap to
    click enabled.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=745601

 plugins/mouse/gsd-mouse-manager.c |   16 ++++++++++++++--
 1 files changed, 14 insertions(+), 2 deletions(-)
---
diff --git a/plugins/mouse/gsd-mouse-manager.c b/plugins/mouse/gsd-mouse-manager.c
index c8d4284..4fcf9e3 100644
--- a/plugins/mouse/gsd-mouse-manager.c
+++ b/plugins/mouse/gsd-mouse-manager.c
@@ -607,13 +607,14 @@ set_tap_to_click (GdkDevice *device,
         unsigned long nitems, bytes_after;
         XDevice *xdevice;
         unsigned char* data;
-        Atom prop, type;
+        Atom prop_capabilities, prop, type;
 
         if (xdevice_is_libinput (gdk_x11_device_get_id (device)))
                 return;
 
         prop = XInternAtom (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), "Synaptics Tap Action", 
False);
-        if (!prop)
+        prop_capabilities = XInternAtom (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), "Synaptics 
Capabilities", False);
+        if (!prop || !prop_capabilities)
                 return;
 
         xdevice = open_gdk_device (device);
@@ -628,6 +629,17 @@ set_tap_to_click (GdkDevice *device,
        g_debug ("setting tap to click on %s", gdk_device_get_name (device));
 
         gdk_error_trap_push ();
+        rc = XGetDeviceProperty (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), xdevice, 
prop_capabilities, 0, 1,
+                                 False, XA_INTEGER, &type, &format, &nitems, &bytes_after, &data);
+        if (rc == Success && type == XA_INTEGER && format == 8 && nitems >= 1) {
+                if (!(data[0])) {
+                        g_debug ("No hardware buttons, enabling tap to click on %s", gdk_device_get_name 
(device));
+                        state = TRUE;
+                }
+
+                XFree (data);
+        }
+
         rc = XGetDeviceProperty (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), xdevice, prop, 0, 2,
                                  False, XA_INTEGER, &type, &format, &nitems,
                                  &bytes_after, &data);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]