[gtk+] Compress all ::style-updated prior to ::realize
- From: Carlos Garnacho <carlosg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+] Compress all ::style-updated prior to ::realize
- Date: Tue, 4 Jan 2011 02:18:59 +0000 (UTC)
commit dd8887c07d8f72b77762a5de5fa70ab3a432ba9d
Author: Carlos Garnacho <carlosg gnome org>
Date: Tue Jan 4 01:59:23 2011 +0100
Compress all ::style-updated prior to ::realize
This is done to avoid early emission of this signal, that was
causing warnings during GtkDialog construction.
gtk/gtkwidget.c | 16 ++++++++++++++--
1 files changed, 14 insertions(+), 2 deletions(-)
---
diff --git a/gtk/gtkwidget.c b/gtk/gtkwidget.c
index 1876597..c4851ee 100644
--- a/gtk/gtkwidget.c
+++ b/gtk/gtkwidget.c
@@ -312,7 +312,7 @@ struct _GtkWidgetPrivate
guint has_grab : 1;
guint shadowed : 1;
guint rc_style : 1;
- guint user_style : 1;
+ guint style_update_pending : 1;
guint app_paintable : 1;
guint double_buffered : 1;
guint redraw_on_alloc : 1;
@@ -4266,6 +4266,9 @@ gtk_widget_realize (GtkWidget *widget)
gtk_widget_ensure_style (widget);
+ if (priv->style_update_pending)
+ g_signal_emit (widget, widget_signals[STYLE_UPDATED], 0);
+
g_signal_emit (widget, widget_signals[REALIZE], 0);
gtk_widget_real_set_has_tooltip (widget,
@@ -13941,7 +13944,16 @@ style_context_changed (GtkStyleContext *context,
GtkWidget *widget = user_data;
gtk_widget_update_pango_context (widget);
- g_signal_emit (widget, widget_signals[STYLE_UPDATED], 0);
+
+ if (gtk_widget_get_realized (widget))
+ g_signal_emit (widget, widget_signals[STYLE_UPDATED], 0);
+ else
+ {
+ /* Compress all style updates so it
+ * is only emitted once pre-realize.
+ */
+ widget->priv->style_update_pending = TRUE;
+ }
if (widget->priv->anchored)
gtk_widget_queue_resize (widget);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]