summaryrefslogtreecommitdiff
path: root/sysdata_darwin.go
diff options
context:
space:
mode:
authorPietro Gagliardi <[email protected]>2014-03-03 17:44:03 -0500
committerPietro Gagliardi <[email protected]>2014-03-03 17:44:03 -0500
commit962a84e056fd524ed458391961510a1c32892895 (patch)
tree515e6e1b6ad5662b99291f8132edc2afd9ca6e91 /sysdata_darwin.go
parent6c3389283138cb4baf5ccc3d5785c318e376f26f (diff)
Fixed Mac OS X control placement flipping. This is done by passing the height of the window around setRect() calls to avoid polling the content view frame each time.
Diffstat (limited to 'sysdata_darwin.go')
-rw-r--r--sysdata_darwin.go6
1 files changed, 4 insertions, 2 deletions
diff --git a/sysdata_darwin.go b/sysdata_darwin.go
index dba7983..eb3a76f 100644
--- a/sysdata_darwin.go
+++ b/sysdata_darwin.go
@@ -346,8 +346,10 @@ func (s *sysData) setText(text string) error {
return nil
}
-func (s *sysData) setRect(x int, y int, width int, height int) error {
- objc_msgSend_rect(s.id, _setFrame, x, y, width, height)
+func (s *sysData) setRect(x int, y int, width int, height int, winheight int) error {
+ // winheight - y because (0,0) is the bottom-left corner of the window and not the top-left corner
+ // (winheight - y) - height because (x, y) is the bottom-left corner of the control and not the top-left
+ objc_msgSend_rect(s.id, _setFrame, x, (winheight - y) - height, width, height)
return nil
}