[gnome-control-center] mouse: Fix sensitivity of two-finger toggle with libinput



commit 155d440623c1af67f3594c7508d9b7f44c83dae6
Author: Ondrej Holy <oholy redhat com>
Date:   Wed Apr 15 11:27:02 2015 +0200

    mouse: Fix sensitivity of two-finger toggle with libinput
    
    Check "libinput Scroll Methods Available" and set two_finger_scroll_toggle
    sensitivity appropriately. Many libinput devices don't have edge scroll,
    see http://who-t.blogspot.cz/2015/03/why-libinput-doesnt-support-edge.html
    Allow changing scroll methods only if both two-finger and edge scroll is
    supported.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=745601

 panels/mouse/gnome-mouse-properties.c |   26 +++++++++++++++++++++-----
 1 files changed, 21 insertions(+), 5 deletions(-)
---
diff --git a/panels/mouse/gnome-mouse-properties.c b/panels/mouse/gnome-mouse-properties.c
index 036ea88..c50a37b 100644
--- a/panels/mouse/gnome-mouse-properties.c
+++ b/panels/mouse/gnome-mouse-properties.c
@@ -107,14 +107,15 @@ synaptics_check_capabilities_x11 (CcMousePropertiesPrivate *d)
 {
        int numdevices, i;
        XDeviceInfo *devicelist;
-       Atom realtype, prop;
+       Atom realtype, prop_capabilities, prop_scroll_methods;
        int realformat;
        unsigned long nitems, bytes_after;
        unsigned char *data;
        gboolean tap_to_click, two_finger_scroll;
 
-       prop = XInternAtom (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), "Synaptics Capabilities", 
True);
-       if (!prop)
+       prop_capabilities = XInternAtom (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), "Synaptics 
Capabilities", False);
+       prop_scroll_methods = XInternAtom (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), "libinput 
Scroll Methods Available", False);
+       if (!prop_capabilities || !prop_scroll_methods)
                return;
 
        tap_to_click = FALSE;
@@ -132,8 +133,10 @@ synaptics_check_capabilities_x11 (CcMousePropertiesPrivate *d)
                        continue;
 
                gdk_error_trap_push ();
-               if ((XGetDeviceProperty (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), device, prop, 0, 
2, False,
-                                        XA_INTEGER, &realtype, &realformat, &nitems,
+
+               /* xorg-x11-drv-synaptics */
+               if ((XGetDeviceProperty (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), device, 
prop_capabilities,
+                                        0, 2, False, XA_INTEGER, &realtype, &realformat, &nitems,
                                         &bytes_after, &data) == Success) && (realtype != None)) {
                        /* Property data is booleans for has_left, has_middle, has_right, has_double, 
has_triple.
                         * Newer drivers (X.org/kerrnel) will also include has_pressure and has_width. */
@@ -148,6 +151,19 @@ synaptics_check_capabilities_x11 (CcMousePropertiesPrivate *d)
 
                        XFree (data);
                }
+
+               /* xorg-x11-drv-libinput */
+               if ((XGetDeviceProperty (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), device, 
prop_scroll_methods,
+                                        0, 2, False, XA_INTEGER, &realtype, &realformat, &nitems,
+                                        &bytes_after, &data) == Success) && (realtype != None)) {
+                       /* Property data is booleans for two-finger, edge, on-button scroll available. */
+
+                       if (data[0] && data[1])
+                               two_finger_scroll = TRUE;
+
+                       XFree (data);
+               }
+
                gdk_error_trap_pop_ignored ();
 
                XCloseDevice (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), device);


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