From 40d2f9bb61468578a08b61ac98e3ee780f467555 Mon Sep 17 00:00:00 2001 From: slava Date: Mon, 13 Mar 2006 06:12:26 +0000 Subject: [PATCH] Further Cocoa fixes --- library/cocoa/application-utils.factor | 11 ++--------- library/cocoa/ui.factor | 12 +++++++----- 2 files changed, 9 insertions(+), 14 deletions(-) diff --git a/library/cocoa/application-utils.factor b/library/cocoa/application-utils.factor index 00c363de40..b0095f1e7d 100644 --- a/library/cocoa/application-utils.factor +++ b/library/cocoa/application-utils.factor @@ -25,17 +25,10 @@ objc-NSObject objc-NSView threads ; : do-events ( app -- ) dup next-event [ dupd [sendEvent:] do-events ] [ drop ] if* ; -: (event-loop) ( -- ) +: event-loop ( -- ) [ NSApplication [sharedApplication] do-events world-step - ] with-autorelease-pool 10 sleep (event-loop) ; - -: event-loop ( -- ) - \ NSApplication get expired? [ - NSApplication [sharedApplication] - \ NSApplication set-global - [ (event-loop) ] in-thread - ] when ; + ] with-autorelease-pool 10 sleep event-loop ; IN: errors diff --git a/library/cocoa/ui.factor b/library/cocoa/ui.factor index 7163b619d3..f4e49a19e4 100644 --- a/library/cocoa/ui.factor +++ b/library/cocoa/ui.factor @@ -1,9 +1,9 @@ ! Copyright (C) 2006 Slava Pestov. ! See http://factor.sf.net/license.txt for BSD license. 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-NSWindow opengl sequences threads walker ; +objc-NSWindow opengl prettyprint sequences threads walker ; IN: gadgets-cocoa ! Cocoa backend for Factor UI @@ -66,10 +66,12 @@ USE: objc-FactorView [ [ init-world + + world get ui-title + + [contentView] [openGLContext] [makeCurrentContext] listener-application - - world get ui-title drop - + event-loop ] with-cocoa ] with-freetype