From a3b3c91001840908891c1954a35c6892ca569e6e Mon Sep 17 00:00:00 2001 From: Cosimo Cecchi Date: Sat, 5 Mar 2011 03:01:44 -0500 Subject: [PATCH] notebook: flip the render order The render order for tabs is now - left to right until the active tab - right to left until the active tab - active tab This allows themes that use non-straight lines for the tab curvature to draw them not worrying about flipping one side after the active tab. --- gtk/gtknotebook.c | 38 +++++++++++++++++++++++++++++++++++++- 1 file changed, 37 insertions(+), 1 deletion(-) diff --git a/gtk/gtknotebook.c b/gtk/gtknotebook.c index 77d44f9cb..e601bb720 100644 --- a/gtk/gtknotebook.c +++ b/gtk/gtknotebook.c @@ -4906,7 +4906,7 @@ gtk_notebook_paint (GtkWidget *widget, GtkNotebookPrivate *priv; GtkNotebookPage *page; GtkAllocation allocation; - GList *children; + GList *children, *other_order; gboolean showarrow; gint width, height; gint x, y; @@ -5061,8 +5061,13 @@ gtk_notebook_paint (GtkWidget *widget, while (children) { page = children->data; + + if (page == priv->cur_page) + break; + children = gtk_notebook_search_page (notebook, children, step, TRUE); + if (!gtk_widget_get_visible (page->child) || !gtk_widget_get_mapped (page->tab_label)) continue; @@ -5071,6 +5076,37 @@ gtk_notebook_paint (GtkWidget *widget, gtk_notebook_draw_tab (notebook, page, cr, tab_flags); } + if (children != NULL) + { + other_order = NULL; + + while (children) + { + page = children->data; + children = gtk_notebook_search_page (notebook, children, + step, TRUE); + if (!gtk_widget_get_visible (page->child) || + !gtk_widget_get_mapped (page->tab_label)) + continue; + + if (children != NULL) + other_order = g_list_prepend (other_order, children->data); + } + + /* draw them with the opposite order */ + children = other_order; + + while (children) + { + page = children->data; + + tab_flags = _gtk_notebook_get_tab_flags (notebook, page); + gtk_notebook_draw_tab (notebook, page, cr, tab_flags); + + children = children->next; + } + } + if (showarrow && priv->scrollable) { if (priv->has_before_previous) -- 2.43.2