Blame SOURCES/0001-x11-Check-wacom-button-flags-to-determine-whether-bu.patch

1a3082
From 57b3a2ea620f754cfd38f1ed4851dd8223efbcab Mon Sep 17 00:00:00 2001
1a3082
From: Carlos Garnacho <carlosg@gnome.org>
1a3082
Date: Thu, 28 Nov 2019 22:50:36 +0100
1a3082
Subject: [PATCH] x11: Check wacom button flags to determine whether button is
1a3082
 mode switch
1a3082
1a3082
Checking the leds is not really accurate, since some devices have mode
1a3082
switch buttons without leds. Check in the button flags whether they are
1a3082
mode switch buttons for any of ring/ring2/strip/strip2, and return the
1a3082
appropriate group.
1a3082
1a3082
https://gitlab.gnome.org/GNOME/mutter/merge_requests/952
1a3082
---
1a3082
 .../clutter/x11/clutter-input-device-xi2.c    | 19 +++++++++++++++----
1a3082
 1 file changed, 15 insertions(+), 4 deletions(-)
1a3082
1a3082
diff --git a/clutter/clutter/x11/clutter-input-device-xi2.c b/clutter/clutter/x11/clutter-input-device-xi2.c
1a3082
index 1254aca3ae..4e5e2fd12c 100644
1a3082
--- a/clutter/clutter/x11/clutter-input-device-xi2.c
1a3082
+++ b/clutter/clutter/x11/clutter-input-device-xi2.c
1a3082
@@ -155,14 +155,25 @@ clutter_input_device_xi2_get_button_group (ClutterInputDevice *device,
1a3082
 
1a3082
   if (device_xi2->wacom_device)
1a3082
     {
1a3082
+      WacomButtonFlags flags;
1a3082
+
1a3082
       if (button >= libwacom_get_num_buttons (device_xi2->wacom_device))
1a3082
         return -1;
1a3082
 
1a3082
-      return libwacom_get_button_led_group (device_xi2->wacom_device,
1a3082
-                                            'A' + button);
1a3082
+      flags = libwacom_get_button_flag (device_xi2->wacom_device,
1a3082
+                                        'A' + button);
1a3082
+
1a3082
+      if (flags &
1a3082
+          (WACOM_BUTTON_RING_MODESWITCH |
1a3082
+           WACOM_BUTTON_TOUCHSTRIP_MODESWITCH))
1a3082
+        return 0;
1a3082
+      if (flags &
1a3082
+          (WACOM_BUTTON_RING2_MODESWITCH |
1a3082
+           WACOM_BUTTON_TOUCHSTRIP2_MODESWITCH))
1a3082
+        return 1;
1a3082
     }
1a3082
-  else
1a3082
-    return -1;
1a3082
+
1a3082
+  return -1;
1a3082
 }
1a3082
 #endif
1a3082
 
1a3082
-- 
1a3082
2.24.0
1a3082