Blame SOURCES/0001-core-Let-pad-mode-switch-events-always-go-through-Me.patch

1a3082
From 5cab6bac4d4fb06e60d3198dc654a5d70fa6240e Mon Sep 17 00:00:00 2001
1a3082
From: Carlos Garnacho <carlosg@gnome.org>
1a3082
Date: Mon, 16 Dec 2019 13:53:26 +0100
1a3082
Subject: [PATCH] core: Let pad mode switch events always go through
1a3082
 MetaInputSettings
1a3082
1a3082
We used to inhibit all pad actions while the OSD is shown, but one we
1a3082
would actually want to handle are mode switches while the OSD is open.
1a3082
So it has an opportunity to catch up to the mode switch.
1a3082
1a3082
This lets MetaInputSettings reflect the mode switch (eg. when querying
1a3082
action labels), so the OSD has an opportunity to update the current
1a3082
actions.
1a3082
1a3082
https://gitlab.gnome.org/GNOME/mutter/merge_requests/975
1a3082
---
1a3082
 src/core/events.c | 30 ++++++++++++++++++++++++------
1a3082
 1 file changed, 24 insertions(+), 6 deletions(-)
1a3082
1a3082
diff --git a/src/core/events.c b/src/core/events.c
1a3082
index d383778629..44f28d0b97 100644
1a3082
--- a/src/core/events.c
1a3082
+++ b/src/core/events.c
1a3082
@@ -256,13 +256,31 @@ meta_display_handle_event (MetaDisplay        *display,
1a3082
     }
1a3082
 #endif
1a3082
 
1a3082
-  if (!display->current_pad_osd &&
1a3082
-      (event->type == CLUTTER_PAD_BUTTON_PRESS ||
1a3082
-       event->type == CLUTTER_PAD_BUTTON_RELEASE ||
1a3082
-       event->type == CLUTTER_PAD_RING ||
1a3082
-       event->type == CLUTTER_PAD_STRIP))
1a3082
+  if (event->type == CLUTTER_PAD_BUTTON_PRESS ||
1a3082
+      event->type == CLUTTER_PAD_BUTTON_RELEASE ||
1a3082
+      event->type == CLUTTER_PAD_RING ||
1a3082
+      event->type == CLUTTER_PAD_STRIP)
1a3082
     {
1a3082
-      if (meta_input_settings_handle_pad_event (meta_backend_get_input_settings (backend),
1a3082
+      gboolean handle_pad_event = TRUE;
1a3082
+      gboolean is_mode_switch = FALSE;
1a3082
+
1a3082
+      if (event->type == CLUTTER_PAD_BUTTON_PRESS ||
1a3082
+          event->type == CLUTTER_PAD_BUTTON_RELEASE)
1a3082
+        {
1a3082
+          ClutterInputDevice *pad;
1a3082
+          uint32_t button;
1a3082
+
1a3082
+          pad = clutter_event_get_source_device (event);
1a3082
+          button = clutter_event_get_button (event);
1a3082
+
1a3082
+          is_mode_switch =
1a3082
+            clutter_input_device_get_mode_switch_button_group (pad, button) >= 0;
1a3082
+        }
1a3082
+
1a3082
+      handle_pad_event = !display->current_pad_osd || is_mode_switch;
1a3082
+
1a3082
+      if (handle_pad_event &&
1a3082
+          meta_input_settings_handle_pad_event (meta_backend_get_input_settings (backend),
1a3082
                                                 event))
1a3082
         {
1a3082
           bypass_wayland = bypass_clutter = TRUE;
1a3082
-- 
1a3082
2.24.0
1a3082