summaryrefslogtreecommitdiff
path: root/gtk/gtkcontainer.c
diff options
context:
space:
mode:
authorBenjamin Otte <otte@redhat.com>2012-03-23 03:01:16 +0100
committerBenjamin Otte <otte@redhat.com>2012-04-17 08:59:10 +0200
commit585a1fae4f347d979c55f2848cd3afba7dc32c2e (patch)
treea548bc8f389b67721f490691f8cdd13221d310a8 /gtk/gtkcontainer.c
parenteb537b60f4d263667e0a9542998e7e7ae0751ccc (diff)
downloadgtk+-585a1fae4f347d979c55f2848cd3afba7dc32c2e.tar.gz
stylecontext: Really queue style changes
Instead of instantly applying a new style, just mark the context as invalid. Only apply the new style at layout time.
Diffstat (limited to 'gtk/gtkcontainer.c')
-rw-r--r--gtk/gtkcontainer.c17
1 files changed, 16 insertions, 1 deletions
diff --git a/gtk/gtkcontainer.c b/gtk/gtkcontainer.c
index 275ee28c1f..6253ab79fd 100644
--- a/gtk/gtkcontainer.c
+++ b/gtk/gtkcontainer.c
@@ -46,6 +46,7 @@
#include "gtkwindow.h"
#include "gtkassistant.h"
#include "gtkintl.h"
+#include "gtkstylecontextprivate.h"
#include "gtkwidgetpath.h"
#include "a11y/gtkcontaineraccessible.h"
@@ -1641,15 +1642,28 @@ gtk_container_get_resize_container (GtkContainer *container)
static gboolean
gtk_container_idle_sizer (gpointer data)
{
+ GSList *slist;
+
/* we may be invoked with a container_resize_queue of NULL, because
* queue_resize could have been adding an extra idle function while
* the queue still got processed. we better just ignore such case
* than trying to explicitely work around them with some extra flags,
* since it doesn't cause any actual harm.
*/
+
+ /* We validate the style contexts in a single loop before even trying
+ * to handle resizes instead of doing validations inline.
+ * This is mostly necessary for compatibility reasons with old code,
+ * because size_allocate functions often change styles and so could
+ * cause infinite loops in this function.
+ */
+ for (slist = container_resize_queue; slist; slist = slist->next)
+ {
+ _gtk_style_context_validate (gtk_widget_get_style_context (slist->data), 0);
+ }
+
while (container_resize_queue)
{
- GSList *slist;
GtkWidget *widget;
slist = container_resize_queue;
@@ -1714,6 +1728,7 @@ _gtk_container_queue_resize_internal (GtkContainer *container,
break;
case GTK_RESIZE_IMMEDIATE:
+ _gtk_style_context_validate (gtk_widget_get_style_context (GTK_WIDGET (resize_container)), 0);
gtk_container_check_resize (resize_container);
break;