2008-12-13 00:58:28 -05:00
|
|
|
! Copyright (C) 2008 Slava Pestov.
|
|
|
|
! See http://factorcode.org/license.txt for BSD license.
|
2008-12-13 04:49:22 -05:00
|
|
|
USING: calendar combinators deques kernel namespaces sequences
|
|
|
|
threads ui ui.backend ui.gadgets ;
|
2008-12-13 00:58:28 -05:00
|
|
|
IN: ui.event-loop
|
|
|
|
|
|
|
|
: event-loop? ( -- ? )
|
|
|
|
{
|
|
|
|
{ [ graft-queue deque-empty? not ] [ t ] }
|
|
|
|
{ [ windows get-global empty? not ] [ t ] }
|
|
|
|
[ f ]
|
|
|
|
} cond ;
|
|
|
|
|
|
|
|
HOOK: do-events ui-backend ( -- )
|
|
|
|
|
2008-12-13 04:49:22 -05:00
|
|
|
: event-loop ( -- ) [ event-loop? ] [ do-events ] [ ] while ;
|
2008-12-13 00:58:28 -05:00
|
|
|
|
|
|
|
: ui-wait ( -- ) 10 milliseconds sleep ;
|