diff options
author | Matthias Clasen <mclasen@redhat.com> | 2019-06-28 16:59:39 +0000 |
---|---|---|
committer | Emmanuele Bassi <ebassi@gnome.org> | 2019-07-01 00:10:11 +0100 |
commit | 3d3a672deb22899d94e22b10939341c418e7bb5d (patch) | |
tree | 3f083fa7aa2db908fa691a5a2fdbe750eb85f02f /gtk/gtkconstraintsolver.c | |
parent | 2f97134a082f87d5212dffc3521344a4b318de22 (diff) | |
download | gtk+-3d3a672deb22899d94e22b10939341c418e7bb5d.tar.gz |
constraint solver: Fix repeat suggestions
We were not storing the previous value, causing
the first two suggestions to work, but not later
ones.
Fixes the test added in the previous commit.
Diffstat (limited to 'gtk/gtkconstraintsolver.c')
-rw-r--r-- | gtk/gtkconstraintsolver.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/gtk/gtkconstraintsolver.c b/gtk/gtkconstraintsolver.c index 3c3a5289f3..8c0fe08669 100644 --- a/gtk/gtkconstraintsolver.c +++ b/gtk/gtkconstraintsolver.c @@ -1971,6 +1971,7 @@ gtk_constraint_solver_suggest_value (GtkConstraintSolver *self, double value) { EditInfo *ei = g_hash_table_lookup (self->edit_var_map, variable); + double delta; if (ei == NULL) { g_critical ("Suggesting value '%g' but variable %p is not editable", @@ -1986,9 +1987,10 @@ gtk_constraint_solver_suggest_value (GtkConstraintSolver *self, return; } - ei->prev_constant = value - ei->prev_constant; + delta = value - ei->prev_constant; + ei->prev_constant = value; - gtk_constraint_solver_delta_edit_constant (self, ei->prev_constant, ei->eplus, ei->eminus); + gtk_constraint_solver_delta_edit_constant (self, delta, ei->eplus, ei->eminus); } /*< private > |