[
{
+ "NSAlert"
"NSApplication"
"NSArray"
"NSAutoreleasePool"
M: cocoa-ui-backend beep ( -- )
NSBeep ;
+M: cocoa-ui-backend system-alert
+ NSAlert -> alloc -> init -> autorelease [
+ {
+ [ swap <NSString> -> setInformativeText: ]
+ [ swap <NSString> -> setMessageText: ]
+ [ "OK" <NSString> -> addButtonWithTitle: drop ]
+ [ -> runModal drop ]
+ } cleave
+ ] [ 2drop ] if* ;
+
CLASS: {
{ +superclass+ "NSObject" }
{ +name+ "FactorApplicationDelegate" }
M: windows-ui-backend beep ( -- )
0 MessageBeep drop ;
+M: windows-ui-backend system-alert
+ [ f ] 2dip swap MB_OK MessageBox drop ;
+
: fullscreen-RECT ( hwnd -- RECT )
MONITOR_DEFAULTTONEAREST MonitorFromWindow
MONITORINFOEX <struct>
ui.gadgets.private ui.gadgets.worlds ui.gestures ui.pixel-formats
ui.pixel-formats.private ui.private x11 x11.clipboard x11.constants
x11.events x11.glx x11.io x11.windows x11.xim x11.xlib ;
+FROM: unix.ffi => system ;
IN: ui.backend.x11
SINGLETON: x11-ui-backend
M: x11-ui-backend beep ( -- )
dpy get 100 XBell drop ;
+<PRIVATE
+: escape-' ( string -- string' )
+ [ dup CHAR: ' = [ drop "'\''" ] [ 1string ] if ] { } map-as concat ;
+
+: xmessage ( string -- )
+ escape-' "/usr/X11R6/bin/xmessage '" "'" surround system ;
+PRIVATE>
+
+M: x11-ui-backend system-alert
+ "\n\n" glue xmessage ;
+
: black ( -- xcolor ) 0 0 0 0 0 0 XColor <struct-boa> ; inline
M:: x11-ui-backend (grab-input) ( handle -- )
HOOK: beep ui-backend ( -- )
+HOOK: system-alert ui-backend ( caption text -- )
+
: parse-main-window-attributes ( class -- attributes )
"{" expect dup all-slots parse-tuple-literal-slots ;