diff options
author | Matthias Clasen <mclasen@redhat.com> | 2010-10-29 21:13:55 -0400 |
---|---|---|
committer | Tristan Van Berkom <tristan.van.berkom@gmail.com> | 2010-10-30 17:37:03 +0900 |
commit | 0aa94bb9465f8ec7269366aaa029640a49891478 (patch) | |
tree | 5ca28ce8b06ea6a84bebc1cd29e4b64adc278cf5 /gtk/gtkstatusbar.c | |
parent | 6c301d4b0a09f618db0108ce38fdbf69cecc73d2 (diff) | |
download | gtk+-0aa94bb9465f8ec7269366aaa029640a49891478.tar.gz |
Fix initial size allocation with child widgets
On some cases, it would take a resize of the window for children
to 'jump into place'.
https://bugzilla.gnome.org/show_bug.cgi?id=633500
Diffstat (limited to 'gtk/gtkstatusbar.c')
-rw-r--r-- | gtk/gtkstatusbar.c | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/gtk/gtkstatusbar.c b/gtk/gtkstatusbar.c index 704b3b6940..cee0143617 100644 --- a/gtk/gtkstatusbar.c +++ b/gtk/gtkstatusbar.c @@ -106,6 +106,7 @@ static GObject *gtk_statusbar_buildable_get_internal_child (GtkBuildable *builda static void gtk_statusbar_update (GtkStatusbar *statusbar, guint context_id, const gchar *text); +static void gtk_statusbar_realize (GtkWidget *widget); static void gtk_statusbar_destroy (GtkWidget *widget); static void gtk_statusbar_size_allocate (GtkWidget *widget, GtkAllocation *allocation); @@ -128,6 +129,7 @@ gtk_statusbar_class_init (GtkStatusbarClass *class) gobject_class = (GObjectClass *) class; widget_class = (GtkWidgetClass *) class; + widget_class->realize = gtk_statusbar_realize; widget_class->destroy = gtk_statusbar_destroy; widget_class->size_allocate = gtk_statusbar_size_allocate; widget_class->hierarchy_changed = gtk_statusbar_hierarchy_changed; @@ -646,11 +648,11 @@ gtk_statusbar_size_allocate (GtkWidget *widget, GdkRectangle translated_rect; window = gtk_widget_get_toplevel (widget); + if (GTK_IS_WINDOW (window) && gtk_window_resize_grip_is_visible (GTK_WINDOW (window))) { gtk_window_get_resize_grip_area (GTK_WINDOW (window), &rect); - if (gtk_widget_translate_coordinates (gtk_widget_get_parent (widget), window, allocation->x, @@ -733,9 +735,9 @@ resize_grip_visible_changed (GObject *object, GtkStatusbar *statusbar = GTK_STATUSBAR (user_data); GtkStatusbarPrivate *priv = statusbar->priv; - gtk_widget_queue_resize (GTK_WIDGET (statusbar)); gtk_widget_queue_resize (priv->label); gtk_widget_queue_resize (priv->frame); + gtk_widget_queue_resize (GTK_WIDGET (statusbar)); } static void @@ -752,4 +754,14 @@ gtk_statusbar_hierarchy_changed (GtkWidget *widget, if (GTK_IS_WINDOW (window)) g_signal_connect (window, "notify::resize-grip-visible", G_CALLBACK (resize_grip_visible_changed), widget); + + resize_grip_visible_changed (NULL, NULL, widget); +} + +static void +gtk_statusbar_realize (GtkWidget *widget) +{ + GTK_WIDGET_CLASS (gtk_statusbar_parent_class)->realize (widget); + + resize_grip_visible_changed (NULL, NULL, widget); } |