Revert "Ensure GtkWidget::style-updated is emitted before first size negociation"

This reverts commit b7f772eb93.

The commit just poked around things and added lots of workarounds
instead of actually fixing the bug it set out to fix.

See https://bugzilla.gnome.org/show_bug.cgi?id=639584 for details.
This commit is contained in:
Benjamin Otte 2011-03-26 23:52:28 +01:00
parent 8ce533265e
commit 0cdebc8bd5

View File

@ -4389,10 +4389,7 @@ gtk_widget_realize (GtkWidget *widget)
gtk_widget_ensure_style (widget); gtk_widget_ensure_style (widget);
if (priv->style_update_pending) if (priv->style_update_pending)
{ g_signal_emit (widget, widget_signals[STYLE_UPDATED], 0);
g_signal_emit (widget, widget_signals[STYLE_UPDATED], 0);
priv->style_update_pending = FALSE;
}
g_signal_emit (widget, widget_signals[REALIZE], 0); g_signal_emit (widget, widget_signals[REALIZE], 0);
@ -6471,13 +6468,16 @@ gtk_widget_real_query_tooltip (GtkWidget *widget,
static void static void
gtk_widget_real_style_updated (GtkWidget *widget) gtk_widget_real_style_updated (GtkWidget *widget)
{ {
/* Trigger ::style-set for old if (gtk_widget_get_realized (widget))
* widgets not listening to this {
*/ /* Trigger ::style-set for old
g_signal_emit (widget, * widgets not listening to this
widget_signals[STYLE_SET], */
0, g_signal_emit (widget,
widget->priv->style); widget_signals[STYLE_SET],
0,
widget->priv->style);
}
if (widget->priv->context) if (widget->priv->context)
{ {
@ -7692,12 +7692,6 @@ gtk_widget_set_parent (GtkWidget *widget,
gtk_widget_push_verify_invariants (widget); gtk_widget_push_verify_invariants (widget);
if (!widget->priv->context)
{
/* Ensure the style context is there */
gtk_widget_get_style_context (widget);
}
priv->parent = parent; priv->parent = parent;
parent_flags = gtk_widget_get_state_flags (parent); parent_flags = gtk_widget_get_state_flags (parent);
@ -7713,7 +7707,7 @@ gtk_widget_set_parent (GtkWidget *widget,
data.use_forall = gtk_widget_is_sensitive (parent) != gtk_widget_is_sensitive (widget); data.use_forall = gtk_widget_is_sensitive (parent) != gtk_widget_is_sensitive (widget);
gtk_widget_propagate_state (widget, &data); gtk_widget_propagate_state (widget, &data);
gtk_widget_reset_style (widget); gtk_widget_reset_rc_styles (widget);
g_signal_emit (widget, widget_signals[PARENT_SET], 0, NULL); g_signal_emit (widget, widget_signals[PARENT_SET], 0, NULL);
if (priv->parent->priv->anchored) if (priv->parent->priv->anchored)
@ -7753,6 +7747,19 @@ gtk_widget_set_parent (GtkWidget *widget,
gtk_widget_queue_compute_expand (parent); gtk_widget_queue_compute_expand (parent);
} }
if (widget->priv->context)
{
GdkScreen *screen;
_gtk_widget_update_path (widget);
gtk_style_context_set_path (widget->priv->context, widget->priv->path);
screen = gtk_widget_get_screen (widget);
if (screen)
gtk_style_context_set_screen (widget->priv->context, screen);
}
gtk_widget_pop_verify_invariants (widget); gtk_widget_pop_verify_invariants (widget);
} }
@ -8703,16 +8710,9 @@ reset_style_recurse (GtkWidget *widget, gpointer data)
{ {
if (widget->priv->context) if (widget->priv->context)
{ {
GdkScreen *screen;
_gtk_widget_update_path (widget); _gtk_widget_update_path (widget);
gtk_style_context_set_path (widget->priv->context, gtk_style_context_set_path (widget->priv->context,
widget->priv->path); widget->priv->path);
screen = gtk_widget_get_screen_unchecked (widget);
if (screen)
gtk_style_context_set_screen (widget->priv->context, screen);
} }
if (GTK_IS_CONTAINER (widget)) if (GTK_IS_CONTAINER (widget))
@ -14304,13 +14304,12 @@ style_context_changed (GtkStyleContext *context,
gtk_widget_update_pango_context (widget); gtk_widget_update_pango_context (widget);
if (widget->priv->parent && if (gtk_widget_get_realized (widget))
gtk_widget_get_screen_unchecked (widget))
g_signal_emit (widget, widget_signals[STYLE_UPDATED], 0); g_signal_emit (widget, widget_signals[STYLE_UPDATED], 0);
else if (!gtk_widget_get_realized (widget)) else
{ {
/* Compress all style updates so it /* Compress all style updates so it
* is emitted at least once pre-realize * is only emitted once pre-realize.
*/ */
widget->priv->style_update_pending = TRUE; widget->priv->style_update_pending = TRUE;
} }