kathenas / rpms / mutter

Forked from rpms/mutter 5 years ago
Clone
Blob Blame History Raw
From 368fdebe8f4f4e0c0e41f5be9961a748f328cb57 Mon Sep 17 00:00:00 2001
From: Carlos Garnacho <carlosg@gnome.org>
Date: Tue, 13 Feb 2018 11:44:40 +0100
Subject: [PATCH] clutter: Extend touchpad device property check for Synaptics

So we reliably get CLUTTER_TOUCHPAD_DEVICE for those. The other heuristics
to get the device type may fall short.
---
 .../clutter/x11/clutter-device-manager-xi2.c  | 22 ++++++++++++++++---
 1 file changed, 19 insertions(+), 3 deletions(-)

diff --git a/clutter/clutter/x11/clutter-device-manager-xi2.c b/clutter/clutter/x11/clutter-device-manager-xi2.c
index 87da4b050..297d3acfe 100644
--- a/clutter/clutter/x11/clutter-device-manager-xi2.c
+++ b/clutter/clutter/x11/clutter-device-manager-xi2.c
@@ -282,8 +282,9 @@ is_touch_device (XIAnyClassInfo         **classes,
 }
 
 static gboolean
-is_touchpad_device (ClutterBackendX11 *backend_x11,
-                    XIDeviceInfo      *info)
+query_exists_device_property (ClutterBackendX11 *backend_x11,
+                              XIDeviceInfo      *info,
+                              const gchar       *property)
 {
   gulong nitems, bytes_after;
   guint32 *data = NULL;
@@ -291,7 +292,7 @@ is_touchpad_device (ClutterBackendX11 *backend_x11,
   Atom type;
   Atom prop;
 
-  prop = XInternAtom (backend_x11->xdpy, "libinput Tapping Enabled", True);
+  prop = XInternAtom (backend_x11->xdpy, property, True);
   if (prop == None)
     return FALSE;
 
@@ -312,6 +313,21 @@ is_touchpad_device (ClutterBackendX11 *backend_x11,
   return TRUE;
 }
 
+static gboolean
+is_touchpad_device (ClutterBackendX11 *backend_x11,
+                    XIDeviceInfo      *info)
+{
+  if (query_exists_device_property (backend_x11, info,
+                                    "libinput Tapping Enabled"))
+    return TRUE;
+
+  if (query_exists_device_property (backend_x11, info,
+                                    "Synaptics Off"))
+    return TRUE;
+
+  return FALSE;
+}
+
 static gboolean
 get_device_ids (ClutterBackendX11  *backend_x11,
                 XIDeviceInfo       *info,
-- 
2.21.0