summaryrefslogtreecommitdiff
path: root/gtk/gtknotebook.c
diff options
context:
space:
mode:
authorMatthias Clasen <mclasen@redhat.com>2008-09-26 23:58:12 +0000
committerMatthias Clasen <matthiasc@src.gnome.org>2008-09-26 23:58:12 +0000
commit9b320a62f11c5eea57855fe9725c13594d192bb0 (patch)
treeadf8ef2da9e8d5bf426307ad40ffa2941a76678b /gtk/gtknotebook.c
parentbc48caa272bdc0971191bd5f2bfc61bbdd48f460 (diff)
downloadgtk+-9b320a62f11c5eea57855fe9725c13594d192bb0.tar.gz
Bug 553578 - tabs are not drawn correctly
2008-09-26 Matthias Clasen <mclasen@redhat.com> Bug 553578 - tabs are not drawn correctly * gtk/gtknotebook.c: Track the visibility state of notebook tabs between allocations so that we know to redraw the tab labels if tabs are hidden and shown without changing position. Reported by Marek Kašík, patch by Owen Taylor. svn path=/trunk/; revision=21525
Diffstat (limited to 'gtk/gtknotebook.c')
-rw-r--r--gtk/gtknotebook.c21
1 files changed, 19 insertions, 2 deletions
diff --git a/gtk/gtknotebook.c b/gtk/gtknotebook.c
index e09a0060be..1f3ad2494c 100644
--- a/gtk/gtknotebook.c
+++ b/gtk/gtknotebook.c
@@ -153,6 +153,11 @@ struct _GtkNotebookPage
guint reorderable : 1;
guint detachable : 1;
+ /* if true, the tab label was visible on last allocation; we track this so
+ * that we know to redraw the tab area if a tab label was hidden then shown
+ * without changing position */
+ guint tab_allocated_visible : 1;
+
GtkRequisition requisition;
GtkAllocation allocation;
@@ -5556,9 +5561,15 @@ gtk_notebook_page_allocate (GtkNotebook *notebook,
gint tab_curvature;
gint tab_pos = get_effective_tab_pos (notebook);
gboolean tab_allocation_changed;
+ gboolean was_visible = page->tab_allocated_visible;
- if (!page->tab_label)
- return FALSE;
+ if (!page->tab_label ||
+ !GTK_WIDGET_VISIBLE (page->tab_label) ||
+ !gtk_widget_get_child_visible (page->tab_label))
+ {
+ page->tab_allocated_visible = FALSE;
+ return was_visible;
+ }
xthickness = widget->style->xthickness;
ythickness = widget->style->ythickness;
@@ -5630,6 +5641,12 @@ gtk_notebook_page_allocate (GtkNotebook *notebook,
gtk_widget_size_allocate (page->tab_label, &child_allocation);
+ if (!was_visible)
+ {
+ page->tab_allocated_visible = TRUE;
+ tab_allocation_changed = TRUE;
+ }
+
return tab_allocation_changed;
}