Fixed Mac OS X so that window sizes do not include the titlebar and frame.
This commit is contained in:
parent
fb50badf00
commit
3bb9f41305
|
@ -172,6 +172,11 @@ struct xsize objc_msgSend_stret_size_noargs(id obj, SEL sel)
|
|||
return t;
|
||||
}
|
||||
|
||||
id objc_msgSend_size(id obj, SEL sel, int64_t width, int64_t height)
|
||||
{
|
||||
return objc_msgSend(obj, sel, NSMakeSize((CGFloat) width, (CGFloat) height));
|
||||
}
|
||||
|
||||
/*
|
||||
and again for NSPoint
|
||||
*/
|
||||
|
|
|
@ -88,13 +88,14 @@ m1(ptr, void *)
|
|||
m1(bool, BOOL)
|
||||
extern id objc_msgSend_int(id obj, SEL sel, intptr_t a);
|
||||
m1(double, double)
|
||||
extern id objc_msgSend_point(id obj, SEL sel, int64_t x, int64_t y);
|
||||
extern id objc_msgSend_size(id objc, SEL sel, int64_t width, int64_t height);
|
||||
|
||||
m2(id_id, id, id)
|
||||
extern id objc_msgSend_rect_bool(id obj, SEL sel, int64_t x, int64_t y, int64_t w, int64_t h, BOOL b);
|
||||
extern id objc_msgSend_id_int(id obj, SEL sel, id a, intptr_t b);
|
||||
extern id objc_msgSend_id_uint(id obj, SEL sel, id a, uintptr_t b);
|
||||
m2(id_bool, id, BOOL)
|
||||
extern id objc_msgSend_point(id obj, SEL sel, int64_t x, int64_t y);
|
||||
|
||||
m3(id_id_id, id, id, id)
|
||||
m3(sel_id_bool, SEL, id, BOOL)
|
||||
|
|
|
@ -60,7 +60,7 @@ var (
|
|||
_title = sel_getUid("title")
|
||||
_stringValue = sel_getUid("stringValue")
|
||||
_frame = sel_getUid("frame")
|
||||
_setFrameDisplay = sel_getUid("setFrame:display:")
|
||||
_setContentSize = sel_getUid("setContentSize:")
|
||||
_setBezelStyle = sel_getUid("setBezelStyle:")
|
||||
_setTarget = sel_getUid("setTarget:")
|
||||
_setAction = sel_getUid("setAction:")
|
||||
|
@ -519,11 +519,9 @@ func (s *sysData) setWindowSize(width int, height int) error {
|
|||
ret := make(chan struct{})
|
||||
defer close(ret)
|
||||
uitask <- func() {
|
||||
// we need to get the top left point
|
||||
r := C.objc_msgSend_stret_rect_noargs(s.id, _frame)
|
||||
C.objc_msgSend_rect_bool(s.id, _setFrameDisplay,
|
||||
C.int64_t(r.x), C.int64_t(r.y), C.int64_t(width), C.int64_t(height),
|
||||
C.BOOL(C.YES)) // TODO set to NO to prevent subviews from being redrawn before they are resized?
|
||||
C.objc_msgSend_size(s.id, _setContentSize,
|
||||
C.int64_t(width), C.int64_t(height))
|
||||
C.objc_msgSend_noargs(s.id, _display) // TODO needed?
|
||||
ret <- struct{}{}
|
||||
}
|
||||
<-ret
|
||||
|
|
Loading…
Reference in New Issue