Commit 6e553324 authored by Carlos Garnacho's avatar Carlos Garnacho

Make gtk_widget_get_state_flags() avoid propagating the focused flag down the hierarchy

There is only one widget supposed to have the focused flag at a given time,
so avoid propagating the state down the hierarchy, the focused flag is now
also set in _gtk_widget_set_has_focus().
parent 7fabfec5
......@@ -6971,6 +6971,14 @@ _gtk_widget_update_state_flags (GtkWidget *widget,
flags &= ~(GTK_STATE_FLAG_INSENSITIVE);
/* Focused state is meant to be set only on the widget
* being changed itself, not on the children */
if ((flags & GTK_STATE_FLAG_FOCUSED) !=
(priv->state_flags & GTK_STATE_FLAG_FOCUSED))
priv->state_flags |= GTK_STATE_FLAG_FOCUSED;
flags &= ~(GTK_STATE_FLAG_FOCUSED);
if (flags != 0 ||
operation == STATE_CHANGE_REPLACE)
{
......@@ -7075,6 +7083,9 @@ gtk_widget_get_state_flags (GtkWidget *widget)
if (!gtk_widget_is_sensitive (widget))
flags |= GTK_STATE_FLAG_INSENSITIVE;
if (gtk_widget_has_focus (widget))
flags |= GTK_STATE_FLAG_FOCUSED;
return flags;
}
......@@ -13906,6 +13917,11 @@ _gtk_widget_set_has_focus (GtkWidget *widget,
gboolean has_focus)
{
widget->priv->has_focus = has_focus;
if (has_focus)
gtk_widget_set_state_flags (widget, GTK_STATE_FLAG_FOCUSED, FALSE);
else
gtk_widget_unset_state_flags (widget, GTK_STATE_FLAG_FOCUSED);
}
/**
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment