Commit 32cd050c authored by Owen Taylor's avatar Owen Taylor Committed by Owen Taylor

More extensive debugging output

Fri Apr  3 17:14:55 1998  Owen Taylor  <owt1@cornell.edu>

	* gdk/gdk.c: More extensive debugging output

	* gtk/gtkalignment.c gtk/gtkbutton.c gtk/gtkcheckbutton.c
	  gtk/gtkclist.c gtk/gtkeventbox.c gtk/gtkhandlebox.c
	  gtk/gtk[hv]box.c gtk/gtk[hv]paned.c gtk/gtklist.c
	  gtk/gtkmenu.c gtk/gtkmenubar.c gtk/gtkmenuitem.c
	  gtk/gtknotebook.c gtk/gtktable.c gtk/gtktree.c
	  gtk/gtktreeitem.c gtk/gtkviewport.c

	Avoid assigning negative values to unsigned allocation.width and
	height

	* gtk/gtkwindow.c:

	Instead of realizing the widget, then size allocating, (resulting
	in XMoveResizeWindows for all children, do the size allocation
	first, then realize.

	In gtk_real_window_move_resize, combine move and resize
	into a single GDK/X call when possible.

	* gtk/gtkclist.c gtk/gtkdrawingarea.c:

	Remove assumption that the widget will be size allocated _after_
	it is realized.

	* gtk/gtklist.c (gtk_list_motion_notify): Removed useless
	debugging message.
parent 740b70ea
......@@ -169,8 +169,8 @@ gtk_alignment_size_allocate (GtkWidget *widget,
{
x = GTK_CONTAINER (alignment)->border_width;
y = GTK_CONTAINER (alignment)->border_width;
width = allocation->width - 2 * x;
height = allocation->height - 2 * y;
width = MAX (allocation->width - 2 * x, 0);
height = MAX (allocation->height - 2 * y, 0);
if (width > bin->child->requisition.width)
child_allocation.width = (bin->child->requisition.width *
......
......@@ -421,10 +421,10 @@ gtk_button_size_allocate (GtkWidget *widget,
child_allocation.x = (CHILD_SPACING + GTK_WIDGET (widget)->style->klass->xthickness);
child_allocation.y = (CHILD_SPACING + GTK_WIDGET (widget)->style->klass->ythickness);
child_allocation.width = widget->allocation.width - child_allocation.x * 2 -
border_width * 2;
child_allocation.height = widget->allocation.height - child_allocation.y * 2 -
border_width * 2;
child_allocation.width = MAX (0, widget->allocation.width - child_allocation.x * 2 -
border_width * 2);
child_allocation.height = MAX (0, widget->allocation.height - child_allocation.y * 2 -
border_width * 2);
if (GTK_WIDGET_CAN_DEFAULT (button))
{
......@@ -432,10 +432,10 @@ gtk_button_size_allocate (GtkWidget *widget,
DEFAULT_LEFT_POS);
child_allocation.y += (GTK_WIDGET (widget)->style->klass->ythickness +
DEFAULT_TOP_POS);
child_allocation.width -= (GTK_WIDGET (widget)->style->klass->xthickness * 2 +
DEFAULT_SPACING);
child_allocation.height -= (GTK_WIDGET (widget)->style->klass->xthickness * 2 +
DEFAULT_SPACING);
child_allocation.width = MAX (0, child_allocation.width -
(GTK_WIDGET (widget)->style->klass->xthickness * 2 + DEFAULT_SPACING));
child_allocation.height = MAX (0, child_allocation.height -
(GTK_WIDGET (widget)->style->klass->xthickness * 2 + DEFAULT_SPACING));
}
gtk_widget_size_allocate (button->child, &child_allocation);
......
......@@ -249,9 +249,9 @@ gtk_check_button_size_allocate (GtkWidget *widget,
CHECK_BUTTON_CLASS (widget)->indicator_size +
CHECK_BUTTON_CLASS (widget)->indicator_spacing * 3 + 1);
child_allocation.y = GTK_CONTAINER (widget)->border_width + 1;
child_allocation.width = (allocation->width - child_allocation.x -
child_allocation.width = MAX (0, allocation->width - child_allocation.x -
GTK_CONTAINER (widget)->border_width - 1);
child_allocation.height = allocation->height - child_allocation.y * 2;
child_allocation.height = MAX (0, allocation->height - child_allocation.y * 2);
gtk_widget_size_allocate (button->child, &child_allocation);
}
......
......@@ -418,12 +418,12 @@ gtk_clist_init (GtkCList * clist)
clist->title_window = NULL;
clist->column_title_area.x = 0;
clist->column_title_area.y = 0;
clist->column_title_area.width = 0;
clist->column_title_area.height = 0;
clist->column_title_area.width = 1;
clist->column_title_area.height = 1;
clist->clist_window = NULL;
clist->clist_window_width = 0;
clist->clist_window_height = 0;
clist->clist_window_width = 1;
clist->clist_window_height = 1;
clist->hoffset = 0;
clist->voffset = 0;
......@@ -1765,6 +1765,12 @@ gtk_clist_realize (GtkWidget * widget)
gtk_style_set_background (widget->style, widget->window, GTK_STATE_NORMAL);
/* column-title window */
attributes.x = clist->column_title_area.x;
attributes.y = clist->column_title_area.y;
attributes.width = clist->column_title_area.width;
attributes.height = clist->column_title_area.height;
clist->title_window = gdk_window_new (widget->window, &attributes, attributes_mask);
gdk_window_set_user_data (clist->title_window, clist);
......@@ -1777,6 +1783,12 @@ gtk_clist_realize (GtkWidget * widget)
gtk_widget_set_parent_window (clist->column[i].button, clist->title_window);
/* clist-window */
attributes.x = clist->internal_allocation.x + widget->style->klass->xthickness;
attributes.y = clist->internal_allocation.y + widget->style->klass->ythickness +
clist->column_title_area.height;
attributes.width = clist->internal_allocation.width;
attributes.height = clist->internal_allocation.height;
clist->clist_window = gdk_window_new (widget->window, &attributes, attributes_mask);
gdk_window_set_user_data (clist->clist_window, clist);
......@@ -1798,9 +1810,13 @@ gtk_clist_realize (GtkWidget * widget)
{
clist->column[i].window = gdk_window_new (clist->title_window, &attributes, attributes_mask);
gdk_window_set_user_data (clist->column[i].window, clist);
gdk_window_show (clist->column[i].window);
}
/* This is slightly less efficient than creating them with the
* right size to begin with, but easier
*/
size_allocate_title_buttons (clist);
/* GCs */
clist->fg_gc = gdk_gc_new (widget->window);
clist->bg_gc = gdk_gc_new (widget->window);
......@@ -2219,133 +2235,144 @@ gtk_clist_size_allocate (GtkWidget * widget,
allocation->y + GTK_CONTAINER (widget)->border_width,
allocation->width - GTK_CONTAINER (widget)->border_width * 2,
allocation->height - GTK_CONTAINER (widget)->border_width * 2);
}
/* use internal allocation structure for all the math
* because it's easier than always subtracting the container
* border width */
clist->internal_allocation.x = 0;
clist->internal_allocation.y = 0;
clist->internal_allocation.width = allocation->width -
GTK_CONTAINER (widget)->border_width * 2;
clist->internal_allocation.height = allocation->height -
GTK_CONTAINER (widget)->border_width * 2;
/* use internal allocation structure for all the math
* because it's easier than always subtracting the container
* border width */
clist->internal_allocation.x = 0;
clist->internal_allocation.y = 0;
clist->internal_allocation.width = MAX (0, allocation->width -
GTK_CONTAINER (widget)->border_width * 2);
clist->internal_allocation.height = MAX (0, allocation->height -
GTK_CONTAINER (widget)->border_width * 2);
/* allocate clist window assuming no scrollbars */
clist_allocation.x = clist->internal_allocation.x + widget->style->klass->xthickness;
clist_allocation.y = clist->internal_allocation.y + widget->style->klass->ythickness +
clist->column_title_area.height;
clist_allocation.width = clist->internal_allocation.width -
(2 * widget->style->klass->xthickness);
clist_allocation.height = clist->internal_allocation.height -
(2 * widget->style->klass->ythickness) -
clist->column_title_area.height;
/*
* here's where we decide to show/not show the scrollbars
*/
vscrollbar_vis = 0;
hscrollbar_vis = 0;
for (i = 0; i <= 1; i++)
/* allocate clist window assuming no scrollbars */
clist_allocation.x = clist->internal_allocation.x + widget->style->klass->xthickness;
clist_allocation.y = clist->internal_allocation.y + widget->style->klass->ythickness +
clist->column_title_area.height;
clist_allocation.width = MAX (0, clist->internal_allocation.width -
(2 * widget->style->klass->xthickness));
clist_allocation.height = MAX (0, clist->internal_allocation.height -
(2 * widget->style->klass->ythickness) -
clist->column_title_area.height);
/*
* here's where we decide to show/not show the scrollbars
*/
vscrollbar_vis = 0;
hscrollbar_vis = 0;
for (i = 0; i <= 1; i++)
{
if (LIST_HEIGHT (clist) <= clist_allocation.height &&
clist->vscrollbar_policy == GTK_POLICY_AUTOMATIC)
{
if (LIST_HEIGHT (clist) <= clist_allocation.height &&
clist->vscrollbar_policy == GTK_POLICY_AUTOMATIC)
{
vscrollbar_vis = 0;
}
else
{
if (!vscrollbar_vis)
{
vscrollbar_vis = 1;
clist_allocation.width -= clist->vscrollbar->requisition.width +
SCROLLBAR_SPACING (clist);
}
}
if (LIST_WIDTH (clist) <= clist_allocation.width &&
clist->hscrollbar_policy == GTK_POLICY_AUTOMATIC)
vscrollbar_vis = 0;
}
else
{
if (!vscrollbar_vis)
{
hscrollbar_vis = 0;
}
else
vscrollbar_vis = 1;
clist_allocation.width = MAX (0,
clist_allocation.width - clist->vscrollbar->requisition.width +
SCROLLBAR_SPACING (clist));
}
}
if (LIST_WIDTH (clist) <= clist_allocation.width &&
clist->hscrollbar_policy == GTK_POLICY_AUTOMATIC)
{
hscrollbar_vis = 0;
}
else
{
if (!hscrollbar_vis)
{
if (!hscrollbar_vis)
{
hscrollbar_vis = 1;
clist_allocation.height -= clist->hscrollbar->requisition.height +
SCROLLBAR_SPACING (clist);
}
}
hscrollbar_vis = 1;
clist_allocation.height = MAX (0,
clist_allocation.height - clist->hscrollbar->requisition.height +
SCROLLBAR_SPACING (clist));
}
}
clist->clist_window_width = clist_allocation.width;
clist->clist_window_height = clist_allocation.height;
}
clist->clist_window_width = clist_allocation.width;
clist->clist_window_height = clist_allocation.height;
if (GTK_WIDGET_REALIZED (widget))
{
gdk_window_move_resize (clist->clist_window,
clist_allocation.x,
clist_allocation.y,
clist_allocation.width,
clist_allocation.height);
/* position the window which holds the column title buttons */
clist->column_title_area.x = widget->style->klass->xthickness;
clist->column_title_area.y = widget->style->klass->ythickness;
clist->column_title_area.width = clist_allocation.width;
}
/* position the window which holds the column title buttons */
clist->column_title_area.x = widget->style->klass->xthickness;
clist->column_title_area.y = widget->style->klass->ythickness;
clist->column_title_area.width = clist_allocation.width;
if (GTK_WIDGET_REALIZED (widget))
{
gdk_window_move_resize (clist->title_window,
clist->column_title_area.x,
clist->column_title_area.y,
clist->column_title_area.width,
clist->column_title_area.height);
}
/* column button allocation */
size_allocate_columns (clist);
/* column button allocation */
size_allocate_columns (clist);
size_allocate_title_buttons (clist);
adjust_scrollbars (clist);
/* allocate the vscrollbar */
if (vscrollbar_vis)
{
if (!GTK_WIDGET_VISIBLE (clist->vscrollbar))
gtk_widget_show (clist->vscrollbar);
child_allocation.x = clist->internal_allocation.x +
clist->internal_allocation.width -
clist->vscrollbar->requisition.width;
child_allocation.y = clist->internal_allocation.y;
child_allocation.width = clist->vscrollbar->requisition.width;
child_allocation.height = clist->internal_allocation.height -
(hscrollbar_vis ? (clist->hscrollbar->requisition.height + SCROLLBAR_SPACING (clist)) : 0);
gtk_widget_size_allocate (clist->vscrollbar, &child_allocation);
}
else
{
if (GTK_WIDGET_VISIBLE (clist->vscrollbar))
gtk_widget_hide (clist->vscrollbar);
}
if (GTK_WIDGET_REALIZED (widget))
size_allocate_title_buttons (clist);
if (hscrollbar_vis)
{
if (!GTK_WIDGET_VISIBLE (clist->hscrollbar))
gtk_widget_show (clist->hscrollbar);
adjust_scrollbars (clist);
/* allocate the vscrollbar */
if (vscrollbar_vis)
{
if (!GTK_WIDGET_VISIBLE (clist->vscrollbar))
gtk_widget_show (clist->vscrollbar);
child_allocation.x = clist->internal_allocation.x;
child_allocation.y = clist->internal_allocation.y +
clist->internal_allocation.height -
clist->hscrollbar->requisition.height;
child_allocation.width = clist->internal_allocation.width -
(vscrollbar_vis ? (clist->vscrollbar->requisition.width + SCROLLBAR_SPACING (clist)) : 0);
child_allocation.height = clist->hscrollbar->requisition.height;
gtk_widget_size_allocate (clist->hscrollbar, &child_allocation);
}
else
{
if (GTK_WIDGET_VISIBLE (clist->hscrollbar))
gtk_widget_hide (clist->hscrollbar);
}
child_allocation.x = clist->internal_allocation.x +
clist->internal_allocation.width -
clist->vscrollbar->requisition.width;
child_allocation.y = clist->internal_allocation.y;
child_allocation.width = clist->vscrollbar->requisition.width;
child_allocation.height = MAX (0, clist->internal_allocation.height -
(hscrollbar_vis ? (clist->hscrollbar->requisition.height + SCROLLBAR_SPACING (clist)) : 0));
gtk_widget_size_allocate (clist->vscrollbar, &child_allocation);
}
else
{
if (GTK_WIDGET_VISIBLE (clist->vscrollbar))
gtk_widget_hide (clist->vscrollbar);
}
if (hscrollbar_vis)
{
if (!GTK_WIDGET_VISIBLE (clist->hscrollbar))
gtk_widget_show (clist->hscrollbar);
child_allocation.x = clist->internal_allocation.x;
child_allocation.y = clist->internal_allocation.y +
clist->internal_allocation.height -
clist->hscrollbar->requisition.height;
child_allocation.width = MAX (0, clist->internal_allocation.width -
(vscrollbar_vis ? (clist->vscrollbar->requisition.width + SCROLLBAR_SPACING (clist)) : 0));
child_allocation.height = clist->hscrollbar->requisition.height;
gtk_widget_size_allocate (clist->hscrollbar, &child_allocation);
}
else
{
if (GTK_WIDGET_VISIBLE (clist->hscrollbar))
gtk_widget_hide (clist->hscrollbar);
}
/* set the vscrollbar adjustments */
......
......@@ -23,6 +23,7 @@ static void gtk_drawing_area_init (GtkDrawingArea *darea);
static void gtk_drawing_area_realize (GtkWidget *widget);
static void gtk_drawing_area_size_allocate (GtkWidget *widget,
GtkAllocation *allocation);
static void gtk_drawing_area_send_configure (GtkDrawingArea *darea);
guint
......@@ -117,14 +118,14 @@ gtk_drawing_area_realize (GtkWidget *widget)
widget->style = gtk_style_attach (widget->style, widget->window);
gtk_style_set_background (widget->style, widget->window, GTK_STATE_NORMAL);
gtk_drawing_area_send_configure (GTK_DRAWING_AREA (widget));
}
static void
gtk_drawing_area_size_allocate (GtkWidget *widget,
GtkAllocation *allocation)
{
GdkEventConfigure event;
g_return_if_fail (widget != NULL);
g_return_if_fail (GTK_IS_DRAWING_AREA (widget));
g_return_if_fail (allocation != NULL);
......@@ -137,13 +138,24 @@ gtk_drawing_area_size_allocate (GtkWidget *widget,
allocation->x, allocation->y,
allocation->width, allocation->height);
event.type = GDK_CONFIGURE;
event.window = widget->window;
event.x = allocation->x;
event.y = allocation->y;
event.width = allocation->width;
event.height = allocation->height;
gtk_widget_event (widget, (GdkEvent*) &event);
gtk_drawing_area_send_configure (GTK_DRAWING_AREA (widget));
}
}
static void
gtk_drawing_area_send_configure (GtkDrawingArea *darea)
{
GtkWidget *widget;
GdkEventConfigure event;
widget = GTK_WIDGET (darea);
event.type = GDK_CONFIGURE;
event.window = widget->window;
event.x = widget->allocation.x;
event.y = widget->allocation.y;
event.width = widget->allocation.width;
event.height = widget->allocation.height;
gtk_widget_event (widget, (GdkEvent*) &event);
}
......@@ -637,6 +637,7 @@ gtk_entry_size_allocate (GtkWidget *widget,
{
GtkEntry *entry;
GtkEditable *editable;
gint offset;
g_return_if_fail (widget != NULL);
g_return_if_fail (GTK_IS_ENTRY (widget));
......@@ -658,8 +659,17 @@ gtk_entry_size_allocate (GtkWidget *widget,
allocation->width - (widget->style->klass->xthickness + INNER_BORDER) * 2,
widget->requisition.height - (widget->style->klass->ythickness + INNER_BORDER) * 2);
entry->scroll_offset = 0;
/* Display as much text as we can */
offset = MAX(0, entry->char_offset[entry->nchars] -
(allocation->width -
(widget->style->klass->xthickness + INNER_BORDER) * 2));
if (entry->scroll_offset > offset)
entry->scroll_offset = offset;
/* And make sure the cursor is on screen */
gtk_entry_adjust_scroll (entry);
#ifdef USE_XIM
if (editable->ic && (gdk_ic_get_style (editable->ic) & GdkIMPreeditPosition))
{
......
......@@ -162,8 +162,8 @@ gtk_event_box_size_allocate (GtkWidget *widget,
child_allocation.x = 0;
child_allocation.y = 0;
child_allocation.width = allocation->width - GTK_CONTAINER (widget)->border_width * 2;
child_allocation.height = allocation->height - GTK_CONTAINER (widget)->border_width * 2;
child_allocation.width = MAX (allocation->width - GTK_CONTAINER (widget)->border_width * 2, 0);
child_allocation.height = MAX (allocation->height - GTK_CONTAINER (widget)->border_width * 2, 0);
if (GTK_WIDGET_REALIZED (widget))
{
......
......@@ -514,8 +514,8 @@ gtk_handle_box_size_allocate (GtkWidget *widget,
}
else
{
child_allocation.width = widget->allocation.width - 2 * border_width;
child_allocation.height = widget->allocation.height - 2 * border_width;
child_allocation.width = MAX (0, widget->allocation.width - 2 * border_width);
child_allocation.height = MAX (0, widget->allocation.height - 2 * border_width);
if (hb->handle_position == GTK_POS_LEFT ||
hb->handle_position == GTK_POS_RIGHT)
......
......@@ -187,7 +187,7 @@ gtk_hbox_size_allocate (GtkWidget *widget,
}
else if (nexpand_children > 0)
{
width = allocation->width - widget->requisition.width;
width = (gint)allocation->width - (gint)widget->requisition.width;
extra = width / nexpand_children;
}
else
......@@ -198,7 +198,7 @@ gtk_hbox_size_allocate (GtkWidget *widget,
x = allocation->x + GTK_CONTAINER (box)->border_width;
child_allocation.y = allocation->y + GTK_CONTAINER (box)->border_width;
child_allocation.height = allocation->height - GTK_CONTAINER (box)->border_width * 2;
child_allocation.height = MAX (0, allocation->height - GTK_CONTAINER (box)->border_width * 2);
children = box->children;
while (children)
......@@ -236,7 +236,7 @@ gtk_hbox_size_allocate (GtkWidget *widget,
if (child->fill)
{
child_allocation.width = child_width - child->padding * 2;
child_allocation.width = MAX (0, child_width - child->padding * 2);
child_allocation.x = x + child->padding;
}
else
......@@ -289,7 +289,7 @@ gtk_hbox_size_allocate (GtkWidget *widget,
if (child->fill)
{
child_allocation.width = child_width - child->padding * 2;
child_allocation.width = MAX (0, child_width - child->padding * 2);
child_allocation.x = x + child->padding - child_width;
}
else
......
......@@ -177,7 +177,7 @@ gtk_hpaned_size_allocate (GtkWidget *widget,
paned->groove_rectangle.height);
}
child1_allocation.height = child2_allocation.height = allocation->height - border_width * 2;
child1_allocation.height = child2_allocation.height = MAX (0, allocation->height - border_width * 2);
child1_allocation.width = paned->child1_size;
child1_allocation.x = border_width;
child1_allocation.y = child2_allocation.y = border_width;
......@@ -189,8 +189,8 @@ gtk_hpaned_size_allocate (GtkWidget *widget,
paned->groove_rectangle.height = allocation->height;
child2_allocation.x = paned->groove_rectangle.x + paned->gutter_size / 2 + 1;
child2_allocation.width = allocation->width
- child2_allocation.x - border_width;
child2_allocation.width = MAX (0, allocation->width
- child2_allocation.x - border_width);
/* Now allocate the childen, making sure, when resizing not to
* overlap the windows */
......
......@@ -679,7 +679,7 @@ gtk_list_motion_notify (GtkWidget *widget,
g_return_val_if_fail (GTK_IS_LIST (widget), FALSE);
g_return_val_if_fail (event != NULL, FALSE);
g_print ("gtk_list_motion_notify\n");
/* g_print ("gtk_list_motion_notify\n"); */
return FALSE;
}
......@@ -789,7 +789,7 @@ gtk_list_size_allocate (GtkWidget *widget,
{
child_allocation.x = GTK_CONTAINER (list)->border_width;
child_allocation.y = GTK_CONTAINER (list)->border_width;
child_allocation.width = allocation->width - child_allocation.x * 2;
child_allocation.width = MAX (0, allocation->width - child_allocation.x * 2);
children = list->children;
......
......@@ -1253,7 +1253,7 @@ gtk_get_event_widget (GdkEvent *event)
GtkWidget *widget;
widget = NULL;
if (event->any.window)
if (event && event->any.window)
gdk_window_get_user_data (event->any.window, (void**) &widget);
return widget;
......
......@@ -641,7 +641,7 @@ gtk_menu_size_allocate (GtkWidget *widget,
widget->style->klass->xthickness);
child_allocation.y = (GTK_CONTAINER (menu)->border_width +
widget->style->klass->ythickness);
child_allocation.width = allocation->width - child_allocation.x * 2;
child_allocation.width = MAX (0, allocation->width - child_allocation.x * 2);
children = menu_shell->children;
while (children)
......
......@@ -200,7 +200,7 @@ gtk_menu_bar_size_allocate (GtkWidget *widget,
child_allocation.y = (GTK_CONTAINER (menu_bar)->border_width +
widget->style->klass->ythickness +
BORDER_SPACING);
child_allocation.height = allocation->height - child_allocation.y * 2;
child_allocation.height = MAX (0, allocation->height - child_allocation.y * 2);
children = menu_shell->children;
while (children)
......
......@@ -395,8 +395,8 @@ gtk_menu_item_size_allocate (GtkWidget *widget,
widget->style->klass->xthickness +
BORDER_SPACING);
child_allocation.y = GTK_CONTAINER (widget)->border_width;
child_allocation.width = allocation->width - child_allocation.x * 2;
child_allocation.height = allocation->height - child_allocation.y * 2;
child_allocation.width = MAX (0, allocation->width - child_allocation.x * 2);
child_allocation.height = MAX (0, allocation->height - child_allocation.y * 2);
child_allocation.x += GTK_MENU_ITEM (widget)->toggle_size;
child_allocation.width -= (GTK_MENU_ITEM (widget)->toggle_size +
GTK_MENU_ITEM (widget)->accelerator_size);
......
......@@ -1162,15 +1162,17 @@ gtk_notebook_size_allocate (GtkWidget *widget,
{
child_allocation.x = GTK_CONTAINER (widget)->border_width;
child_allocation.y = GTK_CONTAINER (widget)->border_width;
child_allocation.width = allocation->width - child_allocation.x * 2;
child_allocation.height = allocation->height - child_allocation.y * 2;
child_allocation.width = MAX (0, allocation->width - child_allocation.x * 2);
child_allocation.height = MAX (0, allocation->height - child_allocation.y * 2);
if (notebook->show_tabs || notebook->show_border)
{
child_allocation.x += widget->style->klass->xthickness;
child_allocation.y += widget->style->klass->ythickness;
child_allocation.width -= widget->style->klass->xthickness * 2;
child_allocation.height -= widget->style->klass->ythickness * 2;
child_allocation.width = MAX (0,
child_allocation.width - widget->style->klass->xthickness * 2);
child_allocation.height = MAX (0,
child_allocation.height - widget->style->klass->ythickness * 2);
if (notebook->show_tabs && notebook->children)
{
......@@ -1179,12 +1181,14 @@ gtk_notebook_size_allocate (GtkWidget *widget,
case GTK_POS_TOP:
child_allocation.y += notebook->cur_page->requisition.height;
case GTK_POS_BOTTOM:
child_allocation.height -= notebook->cur_page->requisition.height;
child_allocation.height = MAX (0,
child_allocation.height - notebook->cur_page->requisition.height);
break;
case GTK_POS_LEFT:
child_allocation.x += notebook->cur_page->requisition.width;
case GTK_POS_RIGHT:
child_allocation.width -= notebook->cur_page->requisition.width;
child_allocation.width = MAX (0,
child_allocation.width - notebook->cur_page->requisition.width);
break;
}
}
......
......@@ -493,13 +493,15 @@ gtk_scrolled_window_viewport_allocate (GtkWidget *widget,
allocation->x = GTK_CONTAINER (widget)->border_width;
allocation->y = GTK_CONTAINER (widget)->border_width;
allocation->width = widget->allocation.width - allocation->x * 2;
allocation->height = widget->allocation.height - allocation->y * 2;
allocation->width = MAX (0, widget->allocation.width - allocation->x * 2);
allocation->height = MAX (0, widget->allocation.height - allocation->y * 2);
if (GTK_WIDGET_VISIBLE (scrolled_window->vscrollbar))
allocation->width -= scrolled_window->vscrollbar->requisition.width + SCROLLBAR_SPACING (scrolled_window);
allocation->width = MAX (0,
allocation->width - (scrolled_window->vscrollbar->requisition.width + SCROLLBAR_SPACING (scrolled_window)));
if (GTK_WIDGET_VISIBLE (scrolled_window->hscrollbar))
allocation->height -= scrolled_window->hscrollbar->requisition.height + SCROLLBAR_SPACING (scrolled_window);
allocation->height = MAX (0,
allocation->height - (scrolled_window->hscrollbar->requisition.height + SCROLLBAR_SPACING (scrolled_window)));
}