[gtk/fix-focus-changes] window: Don't focus invisible widgets
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk/fix-focus-changes] window: Don't focus invisible widgets
- Date: Tue, 18 Oct 2022 02:22:08 +0000 (UTC)
commit 45ea922712ec6711b38ecd92bbd2d16996a1a473
Author: Matthias Clasen <mclasen redhat com>
Date: Mon Oct 17 15:10:51 2022 -0400
window: Don't focus invisible widgets
Only clear a queued move_focus if the widget
we are focusing is actually visible.
This was happening in some cases when popovers
are dismissed by clicking outside, and it was
causing us to miss proper focus updates that
were already queued.
gtk/gtkwindow.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
---
diff --git a/gtk/gtkwindow.c b/gtk/gtkwindow.c
index ff16a68104..acf2269680 100644
--- a/gtk/gtkwindow.c
+++ b/gtk/gtkwindow.c
@@ -2004,7 +2004,9 @@ gtk_window_root_set_focus (GtkRoot *root,
if (focus == priv->focus_widget)
{
- priv->move_focus = FALSE;
+ if (priv->move_focus &&
+ focus && gtk_widget_is_visible (focus))
+ priv->move_focus = FALSE;
return;
}
@@ -2024,7 +2026,9 @@ gtk_window_root_set_focus (GtkRoot *root,
g_clear_object (&old_focus);
- priv->move_focus = FALSE;
+ if (priv->move_focus &&
+ focus && gtk_widget_is_visible (focus))
+ priv->move_focus = FALSE;
g_object_notify (G_OBJECT (self), "focus-widget");
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]