From: Mikko Rasa Date: Tue, 27 Nov 2012 21:52:39 +0000 (+0200) Subject: Don't try to solve if container is smaller than its margins X-Git-Url: http://git.tdb.fi/?p=libs%2Fgltk.git;a=commitdiff_plain;h=76a7cd9ed443c1a6451e6fab98f428f7cce48eed Don't try to solve if container is smaller than its margins Attempting that would cause unsigneds to wrap around to very large values and cause a weird solution. --- diff --git a/source/layout.cpp b/source/layout.cpp index 34afd72..f89e407 100644 --- a/source/layout.cpp +++ b/source/layout.cpp @@ -232,6 +232,10 @@ void Layout::solve_constraints(int dir) { Pointers &ptrs = pointers[dir&VERTICAL]; + const Geometry &geom = container->get_geometry(); + if(geom.*(ptrs.dim)index*5] = 1; row[(*i)->index*5+1] = 1; row[(*i)->index*5+3] = 1; - row.back() = container->get_geometry().*(ptrs.dim)-margin.*(ptrs.high_margin); + row.back() = geom.*(ptrs.dim)-margin.*(ptrs.high_margin); } {