]> git.tdb.fi Git - libs/gltk.git/commitdiff
The slack column counter needs to be outside the slot loop
authorMikko Rasa <tdb@tdb.fi>
Thu, 27 Jun 2013 13:36:09 +0000 (16:36 +0300)
committerMikko Rasa <tdb@tdb.fi>
Thu, 27 Jun 2013 13:36:09 +0000 (16:36 +0300)
source/layout.cpp

index 7902902abf2541082b0d455de9a185145545a84c..5ebb55ccf4f8822de2423427d4c795c8d906ecf8 100644 (file)
@@ -340,6 +340,7 @@ void Layout::solve_constraints(int dir, SolveMode mode)
        remaining three are slack columns; see below for their purposes. */
        LinearProgram linprog(n_active_slots*5+n_slack_constraints[dir]+1);
        float weight = slots.size();
        remaining three are slack columns; see below for their purposes. */
        LinearProgram linprog(n_active_slots*5+n_slack_constraints[dir]+1);
        float weight = slots.size();
+       unsigned k = n_active_slots*5;
        for(list<Slot *>::iterator i=slots.begin(); i!=slots.end(); ++i)
        {
                if((*i)->index<0)
        for(list<Slot *>::iterator i=slots.begin(); i!=slots.end(); ++i)
        {
                if((*i)->index<0)
@@ -396,7 +397,6 @@ void Layout::solve_constraints(int dir, SolveMode mode)
 
                /* Add rows for user-defined constraints.  Constraints are always added
                in pairs, so it's only necessary to create a row for one half. */
 
                /* Add rows for user-defined constraints.  Constraints are always added
                in pairs, so it's only necessary to create a row for one half. */
-               unsigned k = n_active_slots*5;
                for(list<Constraint>::iterator j=(*i)->constraints.begin(); j!=(*i)->constraints.end(); ++j)
                        if(j->target.index>(*i)->index && (j->type&1)==dir)
                        {
                for(list<Constraint>::iterator j=(*i)->constraints.begin(); j!=(*i)->constraints.end(); ++j)
                        if(j->target.index>(*i)->index && (j->type&1)==dir)
                        {