mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2024-12-28 06:21:14 +00:00
window: Fix deferred focus unsetting
In commit 4a76abffd4
, we deferred unsetting focus
and default until after the next draw, overlooking the
case where the focus is set to another widget before we
ever get to the unsetting.
Fixes: #3413
This commit is contained in:
parent
24cd05672e
commit
4d19de4e03
@ -2011,6 +2011,8 @@ gtk_window_root_set_focus (GtkRoot *root,
|
|||||||
|
|
||||||
g_clear_object (&old_focus);
|
g_clear_object (&old_focus);
|
||||||
|
|
||||||
|
priv->move_focus = FALSE;
|
||||||
|
|
||||||
g_object_notify (G_OBJECT (self), "focus-widget");
|
g_object_notify (G_OBJECT (self), "focus-widget");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2288,6 +2290,8 @@ gtk_window_set_default_widget (GtkWindow *window,
|
|||||||
|
|
||||||
priv->default_widget = default_widget;
|
priv->default_widget = default_widget;
|
||||||
|
|
||||||
|
priv->unset_default = FALSE;
|
||||||
|
|
||||||
if (priv->default_widget)
|
if (priv->default_widget)
|
||||||
{
|
{
|
||||||
if (priv->focus_widget == NULL ||
|
if (priv->focus_widget == NULL ||
|
||||||
@ -4671,16 +4675,10 @@ maybe_unset_focus_and_default (GtkWindow *window)
|
|||||||
GtkWindowPrivate *priv = gtk_window_get_instance_private (window);
|
GtkWindowPrivate *priv = gtk_window_get_instance_private (window);
|
||||||
|
|
||||||
if (priv->move_focus)
|
if (priv->move_focus)
|
||||||
{
|
gtk_widget_child_focus (GTK_WIDGET (window), GTK_DIR_TAB_FORWARD);
|
||||||
gtk_widget_child_focus (GTK_WIDGET (window), GTK_DIR_TAB_FORWARD);
|
|
||||||
priv->move_focus = FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (priv->unset_default)
|
if (priv->unset_default)
|
||||||
{
|
gtk_window_set_default_widget (window, NULL);
|
||||||
gtk_window_set_default_widget (window, NULL);
|
|
||||||
priv->unset_default = FALSE;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
|
Loading…
Reference in New Issue
Block a user