summaryrefslogtreecommitdiff
path: root/gtk/gtkconstraintlayout.c
diff options
context:
space:
mode:
authorMatthias Clasen <mclasen@redhat.com>2019-06-29 17:36:47 +0000
committerEmmanuele Bassi <ebassi@gnome.org>2019-07-01 00:10:11 +0100
commit9edf6fb6cb597d014648a10d3ed7b72184b1276c (patch)
treed72630a5e23cc17f6b91a11daa6aaaff4a37ac82 /gtk/gtkconstraintlayout.c
parente3c4fb67cac173e37be320f48566d410eca87fed (diff)
downloadgtk+-9edf6fb6cb597d014648a10d3ed7b72184b1276c.tar.gz
constraint layout: Dont reset constraints in allocate
If trust our allocation algorithm, this can never trigger (and in fact, it never does).
Diffstat (limited to 'gtk/gtkconstraintlayout.c')
-rw-r--r--gtk/gtkconstraintlayout.c67
1 files changed, 0 insertions, 67 deletions
diff --git a/gtk/gtkconstraintlayout.c b/gtk/gtkconstraintlayout.c
index a746491ccb..52c6f86bfa 100644
--- a/gtk/gtkconstraintlayout.c
+++ b/gtk/gtkconstraintlayout.c
@@ -842,7 +842,6 @@ gtk_constraint_layout_allocate (GtkLayoutManager *manager,
GtkConstraintSolver *solver;
GtkConstraintVariable *layout_top, *layout_height;
GtkConstraintVariable *layout_left, *layout_width;
- GPtrArray *size_constraints;
GtkWidget *child;
solver = gtk_constraint_layout_get_solver (self);
@@ -881,62 +880,6 @@ gtk_constraint_layout_allocate (GtkLayoutManager *manager,
gtk_constraint_variable_get_value (layout_width),
gtk_constraint_variable_get_value (layout_height)));
- size_constraints = g_ptr_array_new ();
- gtk_constraint_solver_freeze (solver);
-
- /* We reset the constraints on the size of each child, so we are sure the
- * layout is up to date
- */
- for (child = _gtk_widget_get_first_child (widget);
- child != NULL;
- child = _gtk_widget_get_next_sibling (child))
- {
- GtkConstraintVariable *width_var, *height_var;
- GtkRequisition min_req, nat_req;
- GtkConstraintRef *constraint;
-
- if (!gtk_widget_should_layout (child))
- continue;
-
- gtk_widget_get_preferred_size (child, &min_req, &nat_req);
-
- width_var = get_child_attribute (self, child, GTK_CONSTRAINT_ATTRIBUTE_WIDTH);
-
- constraint =
- gtk_constraint_solver_add_constraint (solver,
- width_var,
- GTK_CONSTRAINT_RELATION_GE,
- gtk_constraint_expression_new (min_req.width),
- GTK_CONSTRAINT_WEIGHT_REQUIRED);
- g_ptr_array_add (size_constraints, constraint);
-
- gtk_constraint_variable_set_value (width_var, nat_req.width);
- constraint =
- gtk_constraint_solver_add_stay_variable (solver,
- width_var,
- GTK_CONSTRAINT_WEIGHT_MEDIUM);
- g_ptr_array_add (size_constraints, constraint);
-
- height_var = get_child_attribute (self, child, GTK_CONSTRAINT_ATTRIBUTE_HEIGHT);
-
- constraint =
- gtk_constraint_solver_add_constraint (solver,
- height_var,
- GTK_CONSTRAINT_RELATION_GE,
- gtk_constraint_expression_new (min_req.height),
- GTK_CONSTRAINT_WEIGHT_REQUIRED);
- g_ptr_array_add (size_constraints, constraint);
-
- gtk_constraint_variable_set_value (height_var, nat_req.height);
- constraint =
- gtk_constraint_solver_add_stay_variable (solver,
- height_var,
- GTK_CONSTRAINT_WEIGHT_MEDIUM);
- g_ptr_array_add (size_constraints, constraint);
- }
-
- gtk_constraint_solver_thaw (solver);
-
for (child = _gtk_widget_get_first_child (widget);
child != NULL;
child = _gtk_widget_get_next_sibling (child))
@@ -1002,16 +945,6 @@ gtk_constraint_layout_allocate (GtkLayoutManager *manager,
}
#endif
- /* The constraints on the children sizes can be removed now */
- for (guint i = 0; i < size_constraints->len; i++)
- {
- GtkConstraintRef *ref = g_ptr_array_index (size_constraints, i);
-
- gtk_constraint_solver_remove_constraint (solver, ref);
- }
-
- g_ptr_array_unref (size_constraints);
-
/* The allocation stay constraints are not needed any more */
gtk_constraint_solver_remove_constraint (solver, stay_w);
gtk_constraint_solver_remove_constraint (solver, stay_h);