diff --git a/TODO.FACTOR.txt b/TODO.FACTOR.txt index a7ea65e9de..51d6279a4b 100644 --- a/TODO.FACTOR.txt +++ b/TODO.FACTOR.txt @@ -8,7 +8,6 @@ - x86 %box-struct - x86 %write-barrier - OS X stuff: - - look for image in bundle - set resource path to bundle path - link in freetype statically @@ -29,6 +28,9 @@ + ui/help: +- add some padding to launchpad ui +- saving the image should save window configuration +- memory leaks - menu drag retarget broken - hang when scrolling - hang with multiple windows diff --git a/library/cocoa/core-foundation.factor b/library/cocoa/core-foundation.factor index 27345f8d7c..38bf7cd977 100644 --- a/library/cocoa/core-foundation.factor +++ b/library/cocoa/core-foundation.factor @@ -1,8 +1,8 @@ ! Copyright (C) 2006 Slava Pestov ! See http://factorcode.org/license.txt for BSD license. IN: cocoa -USING: alien arrays errors hashtables kernel math namespaces -sequences ; +USING: alien arrays errors hashtables kernel math memory +namespaces sequences ; TYPEDEF: int CFIndex @@ -28,12 +28,6 @@ FUNCTION: CFIndex CFStringGetLength ( void* string ) ; FUNCTION: void* CFBundleCreate ( void* allocator, void* bundleURL ) ; -FUNCTION: void* CFBundleGetMainBundle ( ) ; - -FUNCTION: void* CFBundleCopyExecutableURL ( void* bundle ) ; - -FUNCTION: void* CFBundleGetFunctionPointerForName ( void* bundle, void* functionName ) ; - FUNCTION: bool CFBundleLoadExecutable ( void* bundle ) ; FUNCTION: void CFRelease ( void* cf ) ; @@ -67,15 +61,9 @@ FUNCTION: void CFRelease ( void* cf ) ; "Cannot load bundled named " swap append throw ] ?if ; -: executable ( -- path ) - CFBundleGetMainBundle CFBundleCopyExecutableURL [ - kCFURLPOSIXPathStyle CFURLCopyFileSystemPath - [ CF>string ] keep CFRelease - ] keep CFRelease ; - : running.app? ( -- ? ) #! Test if we're running Factor.app. - executable "Contents/MacOS/Factor" tail? ; + "Contents/Resources" image subseq? ; IN: kernel diff --git a/library/cocoa/ui.factor b/library/cocoa/ui.factor index 1653eb0a4a..5f0ab2b712 100644 --- a/library/cocoa/ui.factor +++ b/library/cocoa/ui.factor @@ -1,6 +1,6 @@ ! Copyright (C) 2006 Slava Pestov. ! See http://factorcode.org/license.txt for BSD license. -USING: arrays cocoa freetype gadgets gadgets-launchpad +USING: arrays cocoa errors freetype gadgets gadgets-launchpad gadgets-layouts gadgets-listener gadgets-panes hashtables kernel lists math namespaces objc objc-NSApplication objc-NSEvent objc-NSObject objc-NSOpenGLView objc-NSView objc-NSWindow @@ -159,6 +159,9 @@ IN: gadgets IN: shells : ui + running.app? [ + "The Factor UI requires you to run the supplied Factor.app." throw + ] unless [ [ launchpad-window diff --git a/native/macosx/run.m b/native/macosx/run.m index 7851e21dfd..5545dac8ae 100644 --- a/native/macosx/run.m +++ b/native/macosx/run.m @@ -43,6 +43,6 @@ const char *default_image_path(void) { NSBundle *bundle = [NSBundle mainBundle]; NSString *path = [bundle bundlePath]; - NSString *image = [path stringByAppendingString:@"/Contents/factor.image"]; + NSString *image = [path stringByAppendingString:@"/Contents/Resources/factor.image"]; return [image cString]; }