ui.pixel-formats,ui.backend.*: new word pixel-format-attributes>int-array
This word replaces usages of the PIXEL-FORMAT-ATTRIBUTE-TABLE: syntaxchar-rename
parent
1b1842f62d
commit
4756c30d3f
|
@ -362,15 +362,11 @@ CONSTANT: window-controls>func-flags
|
|||
] 2tri ;
|
||||
|
||||
! OpenGL and Pixel formats
|
||||
CONSTANT: perm-attribs ${ GDK_GL_USE_GL GDK_GL_RGBA }
|
||||
|
||||
PIXEL-FORMAT-ATTRIBUTE-TABLE: gl-config-attribs
|
||||
${ GDK_GL_USE_GL GDK_GL_RGBA }
|
||||
H{
|
||||
CONSTANT: attrib-table H{
|
||||
{ double-buffered ${ GDK_GL_DOUBLEBUFFER } }
|
||||
{ stereo ${ GDK_GL_STEREO } }
|
||||
! { offscreen ${ GDK_GL_DRAWABLE_TYPE 2 } }
|
||||
! { fullscreen ${ GDK_GL_DRAWABLE_TYPE 1 } }
|
||||
! { windowed ${ GDK_GL_DRAWABLE_TYPE 1 } }
|
||||
{ color-bits ${ GDK_GL_BUFFER_SIZE } }
|
||||
{ red-bits ${ GDK_GL_RED_SIZE } }
|
||||
{ green-bits ${ GDK_GL_GREEN_SIZE } }
|
||||
|
@ -385,10 +381,11 @@ PIXEL-FORMAT-ATTRIBUTE-TABLE: gl-config-attribs
|
|||
{ aux-buffers ${ GDK_GL_AUX_BUFFERS } }
|
||||
{ sample-buffers ${ GDK_GL_SAMPLE_BUFFERS } }
|
||||
{ samples ${ GDK_GL_SAMPLES } }
|
||||
}
|
||||
}
|
||||
|
||||
M: gtk-ui-backend (make-pixel-format)
|
||||
nip >gl-config-attribs-int-array gdk_gl_config_new ;
|
||||
nip perm-attribs attrib-table
|
||||
pixel-format-attributes>int-array gdk_gl_config_new ;
|
||||
|
||||
M: gtk-ui-backend (free-pixel-format)
|
||||
handle>> g_object_unref ;
|
||||
|
|
|
@ -6,8 +6,8 @@ environment io.encodings.ascii io.encodings.string io.encodings.utf8
|
|||
kernel literals locals math namespaces sequences specialized-arrays
|
||||
strings ui ui.backend ui.backend.x11.keys ui.clipboards ui.event-loop
|
||||
ui.gadgets ui.gadgets.private ui.gadgets.worlds ui.gestures
|
||||
ui.pixel-formats ui.pixel-formats.private ui.private x11 x11.X
|
||||
x11.clipboard x11.events x11.glx x11.io x11.windows x11.xim x11.xlib ;
|
||||
ui.pixel-formats ui.private x11 x11.X x11.clipboard x11.events x11.glx
|
||||
x11.io x11.windows x11.xim x11.xlib ;
|
||||
FROM: libc => system ;
|
||||
SPECIALIZED-ARRAYS: uchar ulong ;
|
||||
IN: ui.backend.x11
|
||||
|
@ -68,7 +68,8 @@ M: world configure-event
|
|||
! In case dimensions didn't change
|
||||
relayout-1 ;
|
||||
|
||||
PIXEL-FORMAT-ATTRIBUTE-TABLE: glx-visual { $ GLX_RGBA } H{
|
||||
CONSTANT: perm-attribs { $ GLX_RGBA }
|
||||
CONSTANT: attrib-table H{
|
||||
{ double-buffered { $ GLX_DOUBLEBUFFER } }
|
||||
{ stereo { $ GLX_STEREO } }
|
||||
{ color-bits { $ GLX_BUFFER_SIZE } }
|
||||
|
@ -88,8 +89,8 @@ PIXEL-FORMAT-ATTRIBUTE-TABLE: glx-visual { $ GLX_RGBA } H{
|
|||
}
|
||||
|
||||
M: x11-ui-backend (make-pixel-format)
|
||||
[ drop dpy get scr get ] dip
|
||||
>glx-visual-int-array glXChooseVisual ;
|
||||
[ drop dpy get scr get ] dip perm-attribs attrib-table
|
||||
pixel-format-attributes>int-array glXChooseVisual ;
|
||||
|
||||
M: x11-ui-backend (free-pixel-format)
|
||||
handle>> XFree ;
|
||||
|
|
|
@ -0,0 +1,14 @@
|
|||
USING: specialized-arrays.instances.alien.c-types.int tools.test
|
||||
ui.pixel-formats ;
|
||||
IN: ui.pixel-formats.tests
|
||||
|
||||
CONSTANT: attrib-table {
|
||||
{ windowed { 99 } }
|
||||
{ double-buffered { 7 } }
|
||||
}
|
||||
|
||||
! pixel-format-attributes>int-array
|
||||
{ int-array{ 9 2 99 7 0 } } [
|
||||
{ windowed double-buffered } { 9 2 } attrib-table
|
||||
pixel-format-attributes>int-array
|
||||
] unit-test
|
|
@ -1,6 +1,6 @@
|
|||
USING: alien.c-types alien.data accessors assocs classes
|
||||
destructors functors kernel lexer math parser sequences
|
||||
specialized-arrays ui.backend words ;
|
||||
USING: accessors alien.c-types alien.data assocs classes destructors
|
||||
fry functors kernel lexer math parser sequences specialized-arrays
|
||||
ui.backend words ;
|
||||
SPECIALIZED-ARRAY: int
|
||||
IN: ui.pixel-formats
|
||||
|
||||
|
@ -57,6 +57,11 @@ TUPLE: pixel-format < disposable world handle ;
|
|||
M: pixel-format dispose*
|
||||
[ (free-pixel-format) ] [ f >>handle drop ] bi ;
|
||||
|
||||
: pixel-format-attributes>int-array ( attrs perm table -- arr )
|
||||
swapd '[ _ at ] map sift concat append
|
||||
! 0 happens to work as a sentinel value for all ui backends.
|
||||
0 suffix int >c-array ;
|
||||
|
||||
<PRIVATE
|
||||
|
||||
FUNCTOR: define-pixel-format-attribute-table ( NAME PERM TABLE -- )
|
||||
|
|
Loading…
Reference in New Issue