From b3428c61e6560511f4807464c45d02b66d04d563 Mon Sep 17 00:00:00 2001 From: Slava Pestov Date: Fri, 12 Dec 2008 21:06:16 -0600 Subject: [PATCH 01/17] Better bootstrap error handling --- basis/bootstrap/stage2.factor | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/basis/bootstrap/stage2.factor b/basis/bootstrap/stage2.factor index fb7292b989..45a6c354a6 100644 --- a/basis/bootstrap/stage2.factor +++ b/basis/bootstrap/stage2.factor @@ -102,6 +102,8 @@ SYMBOL: bootstrap-time ] if ] [ drop - load-help? off - "resource:basis/bootstrap/bootstrap-error.factor" run-file + [ + load-help? off + "resource:basis/bootstrap/bootstrap-error.factor" run-file + ] with-scope ] recover From 50a78db9bdbac623b63f3b1ac7a8c08ebe50afc0 Mon Sep 17 00:00:00 2001 From: Slava Pestov Date: Fri, 12 Dec 2008 21:06:46 -0600 Subject: [PATCH 02/17] Add words for working with CFTimeInterval and CFAbsoluteDate types --- basis/core-foundation/core-foundation.factor | 9 ++++++++- basis/core-foundation/timers/timers.factor | 8 ++++++-- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/basis/core-foundation/core-foundation.factor b/basis/core-foundation/core-foundation.factor index 0f64c0666f..51173aff21 100644 --- a/basis/core-foundation/core-foundation.factor +++ b/basis/core-foundation/core-foundation.factor @@ -1,6 +1,6 @@ ! Copyright (C) 2006, 2008 Slava Pestov ! See http://factorcode.org/license.txt for BSD license. -USING: alien.syntax destructors accessors kernel ; +USING: alien.syntax destructors accessors kernel calendar ; IN: core-foundation TYPEDEF: void* CFTypeRef @@ -30,3 +30,10 @@ M: CFRelease-destructor dispose* alien>> CFRelease ; : |CFRelease ( alien -- alien ) dup f CFRelease-destructor boa |dispose drop ; inline + +: >CFTimeInterval ( duration -- interval ) + duration>seconds ; inline + +: >CFAbsoluteTime ( timestamp -- time ) + T{ timestamp { year 2001 } { month 1 } { day 1 } } time- + duration>seconds ; inline diff --git a/basis/core-foundation/timers/timers.factor b/basis/core-foundation/timers/timers.factor index 049e80b20f..0acd92ced1 100644 --- a/basis/core-foundation/timers/timers.factor +++ b/basis/core-foundation/timers/timers.factor @@ -1,6 +1,6 @@ ! Copyright (C) 2008 Slava Pestov. ! See http://factorcode.org/license.txt for BSD license. -USING: alien.syntax system math kernel core-foundation ; +USING: alien.syntax system math kernel core-foundation calendar ; IN: core-foundation.timers TYPEDEF: void* CFRunLoopTimerRef @@ -18,12 +18,16 @@ FUNCTION: CFRunLoopTimerRef CFRunLoopTimerCreate ( ) ; : ( callback -- timer ) - [ f millis 1000 /f 60 0 0 ] dip f CFRunLoopTimerCreate ; + [ f now >CFAbsoluteTime 60 0 0 ] dip f CFRunLoopTimerCreate ; FUNCTION: void CFRunLoopTimerInvalidate ( CFRunLoopTimerRef timer ) ; +FUNCTION: Boolean CFRunLoopTimerIsValid ( + CFRunLoopTimerRef timer +) ; + FUNCTION: void CFRunLoopTimerSetNextFireDate ( CFRunLoopTimerRef timer, CFAbsoluteTime fireDate From bb45fa93a713356a27560e5ac53cfee6b87ea6a8 Mon Sep 17 00:00:00 2001 From: Slava Pestov Date: Fri, 12 Dec 2008 23:56:19 -0600 Subject: [PATCH 03/17] Add a way to stop the io thread --- basis/io/thread/thread.factor | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/basis/io/thread/thread.factor b/basis/io/thread/thread.factor index fe86ba9e3d..7589d4918e 100644 --- a/basis/io/thread/thread.factor +++ b/basis/io/thread/thread.factor @@ -1,14 +1,20 @@ ! Copyright (C) 2008 Slava Pestov. ! See http://factorcode.org/license.txt for BSD license. +USING: threads io.backend namespaces init math kernel ; IN: io.thread -USING: threads io.backend namespaces init math ; + +! The Cocoa UI backend stops the I/O thread and takes over +! completely. +SYMBOL: io-thread-running? : io-thread ( -- ) sleep-time io-multiplex yield ; : start-io-thread ( -- ) - [ io-thread t ] - "I/O wait" spawn-server - \ io-thread set-global ; + [ [ io-thread-running? get-global ] [ io-thread ] [ ] while ] + "I/O wait" spawn drop ; -[ start-io-thread ] "io.thread" add-init-hook +[ + t io-thread-running? set-global + start-io-thread +] "io.thread" add-init-hook From 5ecffec1b940d2a963f8027da4170dc69ceb9820 Mon Sep 17 00:00:00 2001 From: Slava Pestov Date: Fri, 12 Dec 2008 23:57:16 -0600 Subject: [PATCH 04/17] Clean up run loop I/O multiplexer and make most of it independent of the I/O system; the UI will use it too --- .../core-foundation/run-loop/run-loop.factor | 84 ++++++++++++++++++- .../multiplexers/run-loop/run-loop.factor | 47 +++-------- 2 files changed, 92 insertions(+), 39 deletions(-) diff --git a/basis/core-foundation/run-loop/run-loop.factor b/basis/core-foundation/run-loop/run-loop.factor index 475991a246..5f2ff7bd53 100644 --- a/basis/core-foundation/run-loop/run-loop.factor +++ b/basis/core-foundation/run-loop/run-loop.factor @@ -1,8 +1,9 @@ ! Copyright (C) 2008 Slava Pestov ! See http://factorcode.org/license.txt for BSD license. -USING: alien alien.syntax kernel namespaces core-foundation -core-foundation.strings core-foundation.file-descriptors -core-foundation.timers ; +USING: accessors alien alien.syntax kernel math namespaces +sequences destructors combinators threads heaps deques calendar +core-foundation core-foundation.strings +core-foundation.file-descriptors core-foundation.timers ; IN: core-foundation.run-loop : kCFRunLoopRunFinished 1 ; inline @@ -59,3 +60,80 @@ FUNCTION: void CFRunLoopRemoveTimer ( "kCFRunLoopDefaultMode" dup \ CFRunLoopDefaultMode set-global ] when ; + +TUPLE: run-loop fds sources timers ; + +: ( -- run-loop ) + V{ } clone V{ } clone V{ } clone \ run-loop boa ; + +SYMBOL: expiry-check + +: run-loop ( -- run-loop ) + \ run-loop get-global not expiry-check get expired? or + [ + 31337 expiry-check set-global + dup \ run-loop set-global + ] [ \ run-loop get-global ] if ; + +: add-source-to-run-loop ( source -- ) + [ run-loop sources>> push ] + [ + CFRunLoopGetMain + swap CFRunLoopDefaultMode + CFRunLoopAddSource + ] bi ; + +: create-fd-source ( CFFileDescriptor -- source ) + f swap 0 CFFileDescriptorCreateRunLoopSource ; + +: add-fd-to-run-loop ( fd callback -- ) + [ + |CFRelease + [ run-loop fds>> push ] + [ create-fd-source |CFRelease add-source-to-run-loop ] + bi + ] with-destructors ; + +: add-timer-to-run-loop ( timer -- ) + [ run-loop timers>> push ] + [ + CFRunLoopGetMain + swap CFRunLoopDefaultMode + CFRunLoopAddTimer + ] bi ; + +CFAbsoluteTime CFRunLoopTimerSetNextFireDate ; + +: (reset-timer) ( timer counter -- ) + yield { + { [ dup 0 = ] [ now ((reset-timer)) ] } + { [ run-queue deque-empty? not ] [ 1- (reset-timer) ] } + { [ sleep-queue heap-empty? ] [ 5 minutes hence ((reset-timer)) ] } + [ sleep-queue heap-peek nip micros>timestamp ((reset-timer)) ] + } cond ; + +: reset-timer ( timer -- ) + 10 (reset-timer) ; + +PRIVATE> + +: reset-run-loop ( -- ) + run-loop + [ timers>> [ reset-timer ] each ] + [ fds>> [ enable-all-callbacks ] each ] bi ; + +: timer-callback ( -- callback ) + "void" { "CFRunLoopTimerRef" "void*" } "cdecl" + [ 2drop reset-run-loop yield ] alien-callback ; + +: init-thread-timer ( -- ) + timer-callback add-timer-to-run-loop ; + +: run-one-iteration ( us -- handled? ) + reset-run-loop + CFRunLoopDefaultMode + swap [ microseconds ] [ 5 minutes ] if* >CFTimeInterval + t CFRunLoopRunInMode kCFRunLoopRunHandledSource = ; diff --git a/basis/io/unix/multiplexers/run-loop/run-loop.factor b/basis/io/unix/multiplexers/run-loop/run-loop.factor index 7b80e461dc..4b2486d19f 100644 --- a/basis/io/unix/multiplexers/run-loop/run-loop.factor +++ b/basis/io/unix/multiplexers/run-loop/run-loop.factor @@ -1,50 +1,27 @@ ! Copyright (C) 2008 Slava Pestov. ! See http://factorcode.org/license.txt for BSD license. -USING: kernel namespaces math accessors threads alien locals -destructors combinators io.unix.multiplexers +USING: kernel arrays namespaces math accessors alien locals +destructors system threads io.unix.multiplexers io.unix.multiplexers.kqueue core-foundation -core-foundation.run-loop core-foundation.file-descriptors ; +core-foundation.run-loop ; IN: io.unix.multiplexers.run-loop -TUPLE: run-loop-mx kqueue-mx fd source ; +TUPLE: run-loop-mx kqueue-mx ; -: kqueue-callback ( -- callback ) +: file-descriptor-callback ( -- callback ) "void" { "CFFileDescriptorRef" "CFOptionFlags" "void*" } "cdecl" [ 3drop 0 mx get kqueue-mx>> wait-for-events - mx get fd>> enable-all-callbacks + reset-run-loop yield - ] - alien-callback ; - -SYMBOL: kqueue-run-loop-source - -: create-kqueue-source ( fd -- source ) - f swap 0 CFFileDescriptorCreateRunLoopSource ; - -: add-kqueue-to-run-loop ( mx -- ) - CFRunLoopGetMain swap source>> CFRunLoopDefaultMode CFRunLoopAddSource ; - -: remove-kqueue-from-run-loop ( source -- ) - CFRunLoopGetMain swap source>> CFRunLoopDefaultMode CFRunLoopRemoveSource ; + ] alien-callback ; : ( -- mx ) [ |dispose - dup fd>> kqueue-callback |dispose - dup create-kqueue-source run-loop-mx boa - dup add-kqueue-to-run-loop - ] with-destructors ; - -M: run-loop-mx dispose - [ - { - [ fd>> &CFRelease drop ] - [ source>> &CFRelease drop ] - [ remove-kqueue-from-run-loop ] - [ kqueue-mx>> &dispose drop ] - } cleave + dup fd>> file-descriptor-callback add-fd-to-run-loop + run-loop-mx boa ] with-destructors ; M: run-loop-mx add-input-callback kqueue-mx>> add-input-callback ; @@ -52,7 +29,5 @@ M: run-loop-mx add-output-callback kqueue-mx>> add-output-callback ; M: run-loop-mx remove-input-callbacks kqueue-mx>> remove-input-callbacks ; M: run-loop-mx remove-output-callbacks kqueue-mx>> remove-output-callbacks ; -M:: run-loop-mx wait-for-events ( us mx -- ) - mx fd>> enable-all-callbacks - CFRunLoopDefaultMode us [ 1000000 /f ] [ 60 ] if* t CFRunLoopRunInMode - kCFRunLoopRunHandledSource = [ 0 mx wait-for-events ] when ; +M: run-loop-mx wait-for-events ( us mx -- ) + swap run-one-iteration [ 0 swap wait-for-events ] [ drop ] if ; From 323de69e88afcee35d2ebb1dbcb391da6d6d8199 Mon Sep 17 00:00:00 2001 From: Slava Pestov Date: Fri, 12 Dec 2008 23:57:28 -0600 Subject: [PATCH 05/17] Remove obsolete tests --- basis/io/unix/multiplexers/run-loop/run-loop-tests.factor | 5 ----- 1 file changed, 5 deletions(-) delete mode 100644 basis/io/unix/multiplexers/run-loop/run-loop-tests.factor diff --git a/basis/io/unix/multiplexers/run-loop/run-loop-tests.factor b/basis/io/unix/multiplexers/run-loop/run-loop-tests.factor deleted file mode 100644 index 5f249c6881..0000000000 --- a/basis/io/unix/multiplexers/run-loop/run-loop-tests.factor +++ /dev/null @@ -1,5 +0,0 @@ -USING: io.unix.multiplexers.run-loop tools.test -destructors ; -IN: io.unix.multiplexers.run-loop.tests - -[ ] [ dispose ] unit-test From 053c15e476d7548551717b1a782650f875aa4628 Mon Sep 17 00:00:00 2001 From: Slava Pestov Date: Fri, 12 Dec 2008 23:58:28 -0600 Subject: [PATCH 06/17] This is where all the recent I/O and core foundation work comes together: use core-foundation.run-loop to receive events on Mac OS X instead of weak-ass Squeak-style polling every 10ms --- basis/ui/backend/backend.factor | 2 -- basis/ui/cocoa/cocoa.factor | 19 ++++++++++--------- basis/ui/event-loop/event-loop.factor | 19 +++++++++++++++++++ basis/ui/ui.factor | 13 ------------- basis/ui/windows/windows.factor | 12 ++++++------ basis/ui/x11/x11.factor | 6 +++--- 6 files changed, 38 insertions(+), 33 deletions(-) create mode 100644 basis/ui/event-loop/event-loop.factor diff --git a/basis/ui/backend/backend.factor b/basis/ui/backend/backend.factor index aa84419d64..eaa0953d25 100755 --- a/basis/ui/backend/backend.factor +++ b/basis/ui/backend/backend.factor @@ -5,8 +5,6 @@ IN: ui.backend SYMBOL: ui-backend -HOOK: do-events ui-backend ( -- ) - HOOK: set-title ui-backend ( string world -- ) HOOK: set-fullscreen* ui-backend ( ? world -- ) diff --git a/basis/ui/cocoa/cocoa.factor b/basis/ui/cocoa/cocoa.factor index fecbb52a25..331c0a698c 100755 --- a/basis/ui/cocoa/cocoa.factor +++ b/basis/ui/cocoa/cocoa.factor @@ -3,10 +3,11 @@ USING: accessors math arrays assocs cocoa cocoa.application command-line kernel memory namespaces cocoa.messages cocoa.runtime cocoa.subclassing cocoa.pasteboard cocoa.types -cocoa.windows cocoa.classes cocoa.nibs sequences system -ui ui.backend ui.clipboards ui.gadgets ui.gadgets.worlds -ui.cocoa.views core-foundation threads math.geometry.rect fry -libc generalizations alien.c-types cocoa.views combinators ; +cocoa.windows cocoa.classes cocoa.nibs sequences system ui +ui.backend ui.clipboards ui.gadgets ui.gadgets.worlds +ui.cocoa.views core-foundation core-foundation.run-loop threads +math.geometry.rect fry libc generalizations alien.c-types +cocoa.views combinators io.thread ; IN: ui.cocoa TUPLE: handle ; @@ -18,9 +19,6 @@ C: offscreen-handle SINGLETON: cocoa-ui-backend -M: cocoa-ui-backend do-events ( -- ) - [ NSApp '[ _ do-event ] loop ui-wait ] with-autorelease-pool ; - TUPLE: pasteboard handle ; C: pasteboard @@ -134,8 +132,8 @@ CLASS: { { +name+ "FactorApplicationDelegate" } } -{ "applicationDidFinishLaunching:" "void" { "id" "SEL" "id" } - [ 3drop event-loop ] +{ "applicationDidUpdate:" "void" { "id" "SEL" "id" } + [ 3drop reset-run-loop ] } ; : install-app-delegate ( -- ) @@ -153,6 +151,9 @@ M: cocoa-ui-backend ui init-clipboard cocoa-init-hook get call start-ui + f io-thread-running? set-global + init-thread-timer + reset-run-loop NSApp -> run ] ui-running ] with-cocoa ; diff --git a/basis/ui/event-loop/event-loop.factor b/basis/ui/event-loop/event-loop.factor new file mode 100644 index 0000000000..fe6f4d7de5 --- /dev/null +++ b/basis/ui/event-loop/event-loop.factor @@ -0,0 +1,19 @@ +! Copyright (C) 2008 Slava Pestov. +! See http://factorcode.org/license.txt for BSD license. +USING: ui.backend kernel namespaces sequences deques calendar +threads ; +IN: ui.event-loop + +: event-loop? ( -- ? ) + { + { [ stop-after-last-window? get not ] [ t ] } + { [ graft-queue deque-empty? not ] [ t ] } + { [ windows get-global empty? not ] [ t ] } + [ f ] + } cond ; + +HOOK: do-events ui-backend ( -- ) + +: event-loop ( quot -- ) [ event-loop? ] [ do-events ] [ ] while ; + +: ui-wait ( -- ) 10 milliseconds sleep ; diff --git a/basis/ui/ui.factor b/basis/ui/ui.factor index 1ee860c974..b6bc172c21 100644 --- a/basis/ui/ui.factor +++ b/basis/ui/ui.factor @@ -12,16 +12,6 @@ SYMBOL: windows SYMBOL: stop-after-last-window? -: event-loop? ( -- ? ) - { - { [ stop-after-last-window? get not ] [ t ] } - { [ graft-queue deque-empty? not ] [ t ] } - { [ windows get-global empty? not ] [ t ] } - [ f ] - } cond ; - -: event-loop ( -- ) [ event-loop? ] [ do-events ] [ ] while ; - : window ( handle -- world ) windows get-global at ; : window-focus ( handle -- gadget ) window world-focus ; @@ -155,9 +145,6 @@ SYMBOL: ui-hook ] assert-depth ] [ ui-error ] recover ; -: ui-wait ( -- ) - 10 milliseconds sleep ; - SYMBOL: ui-thread : ui-running ( quot -- ) diff --git a/basis/ui/windows/windows.factor b/basis/ui/windows/windows.factor index 35ee9f9a60..7f68bb5736 100755 --- a/basis/ui/windows/windows.factor +++ b/basis/ui/windows/windows.factor @@ -3,14 +3,14 @@ ! See http://factorcode.org/license.txt for BSD license. USING: alien alien.c-types alien.strings arrays assocs ui ui.gadgets ui.backend ui.clipboards ui.gadgets.worlds -ui.gestures io kernel math math.vectors namespaces make -sequences strings vectors words windows.kernel32 windows.gdi32 -windows.user32 windows.opengl32 windows.messages windows.types -windows.nt windows threads libc combinators fry +ui.gestures ui.event-loop io kernel math math.vectors namespaces +make sequences strings vectors words windows.kernel32 +windows.gdi32 windows.user32 windows.opengl32 windows.messages +windows.types windows.nt windows threads libc combinators fry combinators.short-circuit continuations command-line shuffle opengl ui.render ascii math.bitwise locals symbols accessors -math.geometry.rect math.order ascii calendar -io.encodings.utf16n ; +math.geometry.rect math.order ascii calendar io.encodings.utf16n +; IN: ui.windows SINGLETON: windows-ui-backend diff --git a/basis/ui/x11/x11.factor b/basis/ui/x11/x11.factor index 817e356712..9be3c2fd10 100755 --- a/basis/ui/x11/x11.factor +++ b/basis/ui/x11/x11.factor @@ -2,9 +2,9 @@ ! See http://factorcode.org/license.txt for BSD license. USING: accessors alien alien.c-types arrays ui ui.gadgets ui.gestures ui.backend ui.clipboards ui.gadgets.worlds ui.render -assocs kernel math namespaces opengl sequences strings x11.xlib -x11.events x11.xim x11.glx x11.clipboard x11.constants -x11.windows io.encodings.string io.encodings.ascii +ui.event-loop assocs kernel math namespaces opengl sequences +strings x11.xlib x11.events x11.xim x11.glx x11.clipboard +x11.constants x11.windows io.encodings.string io.encodings.ascii io.encodings.utf8 combinators command-line qualified math.vectors classes.tuple opengl.gl threads math.geometry.rect environment ascii ; From a4ba0453b3a32de5200fc9a114bfc54500e861de Mon Sep 17 00:00:00 2001 From: Slava Pestov Date: Sat, 13 Dec 2008 00:00:39 -0600 Subject: [PATCH 07/17] Fix UI docs --- basis/ui/ui-docs.factor | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/basis/ui/ui-docs.factor b/basis/ui/ui-docs.factor index 738d259cad..64a98fee03 100644 --- a/basis/ui/ui-docs.factor +++ b/basis/ui/ui-docs.factor @@ -143,9 +143,7 @@ ARTICLE: "ui-backend-init" "UI initialization and the event loop" } "The above word must call the following:" { $subsection start-ui } -"The " { $link ui } " word must not return until the event loop has stopped and the UI has been shut down." -$nl -"The event loop must not block, since otherwise other Factor threads and I/O will not run. Instead, it should poll for pending events, then call " { $link ui-wait } "." ; +"The " { $link ui } " word must not return until the event loop has stopped and the UI has been shut down." ; ARTICLE: "ui-backend-windows" "UI backend window management" "The high-level " { $link open-window } " word eventually calls a low-level word which you must implement:" From 7ad494d2dd2382e0711cff6f3d8cc32f2ad655e7 Mon Sep 17 00:00:00 2001 From: slava Date: Sat, 13 Dec 2008 00:09:36 -0600 Subject: [PATCH 08/17] Add Display structure --- basis/x11/xlib/xlib.factor | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/basis/x11/xlib/xlib.factor b/basis/x11/xlib/xlib.factor index 555eb573fc..58b4995c40 100644 --- a/basis/x11/xlib/xlib.factor +++ b/basis/x11/xlib/xlib.factor @@ -31,7 +31,6 @@ TYPEDEF: XID KeySym TYPEDEF: ulong Atom TYPEDEF: char* XPointer -TYPEDEF: void* Display* TYPEDEF: void* Screen* TYPEDEF: void* GC TYPEDEF: void* Visual* @@ -66,6 +65,12 @@ TYPEDEF: void* Atom** ! 2 - Display Functions ! +! This struct is incomplete +C-STRUCT: Display +{ "void*" "ext_data" } +{ "void*" "free_funcs" } +{ "int" "fd" } ; + FUNCTION: Display* XOpenDisplay ( void* display_name ) ; ! 2.2 Obtaining Information about the Display, Image Formats, or Screens From 7bf857650c322290e5445e1d8113f4527f03adcf Mon Sep 17 00:00:00 2001 From: slava Date: Sat, 13 Dec 2008 03:49:22 -0600 Subject: [PATCH 09/17] Remove stop-after-last-window? option, it's obsolete, get ui.event-loop (only used on X11 and Windows) to load --- basis/tools/deploy/shaker/strip-cocoa.factor | 4 ---- basis/ui/event-loop/event-loop.factor | 7 +++---- basis/ui/tools/deploy/deploy.factor | 5 ----- basis/ui/ui.factor | 3 --- basis/ui/windows/windows.factor | 1 - 5 files changed, 3 insertions(+), 17 deletions(-) diff --git a/basis/tools/deploy/shaker/strip-cocoa.factor b/basis/tools/deploy/shaker/strip-cocoa.factor index 773b2d0f3b..df64443b7b 100644 --- a/basis/tools/deploy/shaker/strip-cocoa.factor +++ b/basis/tools/deploy/shaker/strip-cocoa.factor @@ -19,12 +19,8 @@ IN: cocoa.application [ [ die ] 19 setenv ] "cocoa.application" add-init-hook -"stop-after-last-window?" get - H{ } clone \ pool [ global [ - "stop-after-last-window?" "ui" lookup set - ! Only keeps those methods that we actually call sent-messages get super-sent-messages get assoc-union objc-methods [ assoc-intersect pool-values ] change diff --git a/basis/ui/event-loop/event-loop.factor b/basis/ui/event-loop/event-loop.factor index fe6f4d7de5..7c08d802f5 100644 --- a/basis/ui/event-loop/event-loop.factor +++ b/basis/ui/event-loop/event-loop.factor @@ -1,12 +1,11 @@ ! Copyright (C) 2008 Slava Pestov. ! See http://factorcode.org/license.txt for BSD license. -USING: ui.backend kernel namespaces sequences deques calendar -threads ; +USING: calendar combinators deques kernel namespaces sequences +threads ui ui.backend ui.gadgets ; IN: ui.event-loop : event-loop? ( -- ? ) { - { [ stop-after-last-window? get not ] [ t ] } { [ graft-queue deque-empty? not ] [ t ] } { [ windows get-global empty? not ] [ t ] } [ f ] @@ -14,6 +13,6 @@ IN: ui.event-loop HOOK: do-events ui-backend ( -- ) -: event-loop ( quot -- ) [ event-loop? ] [ do-events ] [ ] while ; +: event-loop ( -- ) [ event-loop? ] [ do-events ] [ ] while ; : ui-wait ( -- ) 10 milliseconds sleep ; diff --git a/basis/ui/tools/deploy/deploy.factor b/basis/ui/tools/deploy/deploy.factor index f233c9f162..38db81c3dc 100644 --- a/basis/ui/tools/deploy/deploy.factor +++ b/basis/ui/tools/deploy/deploy.factor @@ -18,10 +18,6 @@ TUPLE: deploy-gadget < pack vocab settings ; deploy-ui? get "Include user interface framework" add-gadget ; -: exit-when-windows-closed ( parent -- parent ) - "stop-after-last-window?" get - "Exit when last UI window closed" add-gadget ; - : io-settings ( parent -- parent ) "Input/output support:"