diff --git a/basis/cocoa/messages/messages.factor b/basis/cocoa/messages/messages.factor index 7be649416c..ba7034d012 100755 --- a/basis/cocoa/messages/messages.factor +++ b/basis/cocoa/messages/messages.factor @@ -108,12 +108,12 @@ H{ { "c" "char" } { "i" "int" } { "s" "short" } - { "l" "long" } + { "l" "int" } { "q" "longlong" } { "C" "uchar" } { "I" "uint" } { "S" "ushort" } - { "L" "ulong" } + { "L" "uint" } { "Q" "ulonglong" } { "f" "float" } { "d" "double" } @@ -133,14 +133,14 @@ objc>alien-types get [ swap ] assoc-map "ptrdiff_t" heap-size { { 4 [ H{ { "NSPoint" "{_NSPoint=ff}" } - { "NSRect" "{_NSRect=ffff}" } + { "NSRect" "{_NSRect={_NSPoint=ff}{_NSSize=ff}}" } { "NSSize" "{_NSSize=ff}" } { "NSRange" "{_NSRange=II}" } } ] } { 8 [ H{ - { "NSPoint" "{_NSPoint=dd}" } - { "NSRect" "{_NSRect=dddd}" } - { "NSSize" "{_NSSize=dd}" } + { "NSPoint" "{CGPoint=dd}" } + { "NSRect" "{CGRect={CGPoint=dd}{CGSize=dd}}" } + { "NSSize" "{CGSize=dd}" } { "NSRange" "{_NSRange=QQ}" } } ] } } case diff --git a/basis/cocoa/types/types.factor b/basis/cocoa/types/types.factor index 6e65bc1a72..acc717a61c 100644 --- a/basis/cocoa/types/types.factor +++ b/basis/cocoa/types/types.factor @@ -10,25 +10,6 @@ TYPEDEF: ulong NSUInteger { 8 [ "double" ] } } case "CGFloat" typedef >> -C-STRUCT: NSRect - { "CGFloat" "x" } - { "CGFloat" "y" } - { "CGFloat" "w" } - { "CGFloat" "h" } ; - -TYPEDEF: NSRect _NSRect -TYPEDEF: NSRect CGRect - -: ( x y w h -- rect ) - "NSRect" - [ set-NSRect-h ] keep - [ set-NSRect-w ] keep - [ set-NSRect-y ] keep - [ set-NSRect-x ] keep ; - -: NSRect-x-y ( alien -- origin-x origin-y ) - [ NSRect-x ] keep NSRect-y ; - C-STRUCT: NSPoint { "CGFloat" "x" } { "CGFloat" "y" } ; @@ -53,6 +34,41 @@ TYPEDEF: NSPoint CGPoint [ set-NSSize-h ] keep [ set-NSSize-w ] keep ; +C-STRUCT: NSRect + { "NSPoint" "origin" } + { "NSSize" "size" } ; + +TYPEDEF: NSRect _NSRect +TYPEDEF: NSRect CGRect + +: NSRect-x ( NSRect -- x ) + NSRect-origin NSPoint-x ; inline +: NSRect-y ( NSRect -- y ) + NSRect-origin NSPoint-y ; inline +: NSRect-w ( NSRect -- w ) + NSRect-size NSSize-w ; inline +: NSRect-h ( NSRect -- h ) + NSRect-size NSSize-h ; inline + +: set-NSRect-x ( x NSRect -- ) + NSRect-origin set-NSPoint-x ; inline +: set-NSRect-y ( y NSRect -- ) + NSRect-origin set-NSPoint-y ; inline +: set-NSRect-w ( w NSRect -- ) + NSRect-size set-NSSize-w ; inline +: set-NSRect-h ( h NSRect -- ) + NSRect-size set-NSSize-h ; inline + +: ( x y w h -- rect ) + "NSRect" + [ set-NSRect-h ] keep + [ set-NSRect-w ] keep + [ set-NSRect-y ] keep + [ set-NSRect-x ] keep ; + +: NSRect-x-y ( alien -- origin-x origin-y ) + [ NSRect-x ] keep NSRect-y ; + C-STRUCT: NSRange { "NSUInteger" "location" } { "NSUInteger" "length" } ; diff --git a/basis/ui/cocoa/views/views.factor b/basis/ui/cocoa/views/views.factor index 45ab8ac0ce..772770133d 100755 --- a/basis/ui/cocoa/views/views.factor +++ b/basis/ui/cocoa/views/views.factor @@ -128,8 +128,8 @@ CLASS: { } ! Rendering -{ "drawRect:" "void" { "id" "SEL" "id" "NSRect" } - [ 3drop window relayout-1 ] +{ "drawRect:" "void" { "id" "SEL" "NSRect" } + [ 2drop window relayout-1 ] } ! Events