From 4b5d2bd0db83e06b6bf51d360940c08eed1b4fac Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Sat, 27 Sep 2008 00:00:32 +0000 Subject: [PATCH] Bug 553578 - tabs are not drawn correctly MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 2008-09-26 Matthias Clasen 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=/branches/gtk-2-14/; revision=21526 --- ChangeLog | 11 +++++++++++ gtk/gtknotebook.c | 21 +++++++++++++++++++-- 2 files changed, 30 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 00ab5c5df8..153eccacbe 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,14 @@ +2008-09-26 Matthias Clasen + + Merged from trunk: + + 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. + 2008-09-26 Matthias Clasen Merged from trunk: 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; }