diff --git a/extra/ui/cocoa/cocoa.factor b/extra/ui/cocoa/cocoa.factor index 6607a22f50..7492ad19b7 100755 --- a/extra/ui/cocoa/cocoa.factor +++ b/extra/ui/cocoa/cocoa.factor @@ -19,7 +19,7 @@ SYMBOL: stop-after-last-window? : event-loop ( -- ) event-loop? [ [ - [ NSApp do-events ui-step ] ui-try + [ NSApp do-events ui-step 10 sleep ] ui-try ] with-autorelease-pool event-loop ] when ; diff --git a/extra/ui/tools/workspace/workspace.factor b/extra/ui/tools/workspace/workspace.factor index 79857fa2e6..b8c41e17cc 100755 --- a/extra/ui/tools/workspace/workspace.factor +++ b/extra/ui/tools/workspace/workspace.factor @@ -2,11 +2,10 @@ ! See http://factorcode.org/license.txt for BSD license. USING: classes continuations help help.topics kernel models sequences ui ui.backend ui.tools.debugger ui.gadgets -ui.gadgets.books ui.gadgets.buttons -ui.gadgets.labelled ui.gadgets.panes ui.gadgets.scrollers -ui.gadgets.tracks ui.gadgets.worlds ui.gadgets.presentations -ui.gadgets.status-bar ui.commands ui.gestures assocs arrays -namespaces ; +ui.gadgets.books ui.gadgets.buttons ui.gadgets.labelled +ui.gadgets.panes ui.gadgets.scrollers ui.gadgets.tracks +ui.gadgets.worlds ui.gadgets.presentations ui.gadgets.status-bar +ui.commands ui.gestures assocs arrays namespaces ; IN: ui.tools.workspace TUPLE: workspace book listener popup ; diff --git a/extra/ui/ui.factor b/extra/ui/ui.factor index 98549a16f7..bafd6c40c5 100755 --- a/extra/ui/ui.factor +++ b/extra/ui/ui.factor @@ -65,18 +65,6 @@ M: world ungraft* dup world-handle (close-window) reset-world ; -: open-world-window ( world -- ) - dup pref-dim over set-gadget-dim dup relayout graft ; - -: open-window ( gadget title -- ) - >r [ 1 track, ] { 0 1 } make-track r> - f open-world-window ; - -HOOK: close-window ui-backend ( gadget -- ) - -M: object close-window - find-world [ ungraft ] when* ; - : find-window ( quot -- world ) windows get values [ gadget-child swap call ] curry* find-last nip ; inline @@ -148,9 +136,20 @@ SYMBOL: ui-hook notify-queued layout-queued redraw-worlds - 10 sleep ] assert-depth ; +: open-world-window ( world -- ) + dup pref-dim over set-gadget-dim dup relayout graft ui-step ; + +: open-window ( gadget title -- ) + >r [ 1 track, ] { 0 1 } make-track r> + f open-world-window ; + +HOOK: close-window ui-backend ( gadget -- ) + +M: object close-window + find-world [ ungraft ] when* ; + : start-ui ( -- ) init-timers restore-windows? [ diff --git a/extra/ui/windows/windows.factor b/extra/ui/windows/windows.factor index 290e4ef311..7c7e0298fe 100755 --- a/extra/ui/windows/windows.factor +++ b/extra/ui/windows/windows.factor @@ -94,8 +94,7 @@ SYMBOL: mouse-captured 3drop window draw-world ; : handle-wm-size ( hWnd uMsg wParam lParam -- ) - [ lo-word ] keep hi-word make-RECT get-RECT-dimensions 2array - 2nip + [ lo-word ] keep hi-word make-RECT get-RECT-dimensions 2array 2nip dup { 0 0 } = [ 2drop ] [ swap window set-gadget-dim ui-step ] if ; : wm-keydown-codes ( -- key ) @@ -348,7 +347,10 @@ M: windows-ui-backend (close-window) : event-loop ( msg -- ) { { [ windows get empty? ] [ drop ] } - { [ dup peek-message? ] [ >r [ ui-step ] ui-try r> event-loop ] } + { [ dup peek-message? ] [ + >r [ ui-step 10 sleep ] ui-try + r> event-loop + ] } { [ dup MSG-message WM_QUIT = ] [ drop ] } { [ t ] [ dup TranslateMessage drop diff --git a/extra/ui/x11/x11.factor b/extra/ui/x11/x11.factor index 857b13a973..2b1a5ba331 100755 --- a/extra/ui/x11/x11.factor +++ b/extra/ui/x11/x11.factor @@ -178,7 +178,7 @@ M: world client-event next-event dup None XFilterEvent zero? [ drop wait-event ] unless ] [ - ui-step wait-event + ui-step 10 sleep wait-event ] if ; : do-events ( -- )