[gtk+] notebook: use the current page allocation when computing the redraw area



commit 79bbce5577ff8a623f9fecc291b589db5eade053
Author: Cosimo Cecchi <cosimoc gnome org>
Date:   Mon Nov 21 13:57:27 2011 -0500

    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

 gtk/gtknotebook.c |   13 ++-----------
 1 files changed, 2 insertions(+), 11 deletions(-)
---
diff --git a/gtk/gtknotebook.c b/gtk/gtknotebook.c
index 59906f8..7fce619 100644
--- a/gtk/gtknotebook.c
+++ b/gtk/gtknotebook.c
@@ -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;
     }
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]