widget: Set .default class when widget is default

Don't just conditionally set it on buttons.
This commit is contained in:
Benjamin Otte 2012-04-11 14:56:15 +02:00
parent 60eff87d08
commit 1d54e4e867
2 changed files with 9 additions and 2 deletions

View File

@ -1720,8 +1720,6 @@ _gtk_button_paint (GtkButton *button,
y += default_border.top;
width -= default_border.left + default_border.right;
height -= default_border.top + default_border.bottom;
gtk_style_context_add_class (context, GTK_STYLE_CLASS_DEFAULT);
}
else if (gtk_widget_get_can_default (widget))
{

View File

@ -6994,7 +6994,16 @@ void
_gtk_widget_set_has_default (GtkWidget *widget,
gboolean has_default)
{
GtkStyleContext *context;
widget->priv->has_default = has_default;
context = gtk_widget_get_style_context (widget);
if (has_default)
gtk_style_context_add_class (context, GTK_STYLE_CLASS_DEFAULT);
else
gtk_style_context_remove_class (context, GTK_STYLE_CLASS_DEFAULT);
}
/**