summaryrefslogtreecommitdiff
path: root/gtk/gtksizegroup.c
diff options
context:
space:
mode:
authorBenjamin Otte <otte@redhat.com>2015-09-28 21:08:57 +0200
committerBenjamin Otte <otte@redhat.com>2015-10-28 19:44:28 +0100
commitb5dfe9b833641c1279fd393ec3202374eb01bb23 (patch)
treef780afd61fbfc9c13f5c7fd39a974b84d5f3a273 /gtk/gtksizegroup.c
parenta31123e9f0a12b3eeeaf65f8ea87d1a177aa454a (diff)
downloadgtk+-b5dfe9b833641c1279fd393ec3202374eb01bb23.tar.gz
sizegroup: Simplify widget's size group invalidation
Since we do not queue resizes twice anymore, we can just walk the list of groups without deduplication.
Diffstat (limited to 'gtk/gtksizegroup.c')
-rw-r--r--gtk/gtksizegroup.c68
1 files changed, 25 insertions, 43 deletions
diff --git a/gtk/gtksizegroup.c b/gtk/gtksizegroup.c
index a6e0d1f600..e1c9f46177 100644
--- a/gtk/gtksizegroup.c
+++ b/gtk/gtksizegroup.c
@@ -203,16 +203,23 @@ _gtk_size_group_get_widget_peers (GtkWidget *for_widget,
}
static void
+queue_resize_on_group (GtkSizeGroup *size_group)
+{
+ GtkSizeGroupPrivate *priv = size_group->priv;
+ GSList *list;
+
+ for (list = priv->widgets; list; list = list->next)
+ {
+ gtk_widget_queue_resize (list->data);
+ }
+}
+
+static void
queue_resize_on_widget (GtkWidget *widget,
gboolean check_siblings)
{
- GHashTable *widgets;
- GHashTable *groups;
GtkWidget *parent;
- widgets = g_hash_table_new (NULL, NULL);
- groups = g_hash_table_new (NULL, NULL);
-
parent = widget;
do
@@ -222,34 +229,24 @@ queue_resize_on_widget (GtkWidget *widget,
gtk_widget_queue_resize_on_widget (parent);
- if (!check_siblings || _gtk_widget_get_sizegroups (parent) == NULL)
+ if (!check_siblings)
{
check_siblings = TRUE;
}
else
{
- GHashTableIter iter;
- gpointer current;
-
- g_hash_table_remove_all (widgets);
- g_hash_table_remove_all (groups);
- add_widget_to_closure (widgets, groups, parent, -1);
-
- g_hash_table_iter_init (&iter, widgets);
- while (g_hash_table_iter_next (&iter, &current, NULL))
- {
- if (current == parent)
- {
- /* do nothing */
- }
- else if (current == widget)
- {
- g_warning ("A container and its child are part of this SizeGroup");
- }
- else
- queue_resize_on_widget (current, FALSE);
- }
- }
+ GSList *groups, *l;
+
+ groups = _gtk_widget_get_sizegroups (parent);
+
+ for (l = groups; l; l = l->next)
+ {
+ if (((GtkSizeGroup *) (l->data))->priv->ignore_hidden && !gtk_widget_is_visible (widget))
+ continue;
+
+ queue_resize_on_group (l->data);
+ }
+ }
G_GNUC_BEGIN_IGNORE_DEPRECATIONS;
if (GTK_IS_RESIZE_CONTAINER (parent))
@@ -262,21 +259,6 @@ G_GNUC_END_IGNORE_DEPRECATIONS;
parent = _gtk_widget_get_parent (parent);
}
while (parent);
-
- g_hash_table_destroy (widgets);
- g_hash_table_destroy (groups);
-}
-
-static void
-queue_resize_on_group (GtkSizeGroup *size_group)
-{
- GtkSizeGroupPrivate *priv = size_group->priv;
- GSList *list;
-
- for (list = priv->widgets; list; list = list->next)
- {
- gtk_widget_queue_resize (list->data);
- }
}
static void