diff options
Diffstat (limited to 'gtk/gtkhpaned.c')
-rw-r--r-- | gtk/gtkhpaned.c | 30 |
1 files changed, 21 insertions, 9 deletions
diff --git a/gtk/gtkhpaned.c b/gtk/gtkhpaned.c index 1eac179b85..e71935a4e1 100644 --- a/gtk/gtkhpaned.c +++ b/gtk/gtkhpaned.c @@ -96,6 +96,7 @@ gtk_hpaned_size_request (GtkWidget *widget, GtkRequisition *requisition) { GtkPaned *paned; + GtkRequisition child_requisition; g_return_if_fail (widget != NULL); g_return_if_fail (GTK_IS_HPANED (widget)); @@ -107,19 +108,18 @@ gtk_hpaned_size_request (GtkWidget *widget, if (paned->child1 && GTK_WIDGET_VISIBLE (paned->child1)) { - gtk_widget_size_request (paned->child1, &paned->child1->requisition); + gtk_widget_size_request (paned->child1, &child_requisition); - requisition->height = paned->child1->requisition.height; - requisition->width = paned->child1->requisition.width; + requisition->height = child_requisition.height; + requisition->width = child_requisition.width; } if (paned->child2 && GTK_WIDGET_VISIBLE (paned->child2)) { - gtk_widget_size_request (paned->child2, &paned->child2->requisition); + gtk_widget_size_request (paned->child2, &child_requisition); - requisition->height = MAX(requisition->height, - paned->child2->requisition.height); - requisition->width += paned->child2->requisition.width; + requisition->height = MAX(requisition->height, child_requisition.height); + requisition->width += child_requisition.width; } requisition->width += GTK_CONTAINER (paned)->border_width * 2 + paned->gutter_size; @@ -131,6 +131,8 @@ gtk_hpaned_size_allocate (GtkWidget *widget, GtkAllocation *allocation) { GtkPaned *paned; + GtkRequisition child1_requisition; + GtkRequisition child2_requisition; GtkAllocation child1_allocation; GtkAllocation child2_allocation; GdkRectangle old_groove_rectangle; @@ -145,12 +147,22 @@ gtk_hpaned_size_allocate (GtkWidget *widget, paned = GTK_PANED (widget); border_width = GTK_CONTAINER (paned)->border_width; + if (paned->child1) + gtk_widget_get_child_requisition (paned->child1, &child1_requisition); + else + child1_requisition.width = 0; + + if (paned->child2) + gtk_widget_get_child_requisition (paned->child2, &child2_requisition); + else + child2_requisition.width = 0; + gtk_paned_compute_position (paned, widget->allocation.width - paned->gutter_size - 2 * border_width, - paned->child1 ? paned->child1->requisition.width : 0, - paned->child2 ? paned->child2->requisition.width : 0); + child1_requisition.width, + child2_requisition.width); /* Move the handle before the children so we don't get extra expose events */ |