kathenas / rpms / mutter

Forked from rpms/mutter 5 years ago
Clone

Blame SOURCES/0001-backends-Always-enable-tap-to-click-drag-on-opaque-W.patch

7cc7ff
From eeff82f534f81b086d10d53124362d9e316e2cf9 Mon Sep 17 00:00:00 2001
7cc7ff
From: Carlos Garnacho <carlosg@gnome.org>
7cc7ff
Date: Thu, 12 Dec 2019 18:05:08 +0100
7cc7ff
Subject: [PATCH] backends: Always enable tap-to-click/drag on opaque Wacom
7cc7ff
 tablets
7cc7ff
7cc7ff
Touch-wise, those are essentially giant touchpads, but have no buttons
7cc7ff
associated to the "touchpad" device (There may be pad buttons, but
7cc7ff
those are not mouse buttons).
7cc7ff
7cc7ff
Without tap-to-click/drag, touch in those devices is somewhat useless
7cc7ff
out of the box. Have them always enable these features, despite the
7cc7ff
setting.
7cc7ff
7cc7ff
https://gitlab.gnome.org/GNOME/mutter/merge_requests/968
7cc7ff
---
7cc7ff
 src/backends/meta-input-settings.c | 33 ++++++++++++++++++++++++++++--
7cc7ff
 1 file changed, 31 insertions(+), 2 deletions(-)
7cc7ff
7cc7ff
diff --git a/src/backends/meta-input-settings.c b/src/backends/meta-input-settings.c
7cc7ff
index 2e6672d9c..28dc387ef 100644
7cc7ff
--- a/src/backends/meta-input-settings.c
7cc7ff
+++ b/src/backends/meta-input-settings.c
7cc7ff
@@ -517,6 +517,33 @@ update_touchpad_disable_while_typing (MetaInputSettings  *input_settings,
7cc7ff
     }
7cc7ff
 }
7cc7ff
 
7cc7ff
+static gboolean
7cc7ff
+device_is_tablet_touchpad (MetaInputSettings  *input_settings,
7cc7ff
+                           ClutterInputDevice *device)
7cc7ff
+{
7cc7ff
+#ifdef HAVE_LIBWACOM
7cc7ff
+  WacomIntegrationFlags flags = 0;
7cc7ff
+  WacomDevice *wacom_device;
7cc7ff
+
7cc7ff
+  if (clutter_input_device_get_device_type (device) != CLUTTER_TOUCHPAD_DEVICE)
7cc7ff
+    return FALSE;
7cc7ff
+
7cc7ff
+  wacom_device =
7cc7ff
+    meta_input_settings_get_tablet_wacom_device (input_settings,
7cc7ff
+                                                 device);
7cc7ff
+  if (wacom_device)
7cc7ff
+    {
7cc7ff
+      flags = libwacom_get_integration_flags (wacom_device);
7cc7ff
+
7cc7ff
+      if ((flags & (WACOM_DEVICE_INTEGRATED_SYSTEM |
7cc7ff
+                    WACOM_DEVICE_INTEGRATED_DISPLAY)) == 0)
7cc7ff
+        return TRUE;
7cc7ff
+    }
7cc7ff
+#endif
7cc7ff
+
7cc7ff
+  return FALSE;
7cc7ff
+}
7cc7ff
+
7cc7ff
 static void
7cc7ff
 update_touchpad_tap_enabled (MetaInputSettings  *input_settings,
7cc7ff
                              ClutterInputDevice *device)
7cc7ff
@@ -531,7 +558,8 @@ update_touchpad_tap_enabled (MetaInputSettings  *input_settings,
7cc7ff
 
7cc7ff
   priv = meta_input_settings_get_instance_private (input_settings);
7cc7ff
   input_settings_class = META_INPUT_SETTINGS_GET_CLASS (input_settings);
7cc7ff
-  enabled = g_settings_get_boolean (priv->touchpad_settings, "tap-to-click");
7cc7ff
+  enabled = device_is_tablet_touchpad (input_settings, device) ||
7cc7ff
+    g_settings_get_boolean (priv->touchpad_settings, "tap-to-click");
7cc7ff
 
7cc7ff
   if (device)
7cc7ff
     {
7cc7ff
@@ -561,7 +589,8 @@ update_touchpad_tap_and_drag_enabled (MetaInputSettings  *input_settings,
7cc7ff
 
7cc7ff
   priv = meta_input_settings_get_instance_private (input_settings);
7cc7ff
   input_settings_class = META_INPUT_SETTINGS_GET_CLASS (input_settings);
7cc7ff
-  enabled = g_settings_get_boolean (priv->touchpad_settings, "tap-and-drag");
7cc7ff
+  enabled = device_is_tablet_touchpad (input_settings, device) ||
7cc7ff
+    g_settings_get_boolean (priv->touchpad_settings, "tap-and-drag");
7cc7ff
 
7cc7ff
   if (device)
7cc7ff
     {
7cc7ff
-- 
7cc7ff
2.23.0
7cc7ff