[gtk+/wip/cssvalue: 164/165] container: needs_resize is a container flag, not a widget flag



commit 99afff1edffb947c628d01397cdf4580fb6e7827
Author: Benjamin Otte <otte redhat com>
Date:   Fri Apr 13 16:51:19 2012 +0200

    container: needs_resize is a container flag, not a widget flag
    
    The widget flag is alloc_needed, needs_resize is used for "is queued
    into the container resize queue".

 gtk/gtkcontainer.c     |   19 ++++++++++---------
 gtk/gtkwidget.c        |   18 ------------------
 gtk/gtkwidgetprivate.h |    3 ---
 3 files changed, 10 insertions(+), 30 deletions(-)
---
diff --git a/gtk/gtkcontainer.c b/gtk/gtkcontainer.c
index 962afde..ad76313 100644
--- a/gtk/gtkcontainer.c
+++ b/gtk/gtkcontainer.c
@@ -239,6 +239,7 @@ struct _GtkContainerPrivate
 
   guint has_focus_chain    : 1;
   guint reallocate_redraws : 1;
+  guint resize_pending     : 1;
   guint resize_mode        : 2;
   guint request_mode       : 2;
 };
@@ -1351,7 +1352,7 @@ gtk_container_destroy (GtkWidget *widget)
   GtkContainer *container = GTK_CONTAINER (widget);
   GtkContainerPrivate *priv = container->priv;
 
-  if (_gtk_widget_get_resize_pending (GTK_WIDGET (container)))
+  if (priv->resize_pending)
     _gtk_container_dequeue_resize_handler (container);
 
   if (priv->focus_child)
@@ -1542,10 +1543,10 @@ void
 _gtk_container_dequeue_resize_handler (GtkContainer *container)
 {
   g_return_if_fail (GTK_IS_CONTAINER (container));
-  g_return_if_fail (_gtk_widget_get_resize_pending (GTK_WIDGET (container)));
+  g_return_if_fail (container->priv->resize_pending);
 
   container_resize_queue = g_slist_remove (container_resize_queue, container);
-  _gtk_widget_set_resize_pending (GTK_WIDGET (container), FALSE);
+  container->priv->resize_pending = FALSE;
 }
 
 /**
@@ -1650,15 +1651,15 @@ gtk_container_idle_sizer (gpointer data)
 
   while (container_resize_queue)
     {
-      GtkWidget *widget;
+      GtkContainer *container;
 
       slist = container_resize_queue;
       container_resize_queue = slist->next;
-      widget = slist->data;
+      container = slist->data;
       g_slist_free_1 (slist);
 
-      _gtk_widget_set_resize_pending (widget, FALSE);
-      gtk_container_check_resize (GTK_CONTAINER (widget));
+      container->priv->resize_pending = FALSE;
+      gtk_container_check_resize (container);
     }
 
   gdk_window_process_all_updates ();
@@ -1682,9 +1683,9 @@ _gtk_container_queue_resize_handler (GtkContainer *container)
       switch (container->priv->resize_mode)
         {
         case GTK_RESIZE_QUEUE:
-          if (!_gtk_widget_get_resize_pending (widget))
+          if (!container->priv->resize_pending)
             {
-              _gtk_widget_set_resize_pending (widget, TRUE);
+              container->priv->resize_pending = TRUE;
               if (container_resize_queue == NULL)
                 gdk_threads_add_idle_full (GTK_PRIORITY_RESIZE,
                                            gtk_container_idle_sizer,
diff --git a/gtk/gtkwidget.c b/gtk/gtkwidget.c
index a995424..dd94809 100644
--- a/gtk/gtkwidget.c
+++ b/gtk/gtkwidget.c
@@ -342,7 +342,6 @@ struct _GtkWidgetPrivate
   guint in_reparent           : 1;
 
   /* Queue-resize related flags */
-  guint resize_pending        : 1;
   guint alloc_needed          : 1;
   guint width_request_needed  : 1;
   guint height_request_needed : 1;
@@ -8573,10 +8572,6 @@ gtk_widget_verify_invariants (GtkWidget *widget)
 
 #if 0
       /* widget_system.txt says these hold, but they don't. */
-      if (widget->priv->resize_pending)
-        g_warning ("%s %p resize pending but not realized",
-                   G_OBJECT_TYPE_NAME (widget), widget);
-
       if (widget->priv->alloc_needed)
         g_warning ("%s %p alloc needed but not realized",
                    G_OBJECT_TYPE_NAME (widget), widget);
@@ -13698,19 +13693,6 @@ gtk_widget_in_destruction (GtkWidget *widget)
 }
 
 gboolean
-_gtk_widget_get_resize_pending (GtkWidget *widget)
-{
-  return widget->priv->resize_pending;
-}
-
-void
-_gtk_widget_set_resize_pending (GtkWidget *widget,
-                                gboolean   resize_pending)
-{
-  widget->priv->resize_pending = resize_pending;
-}
-
-gboolean
 _gtk_widget_get_in_reparent (GtkWidget *widget)
 {
   return widget->priv->in_reparent;
diff --git a/gtk/gtkwidgetprivate.h b/gtk/gtkwidgetprivate.h
index fa5e9b8..c59ed39 100644
--- a/gtk/gtkwidgetprivate.h
+++ b/gtk/gtkwidgetprivate.h
@@ -67,9 +67,6 @@ typedef struct {
 
 void         _gtk_widget_set_visible_flag   (GtkWidget *widget,
                                              gboolean   visible);
-gboolean     _gtk_widget_get_resize_pending (GtkWidget *widget);
-void         _gtk_widget_set_resize_pending (GtkWidget *widget,
-                                             gboolean   resize_pending);
 gboolean     _gtk_widget_get_in_reparent    (GtkWidget *widget);
 void         _gtk_widget_set_in_reparent    (GtkWidget *widget,
                                              gboolean   in_reparent);



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