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

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