[gtk+/wip/queue-resize: 3/3] sizegroup: Remove GtkQueueResizeFlags



commit 14562498eaf2dfbee632ec0ca6adb9fb3775c402
Author: Benjamin Otte <otte redhat com>
Date:   Tue Mar 24 04:45:38 2015 +0100

    sizegroup: Remove GtkQueueResizeFlags
    
    They were only used with geometry widgets.

 gtk/gtkcontainer.c         |   62 +++++++++++++++-----------------------------
 gtk/gtkcontainerprivate.h  |    1 -
 gtk/gtksizegroup-private.h |   19 +------------
 gtk/gtksizegroup.c         |   34 ++++++++++--------------
 gtk/gtkwidget.c            |   27 +++++++------------
 5 files changed, 46 insertions(+), 97 deletions(-)
---
diff --git a/gtk/gtkcontainer.c b/gtk/gtkcontainer.c
index 3fcc221..55907f0 100644
--- a/gtk/gtkcontainer.c
+++ b/gtk/gtkcontainer.c
@@ -1941,34 +1941,6 @@ gtk_container_queue_resize_handler (GtkContainer *container)
     }
 }
 
-static void
-_gtk_container_queue_resize_internal (GtkContainer *container,
-                                      gboolean      invalidate_only)
-{
-  GtkWidget *widget;
-
-  g_return_if_fail (GTK_IS_CONTAINER (container));
-
-  widget = GTK_WIDGET (container);
-
-  do
-    {
-      _gtk_widget_set_alloc_needed (widget, TRUE);
-      _gtk_size_request_cache_clear (_gtk_widget_peek_request_cache (widget));
-
-      G_GNUC_BEGIN_IGNORE_DEPRECATIONS;
-      if (GTK_IS_RESIZE_CONTAINER (widget))
-        break;
-      G_GNUC_END_IGNORE_DEPRECATIONS;
-
-      widget = gtk_widget_get_parent (widget);
-    }
-  while (widget);
-
-  if (widget && !invalidate_only)
-    gtk_container_queue_resize_handler (GTK_CONTAINER (widget));
-}
-
 void
 _gtk_container_queue_restyle (GtkContainer *container)
 {
@@ -1999,20 +1971,28 @@ _gtk_container_queue_restyle (GtkContainer *container)
 void
 _gtk_container_queue_resize (GtkContainer *container)
 {
-  _gtk_container_queue_resize_internal (container, FALSE);
-}
+  GtkWidget *widget;
 
-/**
- * _gtk_container_resize_invalidate:
- * @container: a #GtkContainer
- *
- * Invalidates cached sizes like _gtk_container_queue_resize() but doesn't
- * actually queue the resize container for resize.
- */
-void
-_gtk_container_resize_invalidate (GtkContainer *container)
-{
-  _gtk_container_queue_resize_internal (container, TRUE);
+  g_return_if_fail (GTK_IS_CONTAINER (container));
+
+  widget = GTK_WIDGET (container);
+
+  do
+    {
+      _gtk_widget_set_alloc_needed (widget, TRUE);
+      _gtk_size_request_cache_clear (_gtk_widget_peek_request_cache (widget));
+
+      G_GNUC_BEGIN_IGNORE_DEPRECATIONS;
+      if (GTK_IS_RESIZE_CONTAINER (widget))
+        break;
+      G_GNUC_END_IGNORE_DEPRECATIONS;
+
+      widget = gtk_widget_get_parent (widget);
+    }
+  while (widget);
+
+  if (widget)
+    gtk_container_queue_resize_handler (GTK_CONTAINER (widget));
 }
 
 void
diff --git a/gtk/gtkcontainerprivate.h b/gtk/gtkcontainerprivate.h
index 79ed0b8..c92f4a5 100644
--- a/gtk/gtkcontainerprivate.h
+++ b/gtk/gtkcontainerprivate.h
@@ -28,7 +28,6 @@ G_BEGIN_DECLS
 GList *  _gtk_container_get_all_children       (GtkContainer *container);
 void     _gtk_container_queue_resize           (GtkContainer *container);
 void     _gtk_container_queue_restyle          (GtkContainer *container);
-void     _gtk_container_resize_invalidate      (GtkContainer *container);
 void     _gtk_container_clear_resize_widgets   (GtkContainer *container);
 gchar*   _gtk_container_child_composite_name   (GtkContainer *container,
                                                 GtkWidget    *child);
diff --git a/gtk/gtksizegroup-private.h b/gtk/gtksizegroup-private.h
index 11b6fa8..6950844 100644
--- a/gtk/gtksizegroup-private.h
+++ b/gtk/gtksizegroup-private.h
@@ -23,26 +23,9 @@
 
 G_BEGIN_DECLS
 
-/*
- * GtkQueueResizeFlags:
- * @GTK_QUEUE_RESIZE_INVALIDATE_ONLY: invalidate all cached sizes
- *  as we would normally do when a widget is queued for resize,
- *  but don’t actually add the toplevel resize container to the
- *  resize queue. Useful if we want to change the size of a widget
- *  see how that would affect the overall layout, then restore
- *  the old size.
- *
- * Flags that affect the operation of queueing a widget for resize.
- */
-typedef enum
-{
-  GTK_QUEUE_RESIZE_INVALIDATE_ONLY = 1 << 0
-} GtkQueueResizeFlags;
-
 GHashTable * _gtk_size_group_get_widget_peers (GtkWidget           *for_widget,
                                                GtkOrientation       orientation);
-void _gtk_size_group_queue_resize             (GtkWidget           *widget,
-                                               GtkQueueResizeFlags  flags);
+void _gtk_size_group_queue_resize             (GtkWidget           *widget);
 
 G_END_DECLS
 
diff --git a/gtk/gtksizegroup.c b/gtk/gtksizegroup.c
index 18e82fd..92da791 100644
--- a/gtk/gtksizegroup.c
+++ b/gtk/gtksizegroup.c
@@ -203,8 +203,7 @@ _gtk_size_group_get_widget_peers (GtkWidget      *for_widget,
 }
                                      
 static void
-real_queue_resize (GtkWidget          *widget,
-                  GtkQueueResizeFlags flags)
+real_queue_resize (GtkWidget *widget)
 {
   GtkWidget *container;
 
@@ -218,17 +217,13 @@ real_queue_resize (GtkWidget          *widget,
 
   if (container)
     {
-      if (flags & GTK_QUEUE_RESIZE_INVALIDATE_ONLY)
-       _gtk_container_resize_invalidate (GTK_CONTAINER (container));
-      else
-       _gtk_container_queue_resize (GTK_CONTAINER (container));
+      _gtk_container_queue_resize (GTK_CONTAINER (container));
     }
 }
 
 static void
-queue_resize_on_widget (GtkWidget          *widget,
-                       gboolean            check_siblings,
-                       GtkQueueResizeFlags flags)
+queue_resize_on_widget (GtkWidget *widget,
+                       gboolean   check_siblings)
 {
   GtkWidget *parent = widget;
 
@@ -241,7 +236,7 @@ queue_resize_on_widget (GtkWidget          *widget,
       
       if (widget == parent && !check_siblings)
        {
-         real_queue_resize (widget, flags);
+         real_queue_resize (widget);
           parent = gtk_widget_get_parent (parent);
          continue;
        }
@@ -250,7 +245,7 @@ queue_resize_on_widget (GtkWidget          *widget,
       if (!widget_groups)
        {
          if (widget == parent)
-           real_queue_resize (widget, flags);
+           real_queue_resize (widget);
 
           parent = gtk_widget_get_parent (parent);
          continue;
@@ -264,14 +259,14 @@ queue_resize_on_widget (GtkWidget          *widget,
          if (current == parent)
            {
              if (widget == parent)
-               real_queue_resize (parent, flags);
+               real_queue_resize (parent);
            }
          else if (current == widget)
             {
               g_warning ("A container and its child are part of this SizeGroup");
             }
          else
-           queue_resize_on_widget (current, FALSE, flags);
+           queue_resize_on_widget (current, FALSE);
        }
       
       g_hash_table_destroy (widgets);
@@ -284,14 +279,14 @@ queue_resize_on_widget (GtkWidget          *widget,
          if (current == parent)
            {
              if (widget == parent)
-               real_queue_resize (parent, flags);
+               real_queue_resize (parent);
            }
          else if (current == widget)
             {
               g_warning ("A container and its child are part of this SizeGroup");
             }
          else
-           queue_resize_on_widget (current, FALSE, flags);
+           queue_resize_on_widget (current, FALSE);
        }
       
       g_hash_table_destroy (widgets);
@@ -301,12 +296,12 @@ queue_resize_on_widget (GtkWidget          *widget,
 }
 
 static void
-queue_resize_on_group (GtkSizeGroup       *size_group)
+queue_resize_on_group (GtkSizeGroup *size_group)
 {
   GtkSizeGroupPrivate *priv = size_group->priv;
 
   if (priv->widgets)
-    queue_resize_on_widget (priv->widgets->data, TRUE, 0);
+    queue_resize_on_widget (priv->widgets->data, TRUE);
 }
 
 static void
@@ -636,10 +631,9 @@ gtk_size_group_get_widgets (GtkSizeGroup *size_group)
  * Queue a resize on a widget, and on all other widgets grouped with this widget.
  **/
 void
-_gtk_size_group_queue_resize (GtkWidget           *widget,
-                             GtkQueueResizeFlags  flags)
+_gtk_size_group_queue_resize (GtkWidget *widget)
 {
-  queue_resize_on_widget (widget, TRUE, flags);
+  queue_resize_on_widget (widget, TRUE);
 }
 
 typedef struct {
diff --git a/gtk/gtkwidget.c b/gtk/gtkwidget.c
index 348a9de..e3d76d0 100644
--- a/gtk/gtkwidget.c
+++ b/gtk/gtkwidget.c
@@ -925,8 +925,7 @@ static gboolean              setup_template_child              (GtkWidgetTemplat
 
 static void gtk_widget_set_usize_internal (GtkWidget          *widget,
                                           gint                width,
-                                          gint                height,
-                                          GtkQueueResizeFlags flags);
+                                          gint                height);
 
 static void gtk_widget_add_events_internal (GtkWidget *widget,
                                             GdkDevice *device,
@@ -3813,10 +3812,10 @@ gtk_widget_set_property (GObject         *object,
       gtk_container_add (GTK_CONTAINER (g_value_get_object (value)), widget);
       break;
     case PROP_WIDTH_REQUEST:
-      gtk_widget_set_usize_internal (widget, g_value_get_int (value), -2, 0);
+      gtk_widget_set_usize_internal (widget, g_value_get_int (value), -2);
       break;
     case PROP_HEIGHT_REQUEST:
-      gtk_widget_set_usize_internal (widget, -2, g_value_get_int (value), 0);
+      gtk_widget_set_usize_internal (widget, -2, g_value_get_int (value));
       break;
     case PROP_VISIBLE:
       gtk_widget_set_visible (widget, g_value_get_boolean (value));
@@ -5748,7 +5747,7 @@ gtk_widget_queue_resize (GtkWidget *widget)
   if (gtk_widget_get_realized (widget))
     gtk_widget_queue_draw (widget);
 
-  _gtk_size_group_queue_resize (widget, 0);
+  _gtk_size_group_queue_resize (widget);
 }
 
 /**
@@ -5765,7 +5764,7 @@ gtk_widget_queue_resize_no_redraw (GtkWidget *widget)
 {
   g_return_if_fail (GTK_IS_WIDGET (widget));
 
-  _gtk_size_group_queue_resize (widget, 0);
+  _gtk_size_group_queue_resize (widget);
 }
 
 /**
@@ -10957,8 +10956,7 @@ gtk_widget_error_bell (GtkWidget *widget)
 static void
 gtk_widget_set_usize_internal (GtkWidget          *widget,
                               gint                width,
-                              gint                height,
-                              GtkQueueResizeFlags flags)
+                              gint                height)
 {
   GtkWidgetAuxInfo *aux_info;
   gboolean changed = FALSE;
@@ -10969,25 +10967,20 @@ gtk_widget_set_usize_internal (GtkWidget          *widget,
 
   if (width > -2 && aux_info->width != width)
     {
-      if ((flags & GTK_QUEUE_RESIZE_INVALIDATE_ONLY) == 0)
-       g_object_notify (G_OBJECT (widget), "width-request");
+      g_object_notify (G_OBJECT (widget), "width-request");
       aux_info->width = width;
       changed = TRUE;
     }
   if (height > -2 && aux_info->height != height)
     {
-      if ((flags & GTK_QUEUE_RESIZE_INVALIDATE_ONLY) == 0)
-       g_object_notify (G_OBJECT (widget), "height-request");
+      g_object_notify (G_OBJECT (widget), "height-request");
       aux_info->height = height;
       changed = TRUE;
     }
 
   if (gtk_widget_get_visible (widget) && changed)
     {
-      if ((flags & GTK_QUEUE_RESIZE_INVALIDATE_ONLY) == 0)
-       gtk_widget_queue_resize (widget);
-      else
-       _gtk_size_group_queue_resize (widget, GTK_QUEUE_RESIZE_INVALIDATE_ONLY);
+      gtk_widget_queue_resize (widget);
     }
 
   g_object_thaw_notify (G_OBJECT (widget));
@@ -11044,7 +11037,7 @@ gtk_widget_set_size_request (GtkWidget *widget,
   if (height == 0)
     height = 1;
 
-  gtk_widget_set_usize_internal (widget, width, height, 0);
+  gtk_widget_set_usize_internal (widget, width, height);
 }
 
 


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