gtk+ r21414 - in trunk: . gtk



Author: matthiasc
Date: Wed Sep 17 16:02:26 2008
New Revision: 21414
URL: http://svn.gnome.org/viewvc/gtk+?rev=21414&view=rev

Log:
        Bug 329593 â Entering characters on a line very cpu intensive and
        slow

        * gtk/gtknotebook.c (gtk_notebook_page_allocate): Return a boolean
        that indicates whether the tab allocation has changed.
        (gtk_notebook_pages_allocate): Only redraw the tabs if their
        allocation has changed.
        (gtk_notebook_calculate_tabs_allocations): Remove unused return value.
        Patch by Owen Taylor



Modified:
   trunk/ChangeLog
   trunk/gtk/gtknotebook.c

Modified: trunk/gtk/gtknotebook.c
==============================================================================
--- trunk/gtk/gtknotebook.c	(original)
+++ trunk/gtk/gtknotebook.c	Wed Sep 17 16:02:26 2008
@@ -372,7 +372,7 @@
 
 /*** GtkNotebook Size Allocate Functions ***/
 static void gtk_notebook_pages_allocate      (GtkNotebook      *notebook);
-static void gtk_notebook_page_allocate       (GtkNotebook      *notebook,
+static gboolean gtk_notebook_page_allocate   (GtkNotebook      *notebook,
 					      GtkNotebookPage  *page);
 static void gtk_notebook_calc_tabs           (GtkNotebook      *notebook,
 			                      GList            *start,
@@ -5161,7 +5161,7 @@
   return FALSE;
 }
 
-static gboolean
+static void
 gtk_notebook_calculate_tabs_allocation (GtkNotebook  *notebook,
 					GList       **children,
 					GList        *last_child,
@@ -5182,7 +5182,6 @@
   gint xthickness, ythickness;
   gboolean gap_left, packing_changed;
   GtkAllocation child_allocation = { 0, };
-  gboolean allocation_changed = FALSE;
 
   widget = GTK_WIDGET (notebook);
   container = GTK_CONTAINER (notebook);
@@ -5368,13 +5367,6 @@
 	  break;
 	}
 
-      if ((priv->operation != DRAG_OPERATION_REORDER || page != notebook->cur_page) &&
-	  (page->allocation.x != child_allocation.x ||
-	   page->allocation.y != child_allocation.y ||
-	   page->allocation.width != child_allocation.width ||
-	   page->allocation.height != child_allocation.height))
-	allocation_changed = TRUE;
-
       page->allocation = child_allocation;
 
       if ((page == priv->detached_tab && priv->operation == DRAG_OPERATION_DETACH) ||
@@ -5495,8 +5487,6 @@
 	  break;
 	}
     }
-
-  return allocation_changed;
 }
 
 static void
@@ -5507,6 +5497,7 @@
   gboolean showarrow = FALSE;
   gint tab_space, min, max, remaining_space;
   gint expanded_tabs, operation;
+  gboolean tab_allocations_changed = FALSE;
 
   if (!notebook->show_tabs || !notebook->children || !notebook->cur_page)
     return;
@@ -5537,7 +5528,8 @@
 
   while (children)
     {
-      gtk_notebook_page_allocate (notebook, GTK_NOTEBOOK_PAGE (children));
+      if (gtk_notebook_page_allocate (notebook, GTK_NOTEBOOK_PAGE (children)))
+	tab_allocations_changed = TRUE;
       children = children->next;
     }
 
@@ -5546,10 +5538,11 @@
   if (!notebook->first_tab)
     notebook->first_tab = notebook->children;
 
-  gtk_notebook_redraw_tabs (notebook);
+  if (tab_allocations_changed)
+    gtk_notebook_redraw_tabs (notebook);
 }
 
-static void
+static gboolean
 gtk_notebook_page_allocate (GtkNotebook     *notebook,
 			    GtkNotebookPage *page)
 {
@@ -5562,9 +5555,10 @@
   gint focus_width;
   gint tab_curvature;
   gint tab_pos = get_effective_tab_pos (notebook);
+  gboolean tab_allocation_changed;
 
   if (!page->tab_label)
-    return;
+    return FALSE;
 
   xthickness = widget->style->xthickness;
   ythickness = widget->style->ythickness;
@@ -5629,7 +5623,14 @@
       break;
     }
 
+  tab_allocation_changed = (child_allocation.x != page->tab_label->allocation.x ||
+			    child_allocation.y != page->tab_label->allocation.y ||
+			    child_allocation.width != page->tab_label->allocation.width ||
+			    child_allocation.height != page->tab_label->allocation.height);
+
   gtk_widget_size_allocate (page->tab_label, &child_allocation);
+
+  return tab_allocation_changed;
 }
 
 static void 



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