Commit 4427760b authored by Javier Jardon's avatar Javier Jardon

Use GtkBin accessors

parent 2de1f3f8
......@@ -252,7 +252,7 @@ open_display_cb (GtkWidget *button,
gtk_container_add (GTK_CONTAINER (GTK_DIALOG (dialog)->vbox), display_entry);
gtk_widget_grab_focus (display_entry);
gtk_widget_show_all (GTK_BIN (dialog)->child);
gtk_widget_show_all (gtk_bin_get_child (GTK_BIN (dialog)));
while (!result)
{
......
......@@ -435,7 +435,7 @@ do_combobox (GtkWidget *do_widget)
entry = g_object_new (TYPE_MASK_ENTRY, NULL);
MASK_ENTRY (entry)->mask = "^([0-9]*|One|Two|2\302\275|Three)$";
gtk_container_remove (GTK_CONTAINER (combo), GTK_BIN (combo)->child);
gtk_container_remove (GTK_CONTAINER (combo), gtk_bin_get_child (GTK_BIN (combo)));
gtk_container_add (GTK_CONTAINER (combo), entry);
}
......
......@@ -279,13 +279,15 @@ create_combo_box_entry (void)
{
GtkWidget *widget;
GtkWidget *align;
GtkWidget *child;
gtk_rc_parse_string ("style \"combo-box-entry-style\" {\n"
" GtkComboBox::appears-as-list = 1\n"
"}\n"
"widget_class \"GtkComboBoxEntry\" style \"combo-box-entry-style\"\n" );
widget = gtk_combo_box_entry_new_text ();
gtk_entry_set_text (GTK_ENTRY (GTK_BIN (widget)->child), "Combo Box Entry");
child = gtk_bin_get_child (GTK_BIN (widget));
gtk_entry_set_text (GTK_ENTRY (child), "Combo Box Entry");
align = gtk_alignment_new (0.5, 0.5, 0.0, 0.0);
gtk_container_add (GTK_CONTAINER (align), widget);
......
......@@ -428,6 +428,8 @@ gtk_alignment_set (GtkAlignment *alignment,
gfloat xscale,
gfloat yscale)
{
GtkWidget *child;
g_return_if_fail (GTK_IS_ALIGNMENT (alignment));
xalign = CLAMP (xalign, 0.0, 1.0);
......@@ -463,8 +465,9 @@ gtk_alignment_set (GtkAlignment *alignment,
}
g_object_thaw_notify (G_OBJECT (alignment));
if (GTK_BIN (alignment)->child)
gtk_widget_queue_resize (GTK_BIN (alignment)->child);
child = gtk_bin_get_child (GTK_BIN (alignment));
if (child)
gtk_widget_queue_resize (child);
gtk_widget_queue_draw (GTK_WIDGET (alignment));
}
}
......@@ -477,6 +480,7 @@ gtk_alignment_size_allocate (GtkWidget *widget,
GtkAlignment *alignment;
GtkBin *bin;
GtkAllocation child_allocation;
GtkWidget *bin_child;
gint width, height;
guint border_width;
gint padding_horizontal, padding_vertical;
......@@ -488,10 +492,11 @@ gtk_alignment_size_allocate (GtkWidget *widget,
widget->allocation = *allocation;
alignment = GTK_ALIGNMENT (widget);
bin = GTK_BIN (widget);
if (bin->child && gtk_widget_get_visible (bin->child))
bin_child = gtk_bin_get_child (bin);
if (bin_child && gtk_widget_get_visible (bin_child))
{
GtkSizeRequest *child = GTK_SIZE_REQUEST (bin->child);
GtkSizeRequest *child = GTK_SIZE_REQUEST (bin_child);
gint child_nat_width;
gint child_nat_height;
gint child_width, child_height;
......@@ -547,7 +552,7 @@ gtk_alignment_size_allocate (GtkWidget *widget,
child_allocation.y = alignment->yalign * (height - child_allocation.height) + allocation->y + border_width + priv->padding_top;
gtk_widget_size_allocate (bin->child, &child_allocation);
gtk_widget_size_allocate (bin_child, &child_allocation);
}
}
......@@ -643,6 +648,7 @@ gtk_alignment_set_padding (GtkAlignment *alignment,
guint padding_right)
{
GtkAlignmentPrivate *priv;
GtkWidget *child;
g_return_if_fail (GTK_IS_ALIGNMENT (alignment));
......@@ -674,8 +680,9 @@ gtk_alignment_set_padding (GtkAlignment *alignment,
g_object_thaw_notify (G_OBJECT (alignment));
/* Make sure that the widget and children are redrawn with the new setting: */
if (GTK_BIN (alignment)->child)
gtk_widget_queue_resize (GTK_BIN (alignment)->child);
child = gtk_bin_get_child (GTK_BIN (alignment));
if (child)
gtk_widget_queue_resize (child);
gtk_widget_queue_draw (GTK_WIDGET (alignment));
}
......
......@@ -336,9 +336,11 @@ gtk_aspect_frame_compute_child_allocation (GtkFrame *frame,
GtkAspectFrame *aspect_frame = GTK_ASPECT_FRAME (frame);
GtkAspectFramePriv *priv = aspect_frame->priv;
GtkBin *bin = GTK_BIN (frame);
GtkWidget *child;
gdouble ratio;
if (bin->child && gtk_widget_get_visible (bin->child))
child = gtk_bin_get_child (bin);
if (child && gtk_widget_get_visible (child))
{
GtkAllocation full_allocation;
......@@ -346,7 +348,7 @@ gtk_aspect_frame_compute_child_allocation (GtkFrame *frame,
{
GtkRequisition child_requisition;
gtk_widget_get_child_requisition (bin->child, &child_requisition);
gtk_widget_get_child_requisition (child, &child_requisition);
if (child_requisition.height != 0)
{
ratio = ((gdouble) child_requisition.width /
......
......@@ -625,7 +625,7 @@ gtk_button_constructor (GType type,
static GType
gtk_button_child_type (GtkContainer *container)
{
if (!GTK_BIN (container)->child)
if (!gtk_bin_get_child (GTK_BIN (container)))
return GTK_TYPE_WIDGET;
else
return G_TYPE_NONE;
......@@ -798,6 +798,7 @@ static void
activatable_update_short_label (GtkButton *button,
GtkAction *action)
{
GtkWidget *child;
GtkWidget *image;
if (gtk_button_get_use_stock (button))
......@@ -806,9 +807,10 @@ activatable_update_short_label (GtkButton *button,
image = gtk_button_get_image (button);
/* Dont touch custom child... */
child = gtk_bin_get_child (GTK_BIN (button));
if (GTK_IS_IMAGE (image) ||
GTK_BIN (button)->child == NULL ||
GTK_IS_LABEL (GTK_BIN (button)->child))
child == NULL ||
GTK_IS_LABEL (child))
{
gtk_button_set_label (button, gtk_action_get_short_label (action));
gtk_button_set_use_underline (button, TRUE);
......@@ -975,6 +977,7 @@ gtk_button_construct_child (GtkButton *button)
{
GtkButtonPrivate *priv = GTK_BUTTON_GET_PRIVATE (button);
GtkStockItem item;
GtkWidget *child;
GtkWidget *label;
GtkWidget *box;
GtkWidget *align;
......@@ -1001,9 +1004,9 @@ gtk_button_construct_child (GtkButton *button)
priv->image = NULL;
if (GTK_BIN (button)->child)
gtk_container_remove (GTK_CONTAINER (button),
GTK_BIN (button)->child);
child = gtk_bin_get_child (GTK_BIN (button));
if (child)
gtk_container_remove (GTK_CONTAINER (button), child);
if (button->use_stock &&
button->label_text &&
......@@ -1353,10 +1356,10 @@ gtk_button_update_image_spacing (GtkButton *button)
if (!button->constructed || !priv->image)
return;
child = GTK_BIN (button)->child;
child = gtk_bin_get_child (GTK_BIN (button));
if (GTK_IS_ALIGNMENT (child))
{
child = GTK_BIN (child)->child;
child = gtk_bin_get_child (GTK_BIN (child));
if (GTK_IS_BOX (child))
{
gtk_widget_style_get (GTK_WIDGET (button),
......@@ -1434,6 +1437,7 @@ gtk_button_size_allocate (GtkWidget *widget,
{
GtkButton *button = GTK_BUTTON (widget);
GtkAllocation child_allocation;
GtkWidget *child;
guint border_width = gtk_container_get_border_width (GTK_CONTAINER (widget));
gint xthickness = GTK_WIDGET (widget)->style->xthickness;
......@@ -1459,7 +1463,8 @@ gtk_button_size_allocate (GtkWidget *widget,
widget->allocation.width - border_width * 2,
widget->allocation.height - border_width * 2);
if (GTK_BIN (button)->child && gtk_widget_get_visible (GTK_BIN (button)->child))
child = gtk_bin_get_child (GTK_BIN (button));
if (child && gtk_widget_get_visible (child))
{
child_allocation.x = widget->allocation.x + border_width + inner_border.left + xthickness;
child_allocation.y = widget->allocation.y + border_width + inner_border.top + ythickness;
......@@ -1504,7 +1509,7 @@ gtk_button_size_allocate (GtkWidget *widget,
child_allocation.y += child_displacement_y;
}
gtk_widget_size_allocate (GTK_BIN (button)->child, &child_allocation);
gtk_widget_size_allocate (child, &child_allocation);
}
}
......@@ -2166,7 +2171,7 @@ gtk_button_set_alignment (GtkButton *button,
priv->yalign = yalign;
priv->align_set = 1;
maybe_set_alignment (button, GTK_BIN (button)->child);
maybe_set_alignment (button, gtk_bin_get_child (GTK_BIN (button)));
g_object_freeze_notify (G_OBJECT (button));
g_object_notify (G_OBJECT (button), "xalign");
......
......@@ -458,7 +458,7 @@ gtk_cell_renderer_combo_start_editing (GtkCellRenderer *cell,
g_object_get (cell_text, "text", &text, NULL);
if (text)
gtk_entry_set_text (GTK_ENTRY (GTK_BIN (combo)->child),
gtk_entry_set_text (GTK_ENTRY (gtk_bin_get_child (GTK_BIN (combo))),
text);
g_free (text);
}
......
......@@ -150,7 +150,7 @@ gtk_check_button_paint (GtkWidget *widget,
border_width = gtk_container_get_border_width (GTK_CONTAINER (widget));
if (gtk_widget_has_focus (widget))
{
GtkWidget *child = GTK_BIN (widget)->child;
GtkWidget *child = gtk_bin_get_child (GTK_BIN (widget));
if (interior_focus && child && gtk_widget_get_visible (child))
gtk_paint_focus (widget->style, widget->window, gtk_widget_get_state (widget),
......@@ -213,7 +213,7 @@ gtk_check_button_size_request (GtkWidget *widget,
_gtk_check_button_get_props (GTK_CHECK_BUTTON (widget),
&indicator_size, &indicator_spacing);
child = GTK_BIN (widget)->child;
child = gtk_bin_get_child (GTK_BIN (widget));
if (child && gtk_widget_get_visible (child))
{
GtkRequisition child_requisition;
......@@ -248,6 +248,7 @@ gtk_check_button_size_allocate (GtkWidget *widget,
if (toggle_button->draw_indicator)
{
GtkWidget *child;
gint indicator_size;
gint indicator_spacing;
gint focus_width;
......@@ -264,13 +265,14 @@ gtk_check_button_size_allocate (GtkWidget *widget,
gdk_window_move_resize (button->event_window,
allocation->x, allocation->y,
allocation->width, allocation->height);
if (GTK_BIN (button)->child && gtk_widget_get_visible (GTK_BIN (button)->child))
child = gtk_bin_get_child (GTK_BIN (button));
if (child && gtk_widget_get_visible (child))
{
GtkRequisition child_requisition;
guint border_width = gtk_container_get_border_width (GTK_CONTAINER (widget));
gtk_widget_get_child_requisition (GTK_BIN (button)->child, &child_requisition);
gtk_widget_get_child_requisition (child, &child_requisition);
child_allocation.width = MIN (child_requisition.width,
allocation->width -
......@@ -291,7 +293,7 @@ gtk_check_button_size_allocate (GtkWidget *widget,
child_allocation.x = allocation->x + allocation->width
- (child_allocation.x - allocation->x + child_allocation.width);
gtk_widget_size_allocate (GTK_BIN (button)->child, &child_allocation);
gtk_widget_size_allocate (child, &child_allocation);
}
}
else
......@@ -304,6 +306,7 @@ gtk_check_button_expose (GtkWidget *widget,
{
GtkToggleButton *toggle_button;
GtkBin *bin;
GtkWidget *child;
toggle_button = GTK_TOGGLE_BUTTON (widget);
bin = GTK_BIN (widget);
......@@ -313,10 +316,11 @@ gtk_check_button_expose (GtkWidget *widget,
if (toggle_button->draw_indicator)
{
gtk_check_button_paint (widget, &event->area);
if (bin->child)
child = gtk_bin_get_child (bin);
if (child)
gtk_container_propagate_expose (GTK_CONTAINER (widget),
bin->child,
child,
event);
}
else if (GTK_WIDGET_CLASS (gtk_check_button_parent_class)->expose_event)
......@@ -379,7 +383,7 @@ gtk_real_check_button_draw_indicator (GtkCheckButton *check_button,
x = widget->allocation.x + indicator_spacing + border_width;
y = widget->allocation.y + (widget->allocation.height - indicator_size) / 2;
child = GTK_BIN (check_button)->child;
child = gtk_bin_get_child (GTK_BIN (check_button));
if (!interior_focus || !(child && gtk_widget_get_visible (child)))
x += focus_width + focus_pad;
......
This diff is collapsed.
......@@ -226,7 +226,10 @@ static void
gtk_combo_box_entry_remove (GtkContainer *container,
GtkWidget *child)
{
if (child && child == GTK_BIN (container)->child)
GtkWidget *child_widget;
child_widget = gtk_bin_get_child (GTK_BIN (container));
if (child && child == child_widget)
{
g_signal_handlers_disconnect_by_func (child,
gtk_combo_box_entry_contents_changed,
......@@ -248,7 +251,7 @@ gtk_combo_box_entry_active_changed (GtkComboBox *combo_box,
if (gtk_combo_box_get_active_iter (combo_box, &iter))
{
GtkEntry *entry = GTK_ENTRY (GTK_BIN (combo_box)->child);
GtkEntry *entry = GTK_ENTRY (gtk_bin_get_child (GTK_BIN (combo_box)));
if (entry)
{
......@@ -276,13 +279,16 @@ has_frame_changed (GtkComboBoxEntry *entry_box,
GParamSpec *pspec,
gpointer data)
{
if (GTK_BIN (entry_box)->child)
GtkWidget *child;
child = gtk_bin_get_child (GTK_BIN (entry_box));
if (child)
{
gboolean has_frame;
g_object_get (entry_box, "has-frame", &has_frame, NULL);
gtk_entry_set_has_frame (GTK_ENTRY (GTK_BIN (entry_box)->child), has_frame);
gtk_entry_set_has_frame (GTK_ENTRY (child), has_frame);
}
}
......@@ -405,9 +411,11 @@ gtk_combo_box_entry_mnemonic_activate (GtkWidget *widget,
gboolean group_cycling)
{
GtkBin *entry_box = GTK_BIN (widget);
GtkWidget* child;
if (entry_box->child)
gtk_widget_grab_focus (entry_box->child);
child = gtk_bin_get_child (entry_box);
if (child)
gtk_widget_grab_focus (child);
return TRUE;
}
......@@ -416,9 +424,11 @@ static void
gtk_combo_box_entry_grab_focus (GtkWidget *widget)
{
GtkBin *entry_box = GTK_BIN (widget);
GtkWidget *child;
if (entry_box->child)
gtk_widget_grab_focus (entry_box->child);
child = gtk_bin_get_child (entry_box);
if (child)
gtk_widget_grab_focus (child);
}
......@@ -456,9 +466,11 @@ static gchar *
gtk_combo_box_entry_get_active_text (GtkComboBox *combo_box)
{
GtkBin *combo = GTK_BIN (combo_box);
GtkWidget *child;
if (combo->child)
return g_strdup (gtk_entry_get_text (GTK_ENTRY (combo->child)));
child = gtk_bin_get_child (combo);
if (child)
return g_strdup (gtk_entry_get_text (GTK_ENTRY (child)));
return NULL;
}
......@@ -484,16 +484,18 @@ gtk_event_box_size_request (GtkWidget *widget,
{
GtkBin *bin = GTK_BIN (widget);
guint border_width;
GtkWidget *child;
border_width = gtk_container_get_border_width (GTK_CONTAINER (widget));
requisition->width = border_width * 2;
requisition->height = border_width * 2;
if (bin->child && gtk_widget_get_visible (bin->child))
child = gtk_bin_get_child (bin);
if (child && gtk_widget_get_visible (child))
{
GtkRequisition child_requisition;
gtk_widget_size_request (bin->child, &child_requisition);
gtk_widget_size_request (child, &child_requisition);
requisition->width += child_requisition.width;
requisition->height += child_requisition.height;
......@@ -508,7 +510,8 @@ gtk_event_box_size_allocate (GtkWidget *widget,
GtkAllocation child_allocation;
GtkEventBoxPrivate *priv;
guint border_width;
GtkWidget *child;
widget->allocation = *allocation;
bin = GTK_BIN (widget);
border_width = gtk_container_get_border_width (GTK_CONTAINER (widget));
......@@ -544,9 +547,10 @@ gtk_event_box_size_allocate (GtkWidget *widget,
child_allocation.width,
child_allocation.height);
}
if (bin->child)
gtk_widget_size_allocate (bin->child, &child_allocation);
child = gtk_bin_get_child (bin);
if (child)
gtk_widget_size_allocate (child, &child_allocation);
}
static void
......
......@@ -464,6 +464,7 @@ gtk_expander_size_request (GtkWidget *widget,
GtkExpander *expander;
GtkBin *bin;
GtkExpanderPrivate *priv;
GtkWidget *child;
gint border_width;
gint expander_size;
gint expander_spacing;
......@@ -504,11 +505,12 @@ gtk_expander_size_request (GtkWidget *widget,
if (!interior_focus)
requisition->height += 2 * focus_width + 2 * focus_pad;
if (bin->child && GTK_WIDGET_CHILD_VISIBLE (bin->child))
child = gtk_bin_get_child (bin);
if (child && GTK_WIDGET_CHILD_VISIBLE (child))
{
GtkRequisition child_requisition;
gtk_widget_size_request (bin->child, &child_requisition);
gtk_widget_size_request (child, &child_requisition);
requisition->width = MAX (requisition->width, child_requisition.width);
requisition->height += child_requisition.height + priv->spacing;
......@@ -592,6 +594,7 @@ gtk_expander_size_allocate (GtkWidget *widget,
GtkBin *bin;
GtkExpanderPrivate *priv;
GtkRequisition child_requisition;
GtkWidget *child;
gboolean child_visible = FALSE;
guint border_width;
gint expander_size;
......@@ -617,10 +620,12 @@ gtk_expander_size_allocate (GtkWidget *widget,
child_requisition.width = 0;
child_requisition.height = 0;
if (bin->child && GTK_WIDGET_CHILD_VISIBLE (bin->child))
child = gtk_bin_get_child (bin);
if (child && GTK_WIDGET_CHILD_VISIBLE (child))
{
child_visible = TRUE;
gtk_widget_get_child_requisition (bin->child, &child_requisition);
gtk_widget_get_child_requisition (child, &child_requisition);
}
widget->allocation = *allocation;
......@@ -703,7 +708,7 @@ gtk_expander_size_allocate (GtkWidget *widget,
(!interior_focus ? 2 * focus_width + 2 * focus_pad : 0);
child_allocation.height = MAX (child_allocation.height, 1);
gtk_widget_size_allocate (bin->child, &child_allocation);
gtk_widget_size_allocate (child, &child_allocation);
}
}
......@@ -1257,9 +1262,11 @@ gtk_expander_forall (GtkContainer *container,
{
GtkBin *bin = GTK_BIN (container);
GtkExpanderPrivate *priv = GTK_EXPANDER (container)->priv;
GtkWidget *child;
if (bin->child)
(* callback) (bin->child, callback_data);
child = gtk_bin_get_child (bin);
if (child)
(* callback) (child, callback_data);
if (priv->label_widget)
(* callback) (priv->label_widget, callback_data);
......@@ -1316,6 +1323,7 @@ static gboolean
gtk_expander_animation_timeout (GtkExpander *expander)
{
GtkExpanderPrivate *priv = expander->priv;
GtkWidget *child;
GdkRectangle area;
gboolean finish = FALSE;
......@@ -1353,8 +1361,10 @@ gtk_expander_animation_timeout (GtkExpander *expander)
if (finish)
{
priv->animation_timeout = 0;
if (GTK_BIN (expander)->child)
gtk_widget_set_child_visible (GTK_BIN (expander)->child, priv->expanded);
child = gtk_bin_get_child (GTK_BIN (expander));
if (child)
gtk_widget_set_child_visible (child, priv->expanded);
gtk_widget_queue_resize (GTK_WIDGET (expander));
}
......@@ -1391,6 +1401,7 @@ gtk_expander_set_expanded (GtkExpander *expander,
gboolean expanded)
{
GtkExpanderPrivate *priv;
GtkWidget *child;
g_return_if_fail (GTK_IS_EXPANDER (expander));
......@@ -1416,9 +1427,10 @@ gtk_expander_set_expanded (GtkExpander *expander,
priv->expander_style = expanded ? GTK_EXPANDER_EXPANDED :
GTK_EXPANDER_COLLAPSED;
if (GTK_BIN (expander)->child)
child = gtk_bin_get_child (GTK_BIN (expander));
if (child)
{
gtk_widget_set_child_visible (GTK_BIN (expander)->child, priv->expanded);
gtk_widget_set_child_visible (child, priv->expanded);
gtk_widget_queue_resize (GTK_WIDGET (expander));
}
}
......
......@@ -302,9 +302,11 @@ gtk_frame_forall (GtkContainer *container,
{
GtkBin *bin = GTK_BIN (container);
GtkFrame *frame = GTK_FRAME (container);
GtkWidget *child;
if (bin->child)
(* callback) (bin->child, callback_data);
child = gtk_bin_get_child (bin);
if (child)
(* callback) (child, callback_data);
if (frame->label_widget)
(* callback) (frame->label_widget, callback_data);
......@@ -615,6 +617,7 @@ gtk_frame_size_allocate (GtkWidget *widget,
GtkFrame *frame = GTK_FRAME (widget);
GtkBin *bin = GTK_BIN (widget);
GtkAllocation new_allocation;
GtkWidget *child;
widget->allocation = *allocation;
......@@ -633,9 +636,10 @@ gtk_frame_size_allocate (GtkWidget *widget,
#endif
)
gdk_window_invalidate_rect (widget->window, &widget->allocation, FALSE);
if (bin->child && gtk_widget_get_visible (bin->child))
gtk_widget_size_allocate (bin->child, &new_allocation);
child = gtk_bin_get_child (bin);
if (child && gtk_widget_get_visible (child))
gtk_widget_size_allocate (child, &new_allocation);
frame->child_allocation = new_allocation;
......@@ -712,6 +716,7 @@ gtk_frame_get_size (GtkSizeRequest *request,
gint *natural_size)
{
GtkWidget *widget = GTK_WIDGET (request);
GtkWidget *child;
GtkFrame *frame = GTK_FRAME (widget);
GtkBin *bin = GTK_BIN (widget);
gint child_min, child_nat;
......@@ -741,18 +746,19 @@ gtk_frame_get_size (GtkSizeRequest *request,
natural = 0;
}
if (bin->child && gtk_widget_get_visible (bin->child))
child = gtk_bin_get_child (bin);
if (child && gtk_widget_get_visible (child))
{
if (orientation == GTK_ORIENTATION_HORIZONTAL)
{
gtk_size_request_get_width (GTK_SIZE_REQUEST (bin->child),
gtk_size_request_get_width (GTK_SIZE_REQUEST (child),
&child_min, &child_nat);
minimum = MAX (minimum, child_min);
natural = MAX (natural, child_nat);
}
else
{
gtk_size_request_get_height (GTK_SIZE_REQUEST (bin->child),
gtk_size_request_get_height (GTK_SIZE_REQUEST (child),
&child_min, &child_nat);
minimum += child_min;
natural += child_nat;
......
......@@ -348,16 +348,17 @@ gtk_handle_box_map (GtkWidget *widget)
{
GtkBin *bin;
GtkHandleBox *hb;
GtkWidget *child;
gtk_widget_set_mapped (widget, TRUE);
bin = GTK_BIN (widget);
hb = GTK_HANDLE_BOX (widget);
if (bin->child &&
gtk_widget_get_visible (bin->child) &&
!gtk_widget_get_mapped (bin->child))
gtk_widget_map (bin->child);
child = gtk_bin_get_child (bin);
if (gtk_widget_get_visible (child) &&
!gtk_widget_get_mapped (child))
gtk_widget_map (child);
if (hb->child_detached && !hb->float_window_mapped)
{
......@@ -389,9 +390,10 @@ gtk_handle_box_unmap (GtkWidget *widget)
static void
gtk_handle_box_realize (GtkWidget *widget)
{
GtkHandleBox *hb;
GtkWidget *child;
GdkWindowAttr attributes;
gint attributes_mask;
GtkHandleBox *hb;
hb = GTK_HANDLE_BOX (widget);
......@@ -425,8 +427,10 @@ gtk_handle_box_realize (GtkWidget *widget)
attributes_mask = GDK_WA_X | GDK_WA_Y | GDK_WA_VISUAL | GDK_WA_COLORMAP;
hb->bin_window = gdk_window_new (widget->window, &attributes, attributes_mask);
gdk_window_set_user_data (hb->bin_window, widget);
if (GTK_BIN (hb)->child)
gtk_widget_set_parent_window (GTK_BIN (hb)->child, hb->bin_window);
child = gtk_bin_get_child (GTK_BIN (hb));
if (child)
gtk_widget_set_parent_window (child, hb->bin_window);
attributes.x = 0;
attributes.y = 0;
......@@ -521,6 +525,7 @@ gtk_handle_box_size_request (GtkWidget *widget,
GtkBin *bin;
GtkHandleBox *hb;
GtkRequisition child_requisition;
GtkWidget *child;
gint handle_position;
bin = GTK_BIN (widget);
......@@ -540,11 +545,12 @@ gtk_handle_box_size_request (GtkWidget *widget,
requisition->height = DRAG_HANDLE_SIZE;
}
child = gtk_bin_get_child (bin);
/* if our child is not visible, we still request its size, since we
* won't have any useful hint for our size otherwise.
*/
if (bin->child)
gtk_widget_size_request (bin->child, &child_requisition);
if (child)
gtk_widget_size_request (child, &child_requisition);
else
{
child_requisition.width = 0;
......@@ -579,7 +585,7 @@ gtk_handle_box_size_request (GtkWidget *widget,
requisition->width += border_width * 2;
requisition->height += border_width * 2;
if (bin->child)
if (child)
{
requisition->width += child_requisition.width;
requisition->height += child_requisition.height;
......@@ -599,6 +605,7 @@ gtk_handle_box_size_allocate (GtkWidget *widget,
GtkBin *bin;
GtkHandleBox *hb;
GtkRequisition child_requisition;
GtkWidget *child;
gint handle_position;
bin = GTK_BIN (widget);
......@@ -606,8 +613,10 @@ gtk_handle_box_size_allocate (GtkWidget *widget,
handle_position = effective_handle_position (hb);
if (bin->child)
gtk_widget_get_child_requisition (bin->child, &child_requisition);
child = gtk_bin_get_child (bin);
if (child)
gtk_widget_get_child_requisition (child, &child_requisition);
else
{
child_requisition.width = 0;
......@@ -624,7 +633,7 @@ gtk_handle_box_size_allocate (GtkWidget *widget,
widget->allocation.height);
if (bin->child && gtk_widget_get_visible (bin->child))
if (gtk_widget_get_visible (child))
{
GtkAllocation child_allocation;
guint border_width;
......@@ -686,7 +695,7 @@ gtk_handle_box_size_allocate (GtkWidget *widget,
widget->allocation.height);
}
gtk_widget_size_allocate (bin->child, &child_allocation);
gtk_widget_size_allocate (child, &child_allocation);
}
}