notebook: use the current page allocation when computing the redraw area

Instead of taking the first page and trying to adjust the rect with
random padding values, take the current page, as it's always guaranteed
to be at least as tall as inactive tabs.
This fixes some annoying 1px drawing artifacts while switching tabs when
the theme disables notebook padding.

https://bugzilla.gnome.org/show_bug.cgi?id=664494
This commit is contained in:
Cosimo Cecchi 2011-11-21 13:57:27 -05:00
parent f01162c727
commit 79bbce5577

View File

@ -4690,10 +4690,10 @@ gtk_notebook_redraw_tabs (GtkNotebook *notebook)
widget = GTK_WIDGET (notebook);
border = gtk_container_get_border_width (GTK_CONTAINER (notebook));
if (!gtk_widget_get_mapped (widget) || !priv->first_tab)
if (!gtk_widget_get_mapped (widget) || !priv->cur_page)
return;
page = priv->first_tab->data;
page = priv->cur_page;
redraw_rect.x = border;
redraw_rect.y = border;
@ -4707,30 +4707,21 @@ gtk_notebook_redraw_tabs (GtkNotebook *notebook)
case GTK_POS_BOTTOM:
redraw_rect.y = allocation.height - border -
page->allocation.height - padding.bottom;
if (page != priv->cur_page)
redraw_rect.y -= padding.bottom;
/* fall through */
case GTK_POS_TOP:
redraw_rect.width = allocation.width - 2 * border;
redraw_rect.height = page->allocation.height + padding.top;
if (page != priv->cur_page)
redraw_rect.height += padding.top;
break;
case GTK_POS_RIGHT:
redraw_rect.x = allocation.width - border -
page->allocation.width - padding.right;
if (page != priv->cur_page)
redraw_rect.x -= padding.right;
/* fall through */
case GTK_POS_LEFT:
redraw_rect.width = page->allocation.width + padding.left;
redraw_rect.height = allocation.height - 2 * border;
if (page != priv->cur_page)
redraw_rect.width += padding.left;
break;
}