[gnome-control-center] mouse: Fix checking capabilities for multiple devices



commit 2f8453438825d6862e08025446c10a2a4485362f
Author: Ondrej Holy <oholy redhat com>
Date:   Wed Apr 15 11:12:15 2015 +0200

    mouse: Fix checking capabilities for multiple devices
    
    Two finger scroll toggle should be sensitive if at least one of the
    devices support it. g-s-d is responsible to set edge-scroll for the
    devices which don't support double touch.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=745601

 panels/mouse/gnome-mouse-properties.c |   21 ++++++++++++++-------
 1 files changed, 14 insertions(+), 7 deletions(-)
---
diff --git a/panels/mouse/gnome-mouse-properties.c b/panels/mouse/gnome-mouse-properties.c
index 5fe4fd4..036ea88 100644
--- a/panels/mouse/gnome-mouse-properties.c
+++ b/panels/mouse/gnome-mouse-properties.c
@@ -111,11 +111,15 @@ synaptics_check_capabilities_x11 (CcMousePropertiesPrivate *d)
        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)
                return;
 
+       tap_to_click = FALSE;
+       two_finger_scroll = FALSE;
+
        devicelist = XListInputDevices (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), &numdevices);
        for (i = 0; i < numdevices; i++) {
                if (devicelist[i].use != IsXExtensionPointer)
@@ -133,14 +137,14 @@ synaptics_check_capabilities_x11 (CcMousePropertiesPrivate *d)
                                         &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. */
-                       if (!data[0]) {
-                               gtk_widget_set_sensitive (WID ("tap_to_click_toggle"), FALSE);
-                       }
 
-                       /* Disable two finger scrolling unless the hardware supports
-                        * double touch */
-                       if (!(data[3]))
-                               gtk_widget_set_sensitive (WID ("two_finger_scroll_toggle"), FALSE);
+                       /* Set tap_to_click_toggle sensitive only if the device has hardware buttons */
+                       if (data[0])
+                               tap_to_click = TRUE;
+
+                       /* Set two_finger_scroll_toggle sensitive if the hardware supports double touch */
+                       if (data[3])
+                               two_finger_scroll = TRUE;
 
                        XFree (data);
                }
@@ -149,6 +153,9 @@ synaptics_check_capabilities_x11 (CcMousePropertiesPrivate *d)
                XCloseDevice (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), device);
        }
        XFreeDeviceList (devicelist);
+
+       gtk_widget_set_sensitive (WID ("tap_to_click_toggle"), tap_to_click);
+       gtk_widget_set_sensitive (WID ("two_finger_scroll_toggle"), two_finger_scroll);
 }
 
 static void


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