]> gitweb.factorcode.org Git - factor.git/commitdiff
compilation fixes
authorJoe Groff <arcata@gmail.com>
Fri, 1 May 2009 17:56:52 +0000 (12:56 -0500)
committerJoe Groff <arcata@gmail.com>
Fri, 1 May 2009 17:56:52 +0000 (12:56 -0500)
basis/cocoa/views/views-docs.factor
basis/ui/backend/cocoa/cocoa.factor
basis/ui/gadgets/worlds/worlds.factor
basis/ui/pixel-formats/pixel-formats.factor

index 3b533f98c38a4eed90c0877aa22a5ed8ce119f95..871326fcd452ec328eada84b1cb4bad7531bec33 100644 (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 } ;
index fbc713ac9a435659f9260788d6915b970ab6ac36..8a91dfd94deadbada6274ed2bc02d165776099a3 100755 (executable)
@@ -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 -- )
index d4162fa6306cbfcf7170ee1327f360446662a2f0..0328d453d4f2ab56cff8d07dd168da20b9b89ebe 100644 (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 -- )
index 66de98ea1cb74bc30aecd3dce64a699ac88def0d..3c41926c21b80cdb49ff06a87ea22b31721eddc7 100644 (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 ;