[gtk/constraint-guide-3] constraint solver: Fix repeat suggestions
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk/constraint-guide-3] constraint solver: Fix repeat suggestions
- Date: Fri, 28 Jun 2019 17:12:00 +0000 (UTC)
commit 49897bdce859174268d16d5913368c41e0ee3aea
Author: Matthias Clasen <mclasen redhat com>
Date: Fri Jun 28 16:59:39 2019 +0000
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.
gtk/gtkconstraintsolver.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
---
diff --git a/gtk/gtkconstraintsolver.c b/gtk/gtkconstraintsolver.c
index 1516a08675..e29c7665fc 100644
--- a/gtk/gtkconstraintsolver.c
+++ b/gtk/gtkconstraintsolver.c
@@ -1973,6 +1973,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",
@@ -1988,9 +1989,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 >
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]