Blame SOURCES/0001-shell-Avoid-handling-map-events-from-other-windows.patch

967527
From 928eebadf0fd960472a83159c9888d946cd75ed2 Mon Sep 17 00:00:00 2001
967527
From: Carlos Garnacho <carlosg@gnome.org>
967527
Date: Wed, 21 Apr 2021 18:54:06 +0000
967527
Subject: [PATCH] shell: Avoid handling map events from other windows
967527
967527
The CcWindow tries to unset the focus when first mapping the window.
967527
However this pretty wide check intercepts mapping events from other
967527
windows than the toplevel (e.g. subsurfaces, for popovers). This
967527
causes the focus to move away from the popover, overriding its
967527
modality.
967527
967527
Check that the event received is addressed to the CcWindow's
967527
GDK window before unsetting the focus, so we don't mess with popover
967527
focus.
967527
967527
Fixes: https://gitlab.gnome.org/GNOME/gnome-control-center/-/issues/1327
967527
967527
(cherry picked from commit 7196e8aaea48054dd5fe825d371aec2319960897)
967527
---
967527
 shell/cc-window.c | 12 ++++++++----
967527
 1 file changed, 8 insertions(+), 4 deletions(-)
967527
967527
diff --git a/shell/cc-window.c b/shell/cc-window.c
967527
index 9144834a4..fe5ad1ee7 100644
967527
--- a/shell/cc-window.c
967527
+++ b/shell/cc-window.c
967527
@@ -458,10 +458,14 @@ window_map_event_cb (GtkWidget *widget,
967527
                      GdkEvent  *event,
967527
                      CcWindow  *self)
967527
 {
967527
-  /* If focus ends up in a category icon view one of the items is
967527
-   * immediately selected which looks odd when we are starting up, so
967527
-   * we explicitly unset the focus here. */
967527
-  gtk_window_set_focus (GTK_WINDOW (self), NULL);
967527
+  if (event->any.window == gtk_widget_get_window (GTK_WIDGET (self)))
967527
+    {
967527
+      /* If focus ends up in a category icon view one of the items is
967527
+       * immediately selected which looks odd when we are starting up, so
967527
+       * we  explicitly unset the focus here. */
967527
+      gtk_window_set_focus (GTK_WINDOW (self), NULL);
967527
+    }
967527
+
967527
   return GDK_EVENT_PROPAGATE;
967527
 }
967527
 
967527
-- 
967527
2.37.1
967527