[gtk+/wip/otte/queue-resize: 25/33] sizegroup: Skip resizes on widgets that have resize queued



commit 3eff63e54069b63e5e7ab9410e3af8dbd201eb0e
Author: Benjamin Otte <otte redhat com>
Date:   Mon Sep 28 05:48:57 2015 +0200

    sizegroup: Skip resizes on widgets that have resize queued
    
    Widgets that already have a resize queued don't need to walk the whole
    parent chain and queue another resize. It's enough to do it once per
    resize.
    
    This also means that sizegroups cannot use the shortcut of just
    invalidating the first widget in the group anymore. That widget might
    already have a resize queued while others don't.

 gtk/gtksizegroup.c |   10 ++++++++--
 gtk/gtkwindow.c    |    1 +
 2 files changed, 9 insertions(+), 2 deletions(-)
---
diff --git a/gtk/gtksizegroup.c b/gtk/gtksizegroup.c
index 3eddc1f..a6e0d1f 100644
--- a/gtk/gtksizegroup.c
+++ b/gtk/gtksizegroup.c
@@ -217,6 +217,9 @@ queue_resize_on_widget (GtkWidget *widget,
 
   do
     {
+      if (gtk_widget_get_resize_needed (parent))
+        return;
+
       gtk_widget_queue_resize_on_widget (parent);
 
       if (!check_siblings || _gtk_widget_get_sizegroups (parent) == NULL)
@@ -268,9 +271,12 @@ static void
 queue_resize_on_group (GtkSizeGroup *size_group)
 {
   GtkSizeGroupPrivate *priv = size_group->priv;
+  GSList *list;
 
-  if (priv->widgets)
-    queue_resize_on_widget (priv->widgets->data, TRUE);
+  for (list = priv->widgets; list; list = list->next)
+    {
+      gtk_widget_queue_resize (list->data);
+    }
 }
 
 static void
diff --git a/gtk/gtkwindow.c b/gtk/gtkwindow.c
index f3ad248..660cf33 100644
--- a/gtk/gtkwindow.c
+++ b/gtk/gtkwindow.c
@@ -7545,6 +7545,7 @@ gtk_window_configure_event (GtkWidget         *widget,
   priv->configure_notify_received = TRUE;
 
   gtk_widget_queue_resize (widget);
+  gtk_container_queue_resize_handler (GTK_CONTAINER (widget));
   
   return TRUE;
 }


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