HOOK: raise-window* ui-backend ( world -- )
+HOOK: system-background-color ui-backend ( -- color )
+
GENERIC: select-gl-context ( handle -- )
GENERIC: flush-gl-context ( handle -- )
[ first 0 <int> [ swap 0 -> getValues:forAttribute:forVirtualScreen: ] keep *int ]
if-empty ;
+M: cocoa-ui-backend system-background-color
+ T{ rgba f 0.0 0.0 0.0 0.0 } ; inline
+
TUPLE: pasteboard handle ;
C: <pasteboard> pasteboard
opengl ui.render math.bitwise locals accessors math.rectangles
math.order calendar ascii sets io.encodings.utf16n
windows.errors literals ui.pixel-formats
-ui.pixel-formats.private memoize classes
+ui.pixel-formats.private memoize classes colors
specialized-arrays classes.struct alien.data ;
SPECIALIZED-ARRAY: POINT
IN: ui.backend.windows
over world>> has-wglChoosePixelFormatARB?
[ arb-pixel-format-attribute ] [ pfd-pixel-format-attribute ] if ;
+M: windows-ui-backend system-background-color
+ composition-enabled?
+ [ T{ rgba f 0.0 0.0 0.0 0.0 } ]
+ [ COLOR_BTNFACE GetSysColor RGB>color ] if ;
+
PRIVATE>
: lo-word ( wparam -- lo ) <short> *short ; inline
#! message sent if mouse leaves main application
4drop forget-rollover ;
+: ?make-glass ( world hwnd -- )
+ swap { [ transparent?>> ] [ drop windows-major 6 >= ] } 1&&
+ [ full-window-margins DwmExtendFrameIntoClientArea drop ]
+ [ drop ] if ;
+
+: handle-wm-dwmcompositionchanged ( hWnd uMsg wParam lParam -- )
+ 3drop [ window ] keep ?make-glass ;
+
SYMBOL: wm-handlers
H{ } clone wm-handlers set-global
[ handle-wm-buttonup 0 ] WM_LBUTTONUP add-wm-handler
[ handle-wm-buttonup 0 ] WM_MBUTTONUP add-wm-handler
[ handle-wm-buttonup 0 ] WM_RBUTTONUP add-wm-handler
+[ handle-wm-dwmcompositionchanged 0 ] WM_DWMCOMPOSITIONCHANGED add-wm-handler
[ 4dup handle-wm-ncbutton DefWindowProc ]
{ WM_NCLBUTTONDOWN WM_NCMBUTTONDOWN WM_NCRBUTTONDOWN
0 GetSystemMenu
SC_CLOSE MF_BYCOMMAND MF_GRAYED bitor EnableMenuItem drop ;
-: ?make-glass ( world hwnd -- )
- swap { [ transparent?>> ] [ drop windows-major 6 >= ] } 1&&
- [ full-window-margins DwmExtendFrameIntoClientArea drop ]
- [ drop ] if ;
-
: ?disable-close-button ( world hwnd -- )
swap window-controls>> close-button swap member? not
[ disable-close-button ] [ drop ] if ;
! Copyright (C) 2005, 2009 Eduardo Cavazos and Slava Pestov
! See http://factorcode.org/license.txt for BSD license.
-USING: accessors alien.c-types arrays ascii assocs
+USING: accessors alien.c-types arrays ascii assocs colors
classes.struct combinators io.encodings.ascii
io.encodings.string io.encodings.utf8 kernel literals math
namespaces sequences strings ui ui.backend ui.clipboards
0 <int> [ glXGetConfig drop ] keep *int
] if-empty ;
+M: x11-ui-backend system-background-color
+ T{ rgba f 0.0 0.0 0.0 0.0 } ; inline
+
CONSTANT: modifiers
{
{ S+ HEX: 1 }
! See http://factorcode.org/license.txt for BSD license.
USING: math.rectangles math.vectors namespaces kernel accessors
assocs combinators sequences opengl opengl.gl colors
-colors.constants ui.gadgets ui.pens ;
+colors.constants ui.backend ui.gadgets ui.pens ;
IN: ui.render
SYMBOL: clip
: clear-gl ( transparent? -- )
[
- 0.0 0.0 0.0 0.0 glClearColor
+ system-background-color
+ [ red>> ] [ green>> ] [ blue>> ] tri 0.0
+ glClearColor
GL_COLOR_BUFFER_BIT glClear
] [
! white gl-clear is broken w.r.t window resizing
! (c)2009 Joe Groff bsd license
-USING: alien.c-types alien.libraries alien.syntax classes.struct windows.types ;
+USING: alien.c-types alien.data alien.libraries alien.syntax
+classes.struct kernel math system-info.windows windows.types ;
IN: windows.dwmapi
STRUCT: MARGINS
FUNCTION: HRESULT DwmExtendFrameIntoClientArea ( HWND hWnd, MARGINS* pMarInset ) ;
FUNCTION: HRESULT DwmEnableBlurBehindWindow ( HWND hWnd, DWM_BLURBEHIND* pBlurBehind ) ;
+FUNCTION: HRESULT DwmIsCompositionEnabled ( BOOL* pfEnabled ) ;
+
+CONSTANT: WM_DWMCOMPOSITIONCHANGED HEX: 31E
+
+: composition-enabled? ( -- ? )
+ windows-major 6 >=
+ [ 0 <int> [ DwmIsCompositionEnabled drop ] keep *int c-bool> ]
+ [ f ] if ;
: RGB ( r g b -- COLORREF )
{ 16 8 0 } bitfield ; inline
+: >RGB< ( COLORREF -- r g b )
+ [ HEX: ff bitand ]
+ [ -8 shift HEX: ff bitand ]
+ [ -16 shift HEX: ff bitand ] tri ;
: color>RGB ( color -- COLORREF )
>rgba-components drop [ 255 * >integer ] tri@ RGB ;
+: RGB>color ( COLORREF -- color )
+ >RGB< [ 1/255. * >float ] tri@ 1.0 <rgba> ;
STRUCT: TEXTMETRICW
{ tmHeight LONG }
! FUNCTION: GetScrollRange
! FUNCTION: GetShellWindow
! FUNCTION: GetSubMenu
-! FUNCTION: GetSysColor
+FUNCTION: COLORREF GetSysColor ( int nIndex ) ;
FUNCTION: HBRUSH GetSysColorBrush ( int nIndex ) ;
FUNCTION: HMENU GetSystemMenu ( HWND hWnd, BOOL bRevert ) ;
! FUNCTION: GetSystemMetrics