summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarlos Garnacho <carlosg@gnome.org>2021-04-21 18:54:06 +0000
committerGeorges Basile Stavracas Neto <georges.stavracas@gmail.com>2021-04-21 20:37:42 +0000
commitbd23f743d365ba4150c7632d1c7cdfc634226acb (patch)
tree3917a66b7799fd843edacac935727959fc4a545e
parent0da2ef8b0b44f794e0ff2b940d2b968f916d4e23 (diff)
downloadgnome-control-center-bd23f743d365ba4150c7632d1c7cdfc634226acb.tar.gz
shell: Avoid handling map events from other windows
The CcWindow tries to unset the focus when first mapping the window. However this pretty wide check intercepts mapping events from other windows than the toplevel (e.g. subsurfaces, for popovers). This causes the focus to move away from the popover, overriding its modality. Check that the event received is addressed to the CcWindow's GDK window before unsetting the focus, so we don't mess with popover focus. Fixes: https://gitlab.gnome.org/GNOME/gnome-control-center/-/issues/1327 (cherry picked from commit 7196e8aaea48054dd5fe825d371aec2319960897)
-rw-r--r--shell/cc-window.c15
1 files changed, 10 insertions, 5 deletions
diff --git a/shell/cc-window.c b/shell/cc-window.c
index 400c39116..de4eccc04 100644
--- a/shell/cc-window.c
+++ b/shell/cc-window.c
@@ -585,12 +585,17 @@ gdk_window_set_cb (CcWindow *self)
}
static gboolean
-window_map_event_cb (CcWindow *self)
+window_map_event_cb (CcWindow *self,
+ GdkEvent *event)
{
- /* If focus ends up in a category icon view one of the items is
- * immediately selected which looks odd when we are starting up, so
- * we explicitly unset the focus here. */
- gtk_window_set_focus (GTK_WINDOW (self), NULL);
+ if (event->any.window == gtk_widget_get_window (GTK_WIDGET (self)))
+ {
+ /* If focus ends up in a category icon view one of the items is
+ * immediately selected which looks odd when we are starting up, so
+ * we explicitly unset the focus here. */
+ gtk_window_set_focus (GTK_WINDOW (self), NULL);
+ }
+
return GDK_EVENT_PROPAGATE;
}