[Xfce4-commits] [xfce/xfce4-settings] 01/01: Do not change props on disabled libinput devices

noreply at xfce.org noreply at xfce.org
Wed Feb 25 11:00:52 CET 2015


This is an automated email from the git hooks/post-receive script.

olivier pushed a commit to branch master
in repository xfce/xfce4-settings.

commit 07bc448feeb5130e6d41e338543e01b5b7d0d696
Author: Olivier Fourdan <fourdan at xfce.org>
Date:   Wed Feb 25 10:59:18 2015 +0100

    Do not change props on disabled libinput devices
    
    Otherwise it crashes the Xserver.
    
    See https://bugs.freedesktop.org/show_bug.cgi?id=89296 and
    http://lists.x.org/archives/xorg-devel/2015-February/045716.html
    
    Signed-off-by: Olivier Fourdan <fourdan at xfce.org>
---
 xfsettingsd/pointers.c |   46 ++++++++++++++++++++++++++++++++++++++++++++--
 1 file changed, 44 insertions(+), 2 deletions(-)

diff --git a/xfsettingsd/pointers.c b/xfsettingsd/pointers.c
index 8d508f0..78f8b28 100644
--- a/xfsettingsd/pointers.c
+++ b/xfsettingsd/pointers.c
@@ -47,10 +47,13 @@
 #include "pointers-defines.h"
 
 #define MAX_DENOMINATOR (100.00)
-
 #define XFCONF_TYPE_G_VALUE_ARRAY (dbus_g_type_get_collection ("GPtrArray", G_TYPE_VALUE))
 
-
+#ifdef XI_PROP_ENABLED
+#define DEVICE_ENABLED XI_PROP_ENABLED
+#else
+#define DEVICE_ENABLED "Device Enabled"
+#endif /* XI_PROP_ENABLED */
 
 static void             xfce_pointers_helper_finalize                 (GObject            *object);
 static void             xfce_pointers_helper_syndaemon_stop           (XfcePointersHelper *helper);
@@ -202,6 +205,34 @@ xfce_pointers_helper_finalize (GObject *object)
 
 #ifdef HAVE_LIBINPUT
 static gboolean
+xfce_pointers_is_enabled (Display *xdisplay,
+                          XDevice *device)
+{
+    Atom     prop, type;
+    gulong   n_items, bytes_after;
+    gint     rc, format;
+    guchar  *data;
+    gboolean enabled;
+
+    prop = XInternAtom (xdisplay, DEVICE_ENABLED, False);
+    gdk_error_trap_push ();
+    rc = XGetDeviceProperty (xdisplay, device, prop, 0, 1, False,
+                             XA_INTEGER, &type, &format, &n_items,
+                             &bytes_after, &data);
+    gdk_error_trap_pop ();
+    if (rc == Success)
+    {
+        enabled = (gboolean) *data;
+        XFree (data);
+        return (enabled);
+    }
+
+    return FALSE;
+}
+
+
+
+static gboolean
 xfce_pointers_is_libinput (Display *xdisplay,
                            XDevice *device)
 {
@@ -740,6 +771,17 @@ xfce_pointers_helper_change_property (XDeviceInfo  *device_info,
     if (prop == None)
         return;
 
+#ifdef HAVE_LIBINPUT
+    /*
+     * libinput cannot change properties on disabled devices
+     * see: https://bugs.freedesktop.org/show_bug.cgi?id=89296
+     * and: http://lists.x.org/archives/xorg-devel/2015-February/045716.html
+     */
+    if (prop != XInternAtom (xdisplay, DEVICE_ENABLED, True) &&
+        !xfce_pointers_is_enabled (xdisplay, device))
+        return;
+#endif /* HAVE_LIBINPUT */
+
     gdk_error_trap_push ();
     props = XListDeviceProperties (xdisplay, device, &n_props);
     if (gdk_error_trap_pop () || props == NULL)

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the Xfce4-commits mailing list