ui.backend.cocoa: fix reset of thread-timer.

db4
John Benediktsson 2015-01-17 15:58:57 -08:00
parent a85543a42f
commit 3f3c11c446
3 changed files with 8 additions and 5 deletions

View File

@ -103,13 +103,16 @@ SYMBOL: run-loop
SYMBOL: thread-timer SYMBOL: thread-timer
: reset-thread-timer ( timer -- ) : (reset-thread-timer) ( timer -- )
sleep-time sleep-time
[ 1000 /f ] [ 1,000,000 ] if* system-micros + [ 1000 /f ] [ 1,000,000 ] if* system-micros +
>CFAbsoluteTime CFRunLoopTimerSetNextFireDate ; >CFAbsoluteTime CFRunLoopTimerSetNextFireDate ;
: reset-thread-timer ( -- )
thread-timer get-global (reset-thread-timer) ;
: thread-timer-callback ( -- callback ) : thread-timer-callback ( -- callback )
[ drop reset-thread-timer yield ] CFRunLoopTimerCallBack ; [ drop (reset-thread-timer) yield ] CFRunLoopTimerCallBack ;
: init-thread-timer ( -- ) : init-thread-timer ( -- )
60 thread-timer-callback <CFTimer> 60 thread-timer-callback <CFTimer>

View File

@ -14,7 +14,7 @@ TUPLE: run-loop-mx kqueue-mx ;
2drop 2drop
0 mx get-global kqueue-mx>> wait-for-events 0 mx get-global kqueue-mx>> wait-for-events
enable-all-callbacks enable-all-callbacks
thread-timer get-global reset-thread-timer reset-thread-timer
yield yield
] CFFileDescriptorCallBack ; ] CFFileDescriptorCallBack ;

View File

@ -234,7 +234,7 @@ M: cocoa-ui-backend system-alert
CLASS: FactorApplicationDelegate < NSObject CLASS: FactorApplicationDelegate < NSObject
[ [
METHOD: void applicationDidUpdate: id obj METHOD: void applicationDidUpdate: id obj
[ reset-run-loop ] [ reset-thread-timer ]
] ]
: install-app-delegate ( -- ) : install-app-delegate ( -- )
@ -254,7 +254,7 @@ M: cocoa-ui-backend (with-ui)
start-ui start-ui
stop-io-thread stop-io-thread
init-thread-timer init-thread-timer
reset-run-loop reset-thread-timer
NSApp -> run NSApp -> run
] ui-running ] ui-running
] with-cocoa ; ] with-cocoa ;