compilation fixes

db4
Joe Groff 2009-05-01 12:56:52 -05:00
parent ba8abd6cad
commit b45ea14d39
4 changed files with 26 additions and 25 deletions

View File

@ -1,13 +1,9 @@
USING: help.syntax help.markup ;
USING: help.syntax help.markup ui.pixel-formats ;
IN: cocoa.views
HELP: <PixelFormat>
{ $values { "attributes" "a sequence of attributes" } { "pixelfmt" "an " { $snippet "NSOpenGLPixelFormat" } } }
{ $description "Creates an " { $snippet "NSOpenGLPixelFormat" } " with some reasonable defaults." } ;
HELP: <GLView>
{ $values { "class" "an subclass of " { $snippet "NSOpenGLView" } } { "dim" "a pair of real numbers" } { "view" "a new " { $snippet "NSOpenGLView" } } }
{ $description "Creates a new instance of the specified class, giving it a default pixel format and the given size." } ;
{ $values { "class" "an subclass of " { $snippet "NSOpenGLView" } } { "dim" "a pair of real numbers" } { "pixel-format" pixel-format } { "view" "a new " { $snippet "NSOpenGLView" } } }
{ $description "Creates a new instance of the specified class, giving it the specified pixel format and size." } ;
HELP: view-dim
{ $values { "view" "an " { $snippet "NSView" } } { "dim" "a pair of real numbers" } }
@ -18,7 +14,6 @@ HELP: mouse-location
{ $description "Outputs the current mouse location." } ;
ARTICLE: "cocoa-view-utils" "Cocoa view utilities"
{ $subsection <PixelFormat> }
{ $subsection <GLView> }
{ $subsection view-dim }
{ $subsection mouse-location } ;

View File

@ -1,15 +1,15 @@
! Copyright (C) 2006, 2009 Slava Pestov.
! See http://factorcode.org/license.txt for BSD license.
USING: accessors math arrays assocs cocoa cocoa.application
command-line kernel memory namespaces cocoa.messages classes
cocoa.runtime cocoa.subclassing cocoa.pasteboard cocoa.types
cocoa.windows cocoa.classes cocoa.nibs sequences ui ui.private
ui.backend ui.clipboards ui.gadgets ui.gadgets.worlds
ui.backend.cocoa.views core-foundation core-foundation.run-loop
core-graphics.types threads math.rectangles fry libc
generalizations alien.c-types cocoa.views
combinators io.thread locals ui.pixel-formats
specialized-arrays.int literals core-graphics ;
USING: accessors alien.c-types arrays assocs classes cocoa
cocoa.application cocoa.classes cocoa.messages cocoa.nibs
cocoa.pasteboard cocoa.runtime cocoa.subclassing cocoa.types
cocoa.views cocoa.windows combinators command-line
core-foundation core-foundation.run-loop core-graphics
core-graphics.types destructors fry generalizations io.thread
kernel libc literals locals math math.rectangles memory
namespaces sequences specialized-arrays.int threads ui
ui.backend ui.backend.cocoa.views ui.clipboards ui.gadgets
ui.gadgets.worlds ui.pixel-formats ui.private words.symbol ;
IN: ui.backend.cocoa
TUPLE: handle ;
@ -56,12 +56,12 @@ M: symbol >NSOpenGLPFA
M: pixel-format-attribute >NSOpenGLPFA
dup class attribute>NSOpenGLPFA-map at
[ swap value>> suffix ]
[ drop { } ] if ;
[ drop { } ] if* ;
PRIVATE>
M: cocoa-ui-backend (make-pixel-format)
[ >NSOpenGLPFA ] map concat >int-array
[ >NSOpenGLPFA ] map concat 0 suffix >int-array
NSOpenGLPixelFormat -> alloc swap -> initWithAttributes: ;
M: cocoa-ui-backend (free-pixel-format)
@ -70,7 +70,7 @@ M: cocoa-ui-backend (free-pixel-format)
M: cocoa-ui-backend (pixel-format-attribute)
attribute>NSOpenGLPFA-map at
[ first 0 <int> [ swap 0 -> getValues:forAttribute:forVirtualScreen: ] keep *int ]
[ f ] if* ;
[ drop f ] if* ;
TUPLE: pasteboard handle ;
@ -122,7 +122,8 @@ M: cocoa-ui-backend fullscreen* ( world -- ? )
handle>> view>> -> isInFullScreenMode zero? not ;
M:: cocoa-ui-backend (open-window) ( world -- )
[ [ dim>> ] dip <FactorView> ] with-world-pixel-format :> view
world [ [ dim>> ] dip <FactorView> ]
with-world-pixel-format :> view
view world world>NSRect <ViewWindow> :> window
view -> release
world view register-window
@ -160,7 +161,8 @@ M: cocoa-ui-backend raise-window* ( world -- )
<pixel-format> [
:> pf
NSOpenGLContext -> alloc pf handle>> f -> initWithFormat:shareContext:
dup world pf offscreen-buffer -> setOffScreen:width:height:rowbytes:
dup world pf offscreen-buffer
4 npick [ -> setOffScreen:width:height:rowbytes: ] dip
] with-disposal ;
M: cocoa-ui-backend (open-offscreen-buffer) ( world -- )

View File

@ -153,6 +153,7 @@ M: world handle-gesture ( gesture gadget -- ? )
GENERIC: world-pixel-format-attributes ( world -- attributes )
M: world world-pixel-format-attributes
drop
{ windowed double-buffered T{ depth-bits { value 16 } } } ;
: with-world-pixel-format ( world quot -- )

View File

@ -1,4 +1,4 @@
USING: destructors math ui.backend ;
USING: accessors destructors kernel math ui.backend ;
IN: ui.pixel-formats
SYMBOLS:
@ -45,10 +45,13 @@ HOOK: (make-pixel-format) ui-backend ( attributes -- pixel-format-handle )
HOOK: (free-pixel-format) ui-backend ( pixel-format-handle -- )
HOOK: (pixel-format-attribute) ui-backend ( pixel-format-handle attribute-name -- value )
ERROR: invalid-pixel-format-attributes attributes ;
TUPLE: pixel-format { handle read-only } ;
: <pixel-format> ( attributes -- pixel-format )
(make-pixel-format) pixel-format boa ;
dup (make-pixel-format)
[ nip pixel-format boa ] [ invalid-pixel-format-attributes ] if* ;
M: pixel-format dispose
[ [ (free-pixel-format) ] when* f ] change-handle drop ;