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

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