summaryrefslogtreecommitdiff
path: root/stack.go
diff options
context:
space:
mode:
authorPietro Gagliardi <[email protected]>2014-03-17 20:42:36 -0400
committerPietro Gagliardi <[email protected]>2014-03-17 20:42:36 -0400
commit19227080da161bc96e4cc8ed447059cefbca8a6a (patch)
tree818f4d443f469ee962268449d86ca406a7399514 /stack.go
parentc078266c6d091610eb3acddd68090ee697142315 (diff)
Changed window resizes so that the actual Control.setRect() functions appended to an array of requests that the resize() function set all at once instead of having each done individually. This will be necessary for what I think will be a solution to the deadlocks. It doesn't work right now; I'm assuming it's allocating too much memory. I know how to fix this, but I'm committing what I have so far to be safe.
Diffstat (limited to 'stack.go')
-rw-r--r--stack.go9
1 files changed, 3 insertions, 6 deletions
diff --git a/stack.go b/stack.go
index b37b935..2820ef7 100644
--- a/stack.go
+++ b/stack.go
@@ -77,7 +77,7 @@ func (s *Stack) make(window *sysData) error {
return nil
}
-func (s *Stack) setRect(x int, y int, width int, height int, winheight int) error {
+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
@@ -120,17 +120,14 @@ func (s *Stack) setRect(x int, y int, width int, height int, winheight int) erro
}
// 3) now actually place controls
for i, c := range s.controls {
- err := c.setRect(x, y, s.width[i], s.height[i], winheight)
- if err != nil {
- return fmt.Errorf("error setting size of control %d in Stack.setRect(): %v", i, err)
- }
+ rr = append(rr, c.setRect(x, y, s.width[i], s.height[i])...)
if s.orientation == horizontal {
x += s.width[i]
} else {
y += s.height[i]
}
}
- return nil
+ return rr
}
// 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).