compilation fixes
parent
ba8abd6cad
commit
b45ea14d39
|
@ -1,13 +1,9 @@
|
||||||
USING: help.syntax help.markup ;
|
USING: help.syntax help.markup ui.pixel-formats ;
|
||||||
IN: cocoa.views
|
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>
|
HELP: <GLView>
|
||||||
{ $values { "class" "an subclass of " { $snippet "NSOpenGLView" } } { "dim" "a pair of real numbers" } { "view" "a new " { $snippet "NSOpenGLView" } } }
|
{ $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 a default pixel format and the given size." } ;
|
{ $description "Creates a new instance of the specified class, giving it the specified pixel format and size." } ;
|
||||||
|
|
||||||
HELP: view-dim
|
HELP: view-dim
|
||||||
{ $values { "view" "an " { $snippet "NSView" } } { "dim" "a pair of real numbers" } }
|
{ $values { "view" "an " { $snippet "NSView" } } { "dim" "a pair of real numbers" } }
|
||||||
|
@ -18,7 +14,6 @@ HELP: mouse-location
|
||||||
{ $description "Outputs the current mouse location." } ;
|
{ $description "Outputs the current mouse location." } ;
|
||||||
|
|
||||||
ARTICLE: "cocoa-view-utils" "Cocoa view utilities"
|
ARTICLE: "cocoa-view-utils" "Cocoa view utilities"
|
||||||
{ $subsection <PixelFormat> }
|
|
||||||
{ $subsection <GLView> }
|
{ $subsection <GLView> }
|
||||||
{ $subsection view-dim }
|
{ $subsection view-dim }
|
||||||
{ $subsection mouse-location } ;
|
{ $subsection mouse-location } ;
|
||||||
|
|
|
@ -1,15 +1,15 @@
|
||||||
! Copyright (C) 2006, 2009 Slava Pestov.
|
! Copyright (C) 2006, 2009 Slava Pestov.
|
||||||
! See http://factorcode.org/license.txt for BSD license.
|
! See http://factorcode.org/license.txt for BSD license.
|
||||||
USING: accessors math arrays assocs cocoa cocoa.application
|
USING: accessors alien.c-types arrays assocs classes cocoa
|
||||||
command-line kernel memory namespaces cocoa.messages classes
|
cocoa.application cocoa.classes cocoa.messages cocoa.nibs
|
||||||
cocoa.runtime cocoa.subclassing cocoa.pasteboard cocoa.types
|
cocoa.pasteboard cocoa.runtime cocoa.subclassing cocoa.types
|
||||||
cocoa.windows cocoa.classes cocoa.nibs sequences ui ui.private
|
cocoa.views cocoa.windows combinators command-line
|
||||||
ui.backend ui.clipboards ui.gadgets ui.gadgets.worlds
|
core-foundation core-foundation.run-loop core-graphics
|
||||||
ui.backend.cocoa.views core-foundation core-foundation.run-loop
|
core-graphics.types destructors fry generalizations io.thread
|
||||||
core-graphics.types threads math.rectangles fry libc
|
kernel libc literals locals math math.rectangles memory
|
||||||
generalizations alien.c-types cocoa.views
|
namespaces sequences specialized-arrays.int threads ui
|
||||||
combinators io.thread locals ui.pixel-formats
|
ui.backend ui.backend.cocoa.views ui.clipboards ui.gadgets
|
||||||
specialized-arrays.int literals core-graphics ;
|
ui.gadgets.worlds ui.pixel-formats ui.private words.symbol ;
|
||||||
IN: ui.backend.cocoa
|
IN: ui.backend.cocoa
|
||||||
|
|
||||||
TUPLE: handle ;
|
TUPLE: handle ;
|
||||||
|
@ -56,12 +56,12 @@ M: symbol >NSOpenGLPFA
|
||||||
M: pixel-format-attribute >NSOpenGLPFA
|
M: pixel-format-attribute >NSOpenGLPFA
|
||||||
dup class attribute>NSOpenGLPFA-map at
|
dup class attribute>NSOpenGLPFA-map at
|
||||||
[ swap value>> suffix ]
|
[ swap value>> suffix ]
|
||||||
[ drop { } ] if ;
|
[ drop { } ] if* ;
|
||||||
|
|
||||||
PRIVATE>
|
PRIVATE>
|
||||||
|
|
||||||
M: cocoa-ui-backend (make-pixel-format)
|
M: cocoa-ui-backend (make-pixel-format)
|
||||||
[ >NSOpenGLPFA ] map concat >int-array
|
[ >NSOpenGLPFA ] map concat 0 suffix >int-array
|
||||||
NSOpenGLPixelFormat -> alloc swap -> initWithAttributes: ;
|
NSOpenGLPixelFormat -> alloc swap -> initWithAttributes: ;
|
||||||
|
|
||||||
M: cocoa-ui-backend (free-pixel-format)
|
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)
|
M: cocoa-ui-backend (pixel-format-attribute)
|
||||||
attribute>NSOpenGLPFA-map at
|
attribute>NSOpenGLPFA-map at
|
||||||
[ first 0 <int> [ swap 0 -> getValues:forAttribute:forVirtualScreen: ] keep *int ]
|
[ first 0 <int> [ swap 0 -> getValues:forAttribute:forVirtualScreen: ] keep *int ]
|
||||||
[ f ] if* ;
|
[ drop f ] if* ;
|
||||||
|
|
||||||
TUPLE: pasteboard handle ;
|
TUPLE: pasteboard handle ;
|
||||||
|
|
||||||
|
@ -122,7 +122,8 @@ M: cocoa-ui-backend fullscreen* ( world -- ? )
|
||||||
handle>> view>> -> isInFullScreenMode zero? not ;
|
handle>> view>> -> isInFullScreenMode zero? not ;
|
||||||
|
|
||||||
M:: cocoa-ui-backend (open-window) ( world -- )
|
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 world world>NSRect <ViewWindow> :> window
|
||||||
view -> release
|
view -> release
|
||||||
world view register-window
|
world view register-window
|
||||||
|
@ -160,7 +161,8 @@ M: cocoa-ui-backend raise-window* ( world -- )
|
||||||
<pixel-format> [
|
<pixel-format> [
|
||||||
:> pf
|
:> pf
|
||||||
NSOpenGLContext -> alloc pf handle>> f -> initWithFormat:shareContext:
|
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 ;
|
] with-disposal ;
|
||||||
|
|
||||||
M: cocoa-ui-backend (open-offscreen-buffer) ( world -- )
|
M: cocoa-ui-backend (open-offscreen-buffer) ( world -- )
|
||||||
|
|
|
@ -153,6 +153,7 @@ M: world handle-gesture ( gesture gadget -- ? )
|
||||||
GENERIC: world-pixel-format-attributes ( world -- attributes )
|
GENERIC: world-pixel-format-attributes ( world -- attributes )
|
||||||
|
|
||||||
M: world world-pixel-format-attributes
|
M: world world-pixel-format-attributes
|
||||||
|
drop
|
||||||
{ windowed double-buffered T{ depth-bits { value 16 } } } ;
|
{ windowed double-buffered T{ depth-bits { value 16 } } } ;
|
||||||
|
|
||||||
: with-world-pixel-format ( world quot -- )
|
: with-world-pixel-format ( world quot -- )
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
USING: destructors math ui.backend ;
|
USING: accessors destructors kernel math ui.backend ;
|
||||||
IN: ui.pixel-formats
|
IN: ui.pixel-formats
|
||||||
|
|
||||||
SYMBOLS:
|
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: (free-pixel-format) ui-backend ( pixel-format-handle -- )
|
||||||
HOOK: (pixel-format-attribute) ui-backend ( pixel-format-handle attribute-name -- value )
|
HOOK: (pixel-format-attribute) ui-backend ( pixel-format-handle attribute-name -- value )
|
||||||
|
|
||||||
|
ERROR: invalid-pixel-format-attributes attributes ;
|
||||||
|
|
||||||
TUPLE: pixel-format { handle read-only } ;
|
TUPLE: pixel-format { handle read-only } ;
|
||||||
|
|
||||||
: <pixel-format> ( attributes -- pixel-format )
|
: <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
|
M: pixel-format dispose
|
||||||
[ [ (free-pixel-format) ] when* f ] change-handle drop ;
|
[ [ (free-pixel-format) ] when* f ] change-handle drop ;
|
||||||
|
|
Loading…
Reference in New Issue