Further Cocoa fixes

release
slava 2006-03-13 06:12:26 +00:00
parent 60945fa05e
commit 40d2f9bb61
2 changed files with 9 additions and 14 deletions

View File

@ -25,17 +25,10 @@ objc-NSObject objc-NSView threads ;
: do-events ( app -- ) : do-events ( app -- )
dup next-event [ dupd [sendEvent:] do-events ] [ drop ] if* ; dup next-event [ dupd [sendEvent:] do-events ] [ drop ] if* ;
: (event-loop) ( -- ) : event-loop ( -- )
[ [
NSApplication [sharedApplication] do-events world-step NSApplication [sharedApplication] do-events world-step
] with-autorelease-pool 10 sleep (event-loop) ; ] with-autorelease-pool 10 sleep event-loop ;
: event-loop ( -- )
\ NSApplication get expired? [
NSApplication [sharedApplication]
\ NSApplication set-global
[ (event-loop) ] in-thread
] when ;
IN: errors IN: errors

View File

@ -1,9 +1,9 @@
! Copyright (C) 2006 Slava Pestov. ! Copyright (C) 2006 Slava Pestov.
! See http://factor.sf.net/license.txt for BSD license. ! See http://factor.sf.net/license.txt for BSD license.
USING: alien arrays cocoa freetype gadgets gadgets-layouts USING: alien arrays cocoa freetype gadgets gadgets-layouts
gadgets-listener kernel namespaces objc objc-NSApplication gadgets-listener io kernel namespaces objc objc-NSApplication
objc-NSObject objc-NSOpenGLContext objc-NSOpenGLView objc-NSView objc-NSObject objc-NSOpenGLContext objc-NSOpenGLView objc-NSView
objc-NSWindow opengl sequences threads walker ; objc-NSWindow opengl prettyprint sequences threads walker ;
IN: gadgets-cocoa IN: gadgets-cocoa
! Cocoa backend for Factor UI ! Cocoa backend for Factor UI
@ -66,9 +66,11 @@ USE: objc-FactorView
[ [
[ [
init-world init-world
listener-application
world get ui-title <FactorWindow> drop world get ui-title <FactorWindow>
[contentView] [openGLContext] [makeCurrentContext]
listener-application
event-loop event-loop
] with-cocoa ] with-cocoa