kathenas / rpms / mutter

Forked from rpms/mutter 5 years ago
Clone

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

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