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 ;
+ui.gadgets.worlds ui.pixel-formats ui.pixel-formats.private
+ui.private words.symbol ;
IN: ui.backend.cocoa
TUPLE: handle ;
<PRIVATE
-GENERIC: >NSOpenGLPFA ( attribute -- NSOpenGLPFAs )
-
-CONSTANT: attribute>NSOpenGLPFA-map H{
+PIXEL-FORMAT-ATTRIBUTE-TABLE: NSOpenGLPFA H{
{ double-buffered { $ NSOpenGLPFADoubleBuffer } }
{ stereo { $ NSOpenGLPFAStereo } }
{ offscreen { $ NSOpenGLPFAOffScreen } }
{ samples { $ NSOpenGLPFASamples } }
}
-M: object >NSOpenGLPFA
- drop { } ;
-M: symbol >NSOpenGLPFA
- attribute>NSOpenGLPFA-map at [ { } ] unless* ;
-M: pixel-format-attribute >NSOpenGLPFA
- dup class attribute>NSOpenGLPFA-map at
- [ swap value>> suffix ]
- [ drop { } ] if* ;
-
PRIVATE>
M: cocoa-ui-backend (make-pixel-format)
- [ >NSOpenGLPFA ] map concat 0 suffix >int-array
+ >NSOpenGLPFA-int-array
NSOpenGLPixelFormat -> alloc swap -> initWithAttributes: ;
M: cocoa-ui-backend (free-pixel-format)
-> release ;
M: cocoa-ui-backend (pixel-format-attribute)
- attribute>NSOpenGLPFA-map at
+ >NSOpenGLPFA
+ [ drop f ]
[ first 0 <int> [ swap 0 -> getValues:forAttribute:forVirtualScreen: ] keep *int ]
- [ drop f ] if* ;
+ if-empty ;
TUPLE: pasteboard handle ;
-USING: accessors destructors kernel math ui.backend ;
+USING: accessors assocs classes destructors functors kernel
+lexer math parser sequences specialized-arrays.int ui.backend
+words.symbol ;
IN: ui.pixel-formats
SYMBOLS:
: pixel-format-attribute ( pixel-format attribute-name -- value )
[ handle>> ] dip (pixel-format-attribute) ;
+<PRIVATE
+
+FUNCTOR: define-pixel-format-attribute-table ( NAME TABLE -- )
+
+>PFA DEFINES >${NAME}
+>PFA-int-array DEFINES >${NAME}-int-array
+
+WHERE
+
+GENERIC: >PFA ( attribute -- pfas )
+
+M: object >PFA
+ drop { } ;
+M: symbol >PFA
+ TABLE at [ { } ] unless* ;
+M: pixel-format-attribute >PFA
+ dup class TABLE at
+ [ swap value>> suffix ]
+ [ drop { } ] if* ;
+
+: >PFA-int-array ( attribute -- int-array )
+ [ >PFA ] map concat 0 suffix >int-array ;
+
+;FUNCTOR
+
+SYNTAX: PIXEL-FORMAT-ATTRIBUTE-TABLE:
+ scan scan-object define-pixel-format-attribute-table ;
+
+PRIVATE>