diff options
| author | Pietro Gagliardi <[email protected]> | 2014-03-17 21:09:03 -0400 |
|---|---|---|
| committer | Pietro Gagliardi <[email protected]> | 2014-03-17 21:09:03 -0400 |
| commit | 64d5eb541eb28e1a7e81adca66a72155d16033b4 (patch) | |
| tree | 7db7c7ee787afc02823833340c3a2d0068807117 /stack.go | |
| parent | c1807033733654db480e782acebdccda9eababc6 (diff) | |
Changed the new resizing code so that it uses the same allocated slice per window instead of making a new one to store all the resize requests each time.
Diffstat (limited to 'stack.go')
| -rw-r--r-- | stack.go | 8 |
1 files changed, 4 insertions, 4 deletions
@@ -77,11 +77,11 @@ func (s *Stack) make(window *sysData) error { return nil } -func (s *Stack) setRect(x int, y int, width int, height int) (rr []resizerequest) { +func (s *Stack) setRect(x int, y int, width int, height int, rr *[]resizerequest) { var stretchywid, stretchyht int if len(s.controls) == 0 { // do nothing if there's nothing to do - return nil + return } // 1) get height and width of non-stretchy controls; figure out how much space is alloted to stretchy controls stretchywid = width @@ -120,14 +120,14 @@ func (s *Stack) setRect(x int, y int, width int, height int) (rr []resizerequest } // 3) now actually place controls for i, c := range s.controls { - rr = append(rr, c.setRect(x, y, s.width[i], s.height[i])...) + c.setRect(x, y, s.width[i], s.height[i], rr) if s.orientation == horizontal { x += s.width[i] } else { y += s.height[i] } } - return rr + return } // The preferred size of a Stack is the sum of the preferred sizes of non-stretchy controls + (the number of stretchy controls * the largest preferred size among all stretchy controls). |
