kathenas / rpms / mutter

Forked from rpms/mutter 5 years ago
Clone

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

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