UI fixes
parent
071d800c10
commit
438f00a6a5
|
@ -8,7 +8,7 @@ IN: concurrency.conditions
|
|||
dup dlist-empty? [ drop ] [ pop-back resume-now ] if ;
|
||||
|
||||
: notify-all ( dlist -- )
|
||||
[ resume-now ] dlist-slurp yield ;
|
||||
[ resume-now ] dlist-slurp ;
|
||||
|
||||
: queue-timeout ( queue timeout -- alarm )
|
||||
#! Add an alarm which removes the current thread from the
|
||||
|
|
|
@ -2,9 +2,18 @@
|
|||
! See http://factorcode.org/license.txt for BSD license.
|
||||
USING: arrays hashtables kernel models math namespaces sequences
|
||||
quotations math.vectors combinators sorting vectors dlists
|
||||
models threads ;
|
||||
models threads concurrency.messaging ;
|
||||
IN: ui.gadgets
|
||||
|
||||
SYMBOL: ui-thread
|
||||
|
||||
: notify-ui-thread ( -- )
|
||||
self ui-thread get-global eq? [
|
||||
"notify" ui-thread get-global send
|
||||
] unless ;
|
||||
|
||||
: stop-ui-thread ( -- ) "stop" ui-thread get-global send ;
|
||||
|
||||
TUPLE: rect loc dim ;
|
||||
|
||||
C: <rect> rect
|
||||
|
@ -178,10 +187,6 @@ M: array gadget-text*
|
|||
|
||||
: forget-pref-dim ( gadget -- ) f swap set-gadget-pref-dim ;
|
||||
|
||||
SYMBOL: ui-thread
|
||||
|
||||
: notify-ui-thread ( -- ) ui-thread get interrupt ;
|
||||
|
||||
: layout-queue ( -- queue ) \ layout-queue get ;
|
||||
|
||||
: layout-later ( gadget -- )
|
||||
|
|
|
@ -133,7 +133,7 @@ M: stack-display tool-scroller
|
|||
|
||||
: restart-listener ( listener -- )
|
||||
dup com-end dup clear-output
|
||||
[ init-namespaces listener-thread ] curry
|
||||
[ listener-thread ] curry
|
||||
"Listener" spawn drop ;
|
||||
|
||||
: init-listener ( listener -- )
|
||||
|
|
|
@ -4,7 +4,7 @@ USING: arrays assocs io kernel math models namespaces
|
|||
prettyprint dlists sequences threads sequences words
|
||||
debugger ui.gadgets ui.gadgets.worlds ui.gadgets.tracks
|
||||
ui.gestures ui.backend ui.render continuations init combinators
|
||||
hashtables ;
|
||||
hashtables concurrency.messaging ;
|
||||
IN: ui
|
||||
|
||||
! Assoc mapping aliens to gadgets
|
||||
|
@ -142,16 +142,14 @@ SYMBOL: ui-hook
|
|||
t \ ui-running set-global
|
||||
[ f \ ui-running set-global ] [ ] cleanup ; inline
|
||||
|
||||
: ui-thread-running? ( -- ? )
|
||||
ui-thread get-global self eq? \ ui-running get-global and ;
|
||||
|
||||
: update-ui-loop ( -- )
|
||||
ui-thread-running?
|
||||
[ [ update-ui ] ui-try f sleep-until update-ui-loop ] when ;
|
||||
receive { { "notify" [ ] } { "stop" [ stop ] } } case
|
||||
[ update-ui ] ui-try
|
||||
update-ui-loop ;
|
||||
|
||||
: start-ui-thread ( -- )
|
||||
[ self ui-thread set-global update-ui-loop ]
|
||||
"UI update" spawn drop ;
|
||||
[ update-ui-loop ]
|
||||
"UI update" spawn ui-thread set-global ;
|
||||
|
||||
: open-world-window ( world -- )
|
||||
dup pref-dim over set-gadget-dim dup relayout graft ;
|
||||
|
|
Loading…
Reference in New Issue