From 6a0704aeb4edb0d43010270348c8de1d27e4453a Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Thu, 8 Oct 2020 20:32:39 -0400 Subject: [PATCH] window: Be more careful when looking for focus When passing focus up to a parent, make sure the newly chosen focus widget actually accepts the focus. --- gtk/gtkwindow.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/gtk/gtkwindow.c b/gtk/gtkwindow.c index c5c69e2b33..a6f7f37912 100644 --- a/gtk/gtkwindow.c +++ b/gtk/gtkwindow.c @@ -5242,8 +5242,8 @@ _gtk_window_unset_focus_and_default (GtkWindow *window, { if (_gtk_widget_get_visible (parent)) { - gtk_window_set_focus (window, parent); - break; + if (gtk_widget_grab_focus (parent)) + break; } parent = gtk_widget_get_parent (parent);