don't perform gdk operations on size allocation

if the notebook isn't realized.
yosh: this fixes the iwarp problem.
-timj
This commit is contained in:
Tim Janik 1998-02-22 12:16:01 +00:00
parent 5861dfb9f8
commit 9a0687a673
3 changed files with 56 additions and 60 deletions

View File

@ -2246,14 +2246,16 @@ gtk_notebook_pages_allocate (GtkNotebook *notebook,
switch (notebook->tab_pos) switch (notebook->tab_pos)
{ {
case GTK_POS_BOTTOM: case GTK_POS_BOTTOM:
child_allocation.y = allocation->height child_allocation.y = (allocation->height -
- notebook->cur_page->requisition.height - container->border_width; notebook->cur_page->requisition.height -
container->border_width);
case GTK_POS_TOP: case GTK_POS_TOP:
child_allocation.height = notebook->cur_page->requisition.height; child_allocation.height = notebook->cur_page->requisition.height;
break; break;
case GTK_POS_RIGHT: case GTK_POS_RIGHT:
child_allocation.x = allocation->width child_allocation.x = (allocation->width -
- notebook->cur_page->requisition.width - container->border_width; notebook->cur_page->requisition.width -
container->border_width);
case GTK_POS_LEFT: case GTK_POS_LEFT:
child_allocation.width = notebook->cur_page->requisition.width; child_allocation.width = notebook->cur_page->requisition.width;
break; break;
@ -2272,23 +2274,21 @@ gtk_notebook_pages_allocate (GtkNotebook *notebook,
children = children->next; children = children->next;
tab_space += page->requisition.width; tab_space += page->requisition.width;
} }
if (tab_space > allocation->width - 2 * container->border_width if (tab_space > allocation->width - 2 * container->border_width - TAB_OVERLAP)
- TAB_OVERLAP)
{ {
showarrow = TRUE; showarrow = TRUE;
page = notebook->focus_tab->data; page = notebook->focus_tab->data;
tab_space = allocation->width - TAB_OVERLAP
- page->requisition.width - tab_space = (allocation->width - TAB_OVERLAP - page->requisition.width -
2 * (container->border_width + ARROW_SPACING + ARROW_SIZE); 2 * (container->border_width + ARROW_SPACING + ARROW_SIZE));
x = allocation->width - 2 * ARROW_SIZE - ARROW_SPACING x = allocation->width - 2 * ARROW_SIZE - ARROW_SPACING - container->border_width;
- container->border_width;
page = notebook->children->data; page = notebook->children->data;
if (notebook->tab_pos == GTK_POS_TOP) if (notebook->tab_pos == GTK_POS_TOP)
y = container->border_width + y = container->border_width + (page->requisition.height - ARROW_SIZE) / 2;
(page->requisition.height - ARROW_SIZE) / 2;
else else
y = allocation->height - container->border_width - y = (allocation->height - container->border_width -
ARROW_SIZE - (page->requisition.height - ARROW_SIZE) / 2; ARROW_SIZE - (page->requisition.height - ARROW_SIZE) / 2);
} }
break; break;
case GTK_POS_LEFT: case GTK_POS_LEFT:
@ -2299,26 +2299,23 @@ gtk_notebook_pages_allocate (GtkNotebook *notebook,
children = children->next; children = children->next;
tab_space += page->requisition.height; tab_space += page->requisition.height;
} }
if (tab_space > allocation->height - 2 * container->border_width if (tab_space > (allocation->height - 2 * container->border_width - TAB_OVERLAP))
- TAB_OVERLAP)
{ {
showarrow = TRUE; showarrow = TRUE;
page = notebook->focus_tab->data; page = notebook->focus_tab->data;
tab_space = allocation->height tab_space = (allocation->height -
- ARROW_SIZE - ARROW_SPACING - TAB_OVERLAP ARROW_SIZE - ARROW_SPACING - TAB_OVERLAP -
- 2 * container->border_width - page->requisition.height; 2 * container->border_width - page->requisition.height);
y = allocation->height - container->border_width y = allocation->height - container->border_width - ARROW_SIZE;
- ARROW_SIZE;
page = notebook->children->data; page = notebook->children->data;
if (notebook->tab_pos == GTK_POS_LEFT) if (notebook->tab_pos == GTK_POS_LEFT)
x = container->border_width x = (container->border_width +
+ (page->requisition.width (page->requisition.width - (2 * ARROW_SIZE - ARROW_SPACING)) / 2);
- (2 * ARROW_SIZE - ARROW_SPACING)) / 2;
else else
x = allocation->width - container->border_width x = (allocation->width - container->border_width -
- (2 * ARROW_SIZE - ARROW_SPACING) (2 * ARROW_SIZE - ARROW_SPACING) -
- (page->requisition.width (page->requisition.width - (2 * ARROW_SIZE - ARROW_SPACING)) / 2);
- (2 * ARROW_SIZE - ARROW_SPACING)) / 2;
} }
break; break;
} }
@ -2365,8 +2362,12 @@ gtk_notebook_pages_allocate (GtkNotebook *notebook,
notebook->first_tab = children->next; notebook->first_tab = children->next;
} }
} }
if (GTK_WIDGET_REALIZED (notebook))
{
gdk_window_move (notebook->panel, x, y); gdk_window_move (notebook->panel, x, y);
gdk_window_show (notebook->panel); gdk_window_show (notebook->panel);
}
if (tab_space < 0) if (tab_space < 0)
{ {
@ -2404,9 +2405,10 @@ gtk_notebook_pages_allocate (GtkNotebook *notebook,
} }
else /* !showarrow */ else /* !showarrow */
{ {
gdk_window_hide (notebook->panel);
notebook->first_tab = notebook->children; notebook->first_tab = notebook->children;
tab_space = 0; tab_space = 0;
if (GTK_WIDGET_REALIZED (notebook))
gdk_window_hide (notebook->panel);
} }
children = notebook->first_tab; children = notebook->first_tab;
} }
@ -2426,13 +2428,11 @@ gtk_notebook_pages_allocate (GtkNotebook *notebook,
{ {
case GTK_POS_TOP: case GTK_POS_TOP:
case GTK_POS_BOTTOM: case GTK_POS_BOTTOM:
child_allocation.width = page->requisition.width child_allocation.width = page->requisition.width + TAB_OVERLAP + new_fill - old_fill;
+ TAB_OVERLAP + new_fill - old_fill;
break; break;
case GTK_POS_LEFT: case GTK_POS_LEFT:
case GTK_POS_RIGHT: case GTK_POS_RIGHT:
child_allocation.height = page->requisition.height child_allocation.height = page->requisition.height + TAB_OVERLAP + new_fill - old_fill;
+ TAB_OVERLAP + new_fill - old_fill;
break; break;
} }
old_fill = new_fill; old_fill = new_fill;
@ -2450,7 +2450,8 @@ gtk_notebook_pages_allocate (GtkNotebook *notebook,
break; break;
} }
if (!GTK_WIDGET_MAPPED (page->tab_label)) if (GTK_WIDGET_REALIZED (notebook) &&
!GTK_WIDGET_MAPPED (page->tab_label))
gtk_widget_map (page->tab_label); gtk_widget_map (page->tab_label);
} }
} }
@ -2494,37 +2495,29 @@ gtk_notebook_page_allocate (GtkNotebook *notebook,
{ {
case GTK_POS_TOP: case GTK_POS_TOP:
child_allocation.x = xthickness + notebook->tab_border; child_allocation.x = xthickness + notebook->tab_border;
child_allocation.y = ythickness + notebook->tab_border child_allocation.y = ythickness + notebook->tab_border + page->allocation.y;
+ page->allocation.y;
child_allocation.width = page->allocation.width - child_allocation.x * 2; child_allocation.width = page->allocation.width - child_allocation.x * 2;
child_allocation.height = page->allocation.height - ythickness child_allocation.height = page->allocation.height - ythickness - 2 * notebook->tab_border;
- 2 * notebook->tab_border;
child_allocation.x += page->allocation.x; child_allocation.x += page->allocation.x;
break; break;
case GTK_POS_BOTTOM: case GTK_POS_BOTTOM:
child_allocation.x = xthickness + notebook->tab_border; child_allocation.x = xthickness + notebook->tab_border;
child_allocation.width = page->allocation.width - child_allocation.x * 2; child_allocation.width = page->allocation.width - child_allocation.x * 2;
child_allocation.height = page->allocation.height - ythickness child_allocation.height = page->allocation.height - ythickness - 2 * notebook->tab_border;
- 2 * notebook->tab_border;
child_allocation.x += page->allocation.x; child_allocation.x += page->allocation.x;
child_allocation.y = page->allocation.y + notebook->tab_border; child_allocation.y = page->allocation.y + notebook->tab_border;
break; break;
case GTK_POS_LEFT: case GTK_POS_LEFT:
child_allocation.x = xthickness + notebook->tab_border child_allocation.x = xthickness + notebook->tab_border + page->allocation.x;
+ page->allocation.x;
child_allocation.y = ythickness + notebook->tab_border; child_allocation.y = ythickness + notebook->tab_border;
child_allocation.width = page->allocation.width - xthickness child_allocation.width = page->allocation.width - xthickness - 2 * notebook->tab_border;
- 2 * notebook->tab_border; child_allocation.height = page->allocation.height - child_allocation.y * 2;
child_allocation.height = page->allocation.height
- child_allocation.y * 2;
child_allocation.y += page->allocation.y; child_allocation.y += page->allocation.y;
break; break;
case GTK_POS_RIGHT: case GTK_POS_RIGHT:
child_allocation.y = ythickness + notebook->tab_border; child_allocation.y = ythickness + notebook->tab_border;
child_allocation.width = page->allocation.width - xthickness child_allocation.width = page->allocation.width - xthickness - 2 * notebook->tab_border;
- 2 * notebook->tab_border; child_allocation.height = page->allocation.height - child_allocation.y * 2;
child_allocation.height = page->allocation.height
- child_allocation.y * 2;
child_allocation.x = page->allocation.x + notebook->tab_border; child_allocation.x = page->allocation.x + notebook->tab_border;
child_allocation.y += page->allocation.y; child_allocation.y += page->allocation.y;
break; break;

View File

@ -84,6 +84,7 @@ enum
{ {
GTK_ARG_READABLE = 1 << 0, GTK_ARG_READABLE = 1 << 0,
GTK_ARG_WRITABLE = 1 << 1, GTK_ARG_WRITABLE = 1 << 1,
GTK_ARG_CONSTRUCT = 1 << 2
}; };
#define GTK_ARG_READWRITE (GTK_ARG_READABLE | GTK_ARG_WRITABLE) #define GTK_ARG_READWRITE (GTK_ARG_READABLE | GTK_ARG_WRITABLE)

View File

@ -2367,6 +2367,8 @@ gtk_widget_get_parent_window (GtkWidget *widget)
GdkWindow *parent_window; GdkWindow *parent_window;
g_return_val_if_fail (widget != NULL, NULL); g_return_val_if_fail (widget != NULL, NULL);
g_return_val_if_fail (GTK_IS_WIDGET (widget), NULL);
g_return_val_if_fail (widget->parent != NULL, NULL);
parent_window = gtk_object_get_data (GTK_OBJECT (widget), parent_window = gtk_object_get_data (GTK_OBJECT (widget),
parent_window_key); parent_window_key);