diff --git a/basis/ui/ui-docs.factor b/basis/ui/ui-docs.factor index c97354e18b..29078d5206 100644 --- a/basis/ui/ui-docs.factor +++ b/basis/ui/ui-docs.factor @@ -6,10 +6,26 @@ vocabs.loader ; IN: ui +HELP: close-window +{ $values { "gadget" gadget } } +{ $description "Close the native window containing " { $snippet "gadget" } "." } ; + HELP: open-window { $values { "gadget" gadget } { "title/attributes" { "a " { $link string } " or a " { $link world-attributes } " tuple" } } } { $description "Opens a native window containing " { $snippet "gadget" } " with the specified attributes. If a string is provided, it is used as the window title; otherwise, the window attributes are specified in a " { $link world-attributes } " tuple." } ; +HELP: set-fullscreen +{ $values { "gadget" gadget } { "?" boolean } } +{ $description "Sets and unsets fullscreen mode for the gadget's world." } ; + +HELP: set-up-window +{ $values { "world" world } } +{ $description "Initializes the window that shows the world." } ; + +HELP: ui-thread +{ $var-description "Holds a reference to the running UI thread. This variable is used to ensure that there can only be one UI thread running at the same time." } +{ $see-also start-ui-thread } ; + HELP: ui-running? { $values { "?" boolean } } { $description "Whether the UI is running or not." } ; @@ -19,10 +35,6 @@ HELP: ui-windows { ui-windows open-window find-window world-attributes } related-words -HELP: close-window -{ $values { "gadget" gadget } } -{ $description "Close the native window containing " { $snippet "gadget" } "." } ; - HELP: world-attributes { $values { "world-class" class } { "title" string } { "status" gadget } { "gadgets" sequence } { "pixel-format-attributes" sequence } { "window-controls" sequence } } { $class-description "Tuples of this class can be passed to " { $link open-window } " to control attributes of the window opened. The following attributes can be set:" } @@ -35,14 +47,6 @@ HELP: world-attributes { { $snippet "window-controls" } " is a sequence of " { $link "ui.gadgets.worlds-window-controls" } " that will be placed in the window." } } ; -HELP: set-fullscreen -{ $values { "gadget" gadget } { "?" boolean } } -{ $description "Sets and unsets fullscreen mode for the gadget's world." } ; - -HELP: set-up-window -{ $values { "world" world } } -{ $description "Initializes the window that shows the world." } ; - HELP: fullscreen? { $values { "gadget" gadget } { "?" boolean } } { $description "Queries the gadget's world to see if it is running in fullscreen mode." } ; diff --git a/basis/ui/ui.factor b/basis/ui/ui.factor index 5cce30ac93..6d2739970f 100644 --- a/basis/ui/ui.factor +++ b/basis/ui/ui.factor @@ -150,12 +150,14 @@ PRIVATE> ] while ; : start-ui-thread ( -- ) - [ update-ui-loop ] "UI update" spawn drop ; + [ self ui-thread set-global update-ui-loop ] + "UI update" spawn drop ; : start-ui ( quot -- ) call( -- ) notify-ui-thread start-ui-thread ;