ui: the with-ui-running combinator can be removed
It was only used within the (with-ui) words which in turn were only called by with-ui.factor-shell
parent
f0347b71cf
commit
dd36f6ad57
|
@ -215,7 +215,6 @@ cocoa-startup-hook [
|
||||||
|
|
||||||
M: cocoa-ui-backend (with-ui)
|
M: cocoa-ui-backend (with-ui)
|
||||||
"UI" assert.app [
|
"UI" assert.app [
|
||||||
[
|
|
||||||
init-clipboard
|
init-clipboard
|
||||||
cocoa-startup-hook get call( -- )
|
cocoa-startup-hook get call( -- )
|
||||||
start-ui
|
start-ui
|
||||||
|
@ -223,7 +222,6 @@ M: cocoa-ui-backend (with-ui)
|
||||||
init-thread-timer
|
init-thread-timer
|
||||||
reset-thread-timer
|
reset-thread-timer
|
||||||
NSApp -> run
|
NSApp -> run
|
||||||
] with-ui-running
|
|
||||||
] with-cocoa ;
|
] with-cocoa ;
|
||||||
|
|
||||||
cocoa-ui-backend ui-backend set-global
|
cocoa-ui-backend ui-backend set-global
|
||||||
|
|
|
@ -503,7 +503,6 @@ M:: gtk-ui-backend system-alert ( caption text -- )
|
||||||
] with-destructors ;
|
] with-destructors ;
|
||||||
|
|
||||||
M: gtk-ui-backend (with-ui)
|
M: gtk-ui-backend (with-ui)
|
||||||
[
|
|
||||||
f f gtk_init
|
f f gtk_init
|
||||||
f f gtk_gl_init
|
f f gtk_gl_init
|
||||||
load-icon
|
load-icon
|
||||||
|
@ -511,8 +510,7 @@ M: gtk-ui-backend (with-ui)
|
||||||
start-ui
|
start-ui
|
||||||
[
|
[
|
||||||
[ [ gtk_main ] with-timer ] with-event-loop
|
[ [ gtk_main ] with-timer ] with-event-loop
|
||||||
] with-destructors
|
] with-destructors ;
|
||||||
] with-ui-running ;
|
|
||||||
|
|
||||||
M: gtk-ui-backend stop-event-loop
|
M: gtk-ui-backend stop-event-loop
|
||||||
gtk_main_quit ;
|
gtk_main_quit ;
|
||||||
|
|
|
@ -705,14 +705,12 @@ M: windows-ui-backend set-title ( string world -- )
|
||||||
[ [ hWnd>> WM_SETTEXT 0 ] dip alien-address SendMessage drop ] bi ;
|
[ [ hWnd>> WM_SETTEXT 0 ] dip alien-address SendMessage drop ] bi ;
|
||||||
|
|
||||||
M: windows-ui-backend (with-ui)
|
M: windows-ui-backend (with-ui)
|
||||||
[
|
|
||||||
[
|
[
|
||||||
init-clipboard
|
init-clipboard
|
||||||
init-win32-ui
|
init-win32-ui
|
||||||
start-ui
|
start-ui
|
||||||
event-loop
|
event-loop
|
||||||
] [ cleanup-win32-ui ] [ ] cleanup
|
] [ cleanup-win32-ui ] [ ] cleanup ;
|
||||||
] with-ui-running ;
|
|
||||||
|
|
||||||
M: windows-ui-backend beep ( -- )
|
M: windows-ui-backend beep ( -- )
|
||||||
0 MessageBeep drop ;
|
0 MessageBeep drop ;
|
||||||
|
|
|
@ -319,15 +319,13 @@ M: x11-handle flush-gl-context ( handle -- )
|
||||||
dpy get swap window>> glXSwapBuffers ;
|
dpy get swap window>> glXSwapBuffers ;
|
||||||
|
|
||||||
M: x11-ui-backend (with-ui) ( quot -- )
|
M: x11-ui-backend (with-ui) ( quot -- )
|
||||||
[
|
|
||||||
f [
|
f [
|
||||||
[
|
[
|
||||||
init-clipboard
|
init-clipboard
|
||||||
start-ui
|
start-ui
|
||||||
event-loop
|
event-loop
|
||||||
] with-xim
|
] with-xim
|
||||||
] with-x
|
] with-x ;
|
||||||
] with-ui-running ;
|
|
||||||
|
|
||||||
M: x11-ui-backend beep ( -- )
|
M: x11-ui-backend beep ( -- )
|
||||||
dpy get 100 XBell drop ;
|
dpy get 100 XBell drop ;
|
||||||
|
|
|
@ -3,7 +3,6 @@ math.rectangles namespaces quotations sequences strings ui.backend
|
||||||
ui.gadgets ui.gadgets.books ui.gadgets.grids ui.gadgets.packs
|
ui.gadgets ui.gadgets.books ui.gadgets.grids ui.gadgets.packs
|
||||||
ui.gadgets.private ui.gadgets.tracks ui.gadgets.worlds ui.private ui.text
|
ui.gadgets.private ui.gadgets.tracks ui.gadgets.worlds ui.private ui.text
|
||||||
vocabs.loader ;
|
vocabs.loader ;
|
||||||
|
|
||||||
IN: ui
|
IN: ui
|
||||||
|
|
||||||
HELP: close-window
|
HELP: close-window
|
||||||
|
@ -91,7 +90,10 @@ HELP: raise-window
|
||||||
|
|
||||||
HELP: with-ui
|
HELP: with-ui
|
||||||
{ $values { "quot" { $quotation ( -- ) } } }
|
{ $values { "quot" { $quotation ( -- ) } } }
|
||||||
{ $description "Calls the quotation, starting the UI if necessary. If starting the UI is necessary, this word does not return and the UI will start after the quotation returns." }
|
{ $description
|
||||||
|
"Calls the quotation, starting the UI if necessary. If starting the UI is necessary, this word does not return and the UI will start after the quotation returns." $nl
|
||||||
|
"While the combinator is running, " { $link ui-running? } " can be used by user code to determine whether it is running in a UI context or not."
|
||||||
|
}
|
||||||
{ $notes "This word should be used in the " { $link POSTPONE: MAIN: } " word of an application that uses the UI in order for the vocabulary to work when run from either the UI listener (" { $snippet "\"my-app\" run" } ") and the command line (" { $snippet "./factor -run=my-app" } ")." }
|
{ $notes "This word should be used in the " { $link POSTPONE: MAIN: } " word of an application that uses the UI in order for the vocabulary to work when run from either the UI listener (" { $snippet "\"my-app\" run" } ") and the command line (" { $snippet "./factor -run=my-app" } ")." }
|
||||||
{ $examples "The " { $vocab-link "hello-ui" } " vocabulary implements a simple UI application which uses this word." } ;
|
{ $examples "The " { $vocab-link "hello-ui" } " vocabulary implements a simple UI application which uses this word." } ;
|
||||||
|
|
||||||
|
|
|
@ -134,10 +134,6 @@ M: world ungraft*
|
||||||
|
|
||||||
SYMBOL: ui-running
|
SYMBOL: ui-running
|
||||||
|
|
||||||
: with-ui-running ( quot -- )
|
|
||||||
t ui-running set-global
|
|
||||||
[ f ui-running set-global ] [ ] cleanup ; inline
|
|
||||||
|
|
||||||
PRIVATE>
|
PRIVATE>
|
||||||
|
|
||||||
: find-windows ( quot: ( world -- ? ) -- seq )
|
: find-windows ( quot: ( world -- ? ) -- seq )
|
||||||
|
@ -225,7 +221,11 @@ M: object resize-window 2drop ;
|
||||||
[ find-world [ dup pref-dim resize-window ] when* ] bi ;
|
[ find-world [ dup pref-dim resize-window ] when* ] bi ;
|
||||||
|
|
||||||
: with-ui ( quot: ( -- ) -- )
|
: with-ui ( quot: ( -- ) -- )
|
||||||
ui-running? [ call( -- ) ] [ '[ init-ui @ ] (with-ui) ] if ;
|
ui-running? [ call( -- ) ] [
|
||||||
|
t ui-running set-global '[
|
||||||
|
[ init-ui @ ] (with-ui)
|
||||||
|
] [ f ui-running set-global ] [ ] cleanup
|
||||||
|
] if ;
|
||||||
|
|
||||||
HOOK: beep ui-backend ( -- )
|
HOOK: beep ui-backend ( -- )
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue