Revision: 3718 Author: johnmci Date: 2016-05-14 15:43:36 -0700 (Sat, 14 May 2016) Log Message: ----------- JMM add logic to support headless as a null windowview object to reduce drawing overhead, fix headless VM support Modified Paths: -------------- branches/Cog/platforms/iOS/vm/Common/Classes/sqSqueakEventsAPI.m branches/Cog/platforms/iOS/vm/Common/Classes/sqSqueakScreenAPI.m branches/Cog/platforms/iOS/vm/Common/Classes/sqSqueakScreenAndWindow.h branches/Cog/platforms/iOS/vm/Common/Classes/sqSqueakScreenAndWindow.m branches/Cog/platforms/iOS/vm/OSX/SqueakOSXAppDelegate.h branches/Cog/platforms/iOS/vm/OSX/SqueakOSXAppDelegate.m branches/Cog/platforms/iOS/vm/OSX/SqueakOSXApplication.m branches/Cog/platforms/iOS/vm/OSX/sqSqueakOSXApplication.m branches/Cog/platforms/iOS/vm/OSX/sqSqueakOSXDropAPI.m branches/Cog/platforms/iOS/vm/OSX/sqSqueakOSXOpenGLView.m branches/Cog/platforms/iOS/vm/OSX/sqSqueakOSXScreenAndWindow.h branches/Cog/platforms/iOS/vm/OSX/sqSqueakOSXScreenAndWindow.m Added Paths: ----------- branches/Cog/platforms/iOS/vm/OSX/sqSqueakNullScreenAndWindow.h branches/Cog/platforms/iOS/vm/OSX/sqSqueakNullScreenAndWindow.m Modified: branches/Cog/platforms/iOS/vm/Common/Classes/sqSqueakEventsAPI.m =================================================================== --- branches/Cog/platforms/iOS/vm/Common/Classes/sqSqueakEventsAPI.m 2016-05-14 21:02:58 UTC (rev 3717) +++ branches/Cog/platforms/iOS/vm/Common/Classes/sqSqueakEventsAPI.m 2016-05-14 22:43:36 UTC (rev 3718) @@ -40,13 +40,13 @@ #import "sqSqueakAppDelegate.h" #import "sqSqueakEventsAPI.h" #import "sqSqueakMainApplication+events.h" -#import "sqSqueakScreenAndWindow.h" +#import "sqSqueakNullScreenAndWindow.h" #import "sqaio.h" extern sqSqueakAppDelegate *gDelegateApp; extern struct VirtualMachine* interpreterProxy; extern BOOL gQuitNowRightNow; -extern sqSqueakScreenAndWindow *getMainWindowDelegate(); +extern sqSqueakNullScreenAndWindow *getMainWindowDelegate(); void nativeIoProcessEvents(void) { Modified: branches/Cog/platforms/iOS/vm/Common/Classes/sqSqueakScreenAPI.m =================================================================== --- branches/Cog/platforms/iOS/vm/Common/Classes/sqSqueakScreenAPI.m 2016-05-14 21:02:58 UTC (rev 3717) +++ branches/Cog/platforms/iOS/vm/Common/Classes/sqSqueakScreenAPI.m 2016-05-14 22:43:36 UTC (rev 3718) @@ -51,7 +51,7 @@ #endif -sqSqueakScreenAndWindow *getMainWindowDelegate() { +sqSqueakNullScreenAndWindow *getMainWindowDelegate() { #ifdef BUILD_FOR_OSX return ((__bridge NSWindow *) windowHandleFromIndex(1)).delegate; #else Modified: branches/Cog/platforms/iOS/vm/Common/Classes/sqSqueakScreenAndWindow.h =================================================================== --- branches/Cog/platforms/iOS/vm/Common/Classes/sqSqueakScreenAndWindow.h 2016-05-14 21:02:58 UTC (rev 3717) +++ branches/Cog/platforms/iOS/vm/Common/Classes/sqSqueakScreenAndWindow.h 2016-05-14 22:43:36 UTC (rev 3718) @@ -38,38 +38,12 @@ // #import <Foundation/Foundation.h> -#import "sq.h" +#import "sqSqueakNullScreenAndWindow.h" -@interface sqSqueakScreenAndWindow : NSObject { - sqInt windowIndex; +@interface sqSqueakScreenAndWindow : sqSqueakNullScreenAndWindow { NSTimeInterval squeakUIFlushPrimaryDeferNMilliseconds; NSTimeInterval lastFlushTime; NSTimer *blip; - BOOL forceUpdateFlush; BOOL displayIsDirty; } - -- (sqInt) ioScreenSize; -- (sqInt) ioScreenDepth; -- (sqInt) ioHasDisplayDepth: (sqInt) depth; -- (void) ioForceDisplayUpdate; -- (void) ioSetFullScreen: (sqInt) fullScreen; -- (int) ioShowDisplayOnWindow: (unsigned char*) dispBitsIndex - width: (int) width - height: (int) height - depth: (int) depth - affectedL: (int) affectedL - affectedR: (int) affectedR - affectedT: (int) affectedT - affectedB: (int) affectedB - windowIndex: (int) windowIndex; -- (id) getMainView; -- (void) ioForceDisplayUpdateFlush: (NSTimer*)theTimer; -@property (nonatomic,assign) sqInt windowIndex; -@property (nonatomic,strong) NSTimer *blip; -@property (nonatomic,assign) NSTimeInterval squeakUIFlushPrimaryDeferNMilliseconds; -@property (nonatomic,assign) NSTimeInterval lastFlushTime; -@property (nonatomic,assign) BOOL forceUpdateFlush; -@property (nonatomic,assign) BOOL displayIsDirty; - @end Modified: branches/Cog/platforms/iOS/vm/Common/Classes/sqSqueakScreenAndWindow.m =================================================================== --- branches/Cog/platforms/iOS/vm/Common/Classes/sqSqueakScreenAndWindow.m 2016-05-14 21:02:58 UTC (rev 3717) +++ branches/Cog/platforms/iOS/vm/Common/Classes/sqSqueakScreenAndWindow.m 2016-05-14 22:43:36 UTC (rev 3718) @@ -61,9 +61,15 @@ ) { } +@interface sqSqueakScreenAndWindow() +@property (nonatomic,strong) NSTimer *blip; +@property (nonatomic,assign) NSTimeInterval squeakUIFlushPrimaryDeferNMilliseconds; +@property (nonatomic,assign) NSTimeInterval lastFlushTime; +@property (nonatomic,assign) BOOL displayIsDirty; +@end + @implementation sqSqueakScreenAndWindow -@synthesize windowIndex; -@synthesize blip,squeakUIFlushPrimaryDeferNMilliseconds,forceUpdateFlush,lastFlushTime,displayIsDirty; +@synthesize blip,squeakUIFlushPrimaryDeferNMilliseconds,lastFlushTime,displayIsDirty; - (instancetype)init { self = [super init]; @@ -77,13 +83,6 @@ return self; } -- (id) getMainView { - return NULL; -} - -- (void) ioSetFullScreen: (sqInt) fullScreen { -} - - (sqInt) ioScreenSize { sqInt w, h; @@ -100,25 +99,12 @@ } -- (sqInt) ioScreenDepth { - return 32; -} - -- (sqInt) ioHasDisplayDepth: (sqInt) depth { - if (depth == 2 || depth == 4 || depth == 8 || depth == 16 || depth == 32 || - depth == -2 || depth == -4 || depth == -8 || depth == -16 || depth == -32) { - return true; - } else { - return false; - } -} - -- (void) ioForceDisplayUpdateActual { - lastFlushTime = [NSDate timeIntervalSinceReferenceDate]; - self.displayIsDirty = NO; - self.forceUpdateFlush = NO; +- (void) ioForceDisplayUpdate { + lastFlushTime = [NSDate timeIntervalSinceReferenceDate]; + self.displayIsDirty = NO; + self.forceUpdateFlush = NO; - [[self getMainView] preDrawThelayers]; + [[self getMainView] preDrawThelayers]; //SQK-24 //[hidden email] iOS VM problems with dragging a morph and PasteUpMorph>>flashRects:color: @@ -131,10 +117,6 @@ } } -- (void) ioForceDisplayUpdate { - [self ioForceDisplayUpdateActual]; -} - - (int) ioShowDisplayOnWindowActual: (unsigned char*) dispBitsIndex width: (int) width height: (int) height Modified: branches/Cog/platforms/iOS/vm/OSX/SqueakOSXAppDelegate.h =================================================================== --- branches/Cog/platforms/iOS/vm/OSX/SqueakOSXAppDelegate.h 2016-05-14 21:02:58 UTC (rev 3717) +++ branches/Cog/platforms/iOS/vm/OSX/SqueakOSXAppDelegate.h 2016-05-14 22:43:36 UTC (rev 3718) @@ -42,7 +42,7 @@ #import "sqSqueakOSXOpenGLView.h" @class sqSqueakMainApplication; -@class sqSqueakOSXScreenAndWindow; +@class sqSqueakNullScreenAndWindow; @interface SqueakOSXAppDelegate : sqSqueakAppDelegate <NSApplicationDelegate> { NSWindow *__weak window; @@ -56,6 +56,6 @@ @property (nonatomic,weak) IBOutlet sqSqueakOSXOpenGLView *mainView; @property (nonatomic,strong) NSString *possibleImageNameAtLaunchTime; @property (nonatomic,assign) BOOL checkForFileNameOnFirstParm; -@property (nonatomic, strong) sqSqueakOSXScreenAndWindow *windowHandler; +@property (nonatomic, strong) sqSqueakNullScreenAndWindow *windowHandler; @end Modified: branches/Cog/platforms/iOS/vm/OSX/SqueakOSXAppDelegate.m =================================================================== --- branches/Cog/platforms/iOS/vm/OSX/SqueakOSXAppDelegate.m 2016-05-14 21:02:58 UTC (rev 3717) +++ branches/Cog/platforms/iOS/vm/OSX/SqueakOSXAppDelegate.m 2016-05-14 22:43:36 UTC (rev 3718) @@ -81,13 +81,6 @@ @autoreleasepool { gDelegateApp = self; self.squeakApplication = [self makeApplicationInstance]; - self.windowHandler = AUTORELEASEOBJ([[sqSqueakOSXScreenAndWindow alloc] init]); - windowHandler.mainViewOnWindow = self.mainView; - self.mainView.windowLogic = windowHandler; - windowHandler.windowIndex = 1; - [windowHandler.mainViewOnWindow initializeVariables]; - self.window.delegate = windowHandler; - self.window.contentResizeIncrements = NSMakeSize(8.0f,8.0f); [self.squeakApplication setupEventQueue]; [self singleThreadStart]; // [self workerThreadStart]; @@ -105,7 +98,29 @@ return NSTerminateCancel; } +- (void) initializeTheWindowHandler { + [windowHandler mainViewOnWindow: self.mainView]; + self.mainView.windowLogic = windowHandler; + windowHandler.windowIndex = 1; + [windowHandler.getMainViewOnWindow initializeVariables]; + self.window.delegate = windowHandler; + self.window.contentView = self.mainView; +} + -(void) setupWindow { + extern BOOL gSqueakHeadless; + if (gSqueakHeadless) { + self.windowHandler = AUTORELEASEOBJ([[sqSqueakNullScreenAndWindow alloc] init]); + [self initializeTheWindowHandler]; + return; + } else { + self.windowHandler = AUTORELEASEOBJ([[sqSqueakOSXScreenAndWindow alloc] init]); + } + + + [self initializeTheWindowHandler]; + self.window.contentResizeIncrements = NSMakeSize(8.0f,8.0f); + //I setup the window with all the right properties. Some of them are depending on image information. sqInt width,height; @@ -129,59 +144,17 @@ [self.window setRepresentedURL: [[self squeakApplication] imageNameURL]]; [self.window setInitialFirstResponder: [self mainView]]; [self.window setShowsResizeIndicator: NO]; - - extern sqInt getFullScreenFlag(void); -#if (SQ_VI_BYTES_PER_WORD == 4) - NSPanel *panel; - if (sizeof(void*) == 8) { - panel= NSGetAlertPanel(@"About this Alpha Version of Cocoa Squeak 64/32 bits 5.7b3 (21)", - @"Only use this VM for testing, it lacks mac menu integration.", - @"Dismiss", - nil, - nil); - } else { - return; - } -#else - NSPanel *panel; - if (sizeof(long) == 8) { - panel= NSGetAlertPanel(@"About this Alpha Version of Cocoa Squeak 64/64 bits 5.7b3 (21)", - @"Only use this VM for testing, it lacks mac menu integration.", - @"Dismiss", - nil, - nil); - } else { - panel= NSGetAlertPanel(@"About this Alpha Version of Cocoa Squeak 32/64 bits 5.7b3 (21)", - @"Only use this VM for testing, it lacks mac menu integration.", - @"Dismiss", - nil, - nil); - } -#endif - -/* NSRect frame= [panel frame]; - frame.size.width *= 1.5f; - [panel setFrame: frame display: NO]; - [NSApp runModalForWindow: panel]; - [panel close]; -*/ } -(void) setupMainView { - //Creates and sets the contentView for our window. + extern BOOL gSqueakHeadless; + if (gSqueakHeadless) { + return; + } + //Creates and sets the contentView for our window. //It can right now, I have two implementations to pick (CoreGraphics or OpenGL), muy more/different could be added //in the future. - NSView *view = AUTORELEASEOBJ([[ContentViewClass alloc] initWithFrame:[[self window] frame]]); - self.mainView = (id) view; - [[self window] setContentView: view]; - - [windowHandler setMainViewOnWindow: (sqSqueakOSXOpenGLView *) view]; - [(sqSqueakOSXOpenGLView *) view setWindowLogic: windowHandler]; - [windowHandler setWindowIndex: 1]; - [[windowHandler mainViewOnWindow] initializeVariables]; - [[self window] setDelegate:windowHandler]; - [[self window] setContentResizeIncrements:NSMakeSize(8.0f,8.0f)]; } - (id) createPossibleWindow { Modified: branches/Cog/platforms/iOS/vm/OSX/SqueakOSXApplication.m =================================================================== --- branches/Cog/platforms/iOS/vm/OSX/SqueakOSXApplication.m 2016-05-14 21:02:58 UTC (rev 3717) +++ branches/Cog/platforms/iOS/vm/OSX/SqueakOSXApplication.m 2016-05-14 22:43:36 UTC (rev 3718) @@ -50,7 +50,7 @@ sqSqueakOSXScreenAndWindow *squeakScreenWindow = (sqSqueakOSXScreenAndWindow *) who.delegate; sqSqueakOSXOpenGLView *view; if (squeakScreenWindow) - view = squeakScreenWindow.mainViewOnWindow; + view = [squeakScreenWindow getMainViewOnWindow]; else view = [who contentView]; [view fakeKeyDownUp: anEvent]; Added: branches/Cog/platforms/iOS/vm/OSX/sqSqueakNullScreenAndWindow.h =================================================================== --- branches/Cog/platforms/iOS/vm/OSX/sqSqueakNullScreenAndWindow.h (rev 0) +++ branches/Cog/platforms/iOS/vm/OSX/sqSqueakNullScreenAndWindow.h 2016-05-14 22:43:36 UTC (rev 3718) @@ -0,0 +1,69 @@ +// +// sqSqueakNullScreenAndWindow.h +// SqueakPureObjc +// +// Created by John M McIntosh on 2016-05-14. +/* + Copyright (c) 2016 Corporate Smalltalk Consulting Ltd. All rights reserved. + MIT License + Permission is hereby granted, free of charge, to any person + obtaining a copy of this software and associated documentation + files (the "Software"), to deal in the Software without + restriction, including without limitation the rights to use, + copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the + Software is furnished to do so, subject to the following + conditions: + + The above copyright notice and this permission notice shall be + included in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES + OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + OTHER DEALINGS IN THE SOFTWARE. + + The end-user documentation included with the redistribution, if any, must include the following acknowledgment: + "This product includes software developed by Corporate Smalltalk Consulting Ltd (http://www.smalltalkconsulting.com) + and its contributors", in the same place and form as other third-party acknowledgments. + Alternately, this acknowledgment may appear in the software itself, in the same form and location as other + such third-party acknowledgments. + + */ +// +// + +#import <Foundation/Foundation.h> +#import "sq.h" + +@interface sqSqueakNullScreenAndWindow : NSObject { + sqInt windowIndex; + BOOL forceUpdateFlush; +} + +- (sqInt) ioScreenSize; +- (sqInt) ioScreenDepth; +- (sqInt) ioHasDisplayDepth: (sqInt) depth; +- (void) ioForceDisplayUpdate; +- (void) ioSetFullScreen: (sqInt) fullScreen; +- (int) ioShowDisplayOnWindow: (unsigned char*) dispBitsIndex + width: (int) width + height: (int) height + depth: (int) depth + affectedL: (int) affectedL + affectedR: (int) affectedR + affectedT: (int) affectedT + affectedB: (int) affectedB + windowIndex: (int) windowIndex; +- (id) getMainView; +- (void) ioForceDisplayUpdateFlush: (NSTimer*)theTimer; +- (id) getMainViewOnWindow; +- (void) mainViewOnWindow: (id) aView; + +@property (nonatomic,assign) sqInt windowIndex; +@property (nonatomic,assign) BOOL forceUpdateFlush; +@end Added: branches/Cog/platforms/iOS/vm/OSX/sqSqueakNullScreenAndWindow.m =================================================================== --- branches/Cog/platforms/iOS/vm/OSX/sqSqueakNullScreenAndWindow.m (rev 0) +++ branches/Cog/platforms/iOS/vm/OSX/sqSqueakNullScreenAndWindow.m 2016-05-14 22:43:36 UTC (rev 3718) @@ -0,0 +1,103 @@ +// +// sqSqueakNullScreenAndWindow.m +// SqueakPureObjc +// +// Created by John M McIntosh on 2016-05-14. +/* + Copyright (c) 2016 Corporate Smalltalk Consulting Ltd. All rights reserved. + MIT License + Permission is hereby granted, free of charge, to any person + obtaining a copy of this software and associated documentation + files (the "Software"), to deal in the Software without + restriction, including without limitation the rights to use, + copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the + Software is furnished to do so, subject to the following + conditions: + + The above copyright notice and this permission notice shall be + included in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES + OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + OTHER DEALINGS IN THE SOFTWARE. + + The end-user documentation included with the redistribution, if any, must include the following acknowledgment: + "This product includes software developed by Corporate Smalltalk Consulting Ltd (http://www.smalltalkconsulting.com) + and its contributors", in the same place and form as other third-party acknowledgments. + Alternately, this acknowledgment may appear in the software itself, in the same form and location as other + such third-party acknowledgments. + + */ + +// +// + +#import "sqSqueakNullScreenAndWindow.h" + +@implementation sqSqueakNullScreenAndWindow +@synthesize windowIndex,forceUpdateFlush; + +- (instancetype)init { + self = [super init]; + if (self) { + } + return self; +} + +- (id) getMainViewOnWindow { + return NULL; +} + +- (void) mainViewOnWindow: (id) aView { +} + +- (id) getMainView { + return NULL; +} + +- (void) ioSetFullScreen: (sqInt) fullScreen { +} + +- (sqInt) ioScreenSize { + return (10 << 16) | (10 & 0xFFFF); /* w is high 16 bits; h is low 16 bits */ +} + +- (sqInt) ioScreenDepth { + return 32; +} + +- (sqInt) ioHasDisplayDepth: (sqInt) depth { + if (depth == 2 || depth == 4 || depth == 8 || depth == 16 || depth == 32 || + depth == -2 || depth == -4 || depth == -8 || depth == -16 || depth == -32) { + return true; + } else { + return false; + } +} + +- (void) ioForceDisplayUpdate { +} + +- (void) ioForceDisplayUpdateFlush: (NSTimer*)theTimer { + +} + +- (int) ioShowDisplayOnWindow: (unsigned char*) dispBitsIndex + width: (int) width + height: (int) height + depth: (int) depth + affectedL: (int) affectedL + affectedR: (int) affectedR + affectedT: (int) affectedT + affectedB: (int) affectedB + windowIndex: (int) passedWindowIndex { + return 0; +} + +@end Modified: branches/Cog/platforms/iOS/vm/OSX/sqSqueakOSXApplication.m =================================================================== --- branches/Cog/platforms/iOS/vm/OSX/sqSqueakOSXApplication.m 2016-05-14 21:02:58 UTC (rev 3717) +++ branches/Cog/platforms/iOS/vm/OSX/sqSqueakOSXApplication.m 2016-05-14 22:43:36 UTC (rev 3718) @@ -104,7 +104,7 @@ } - (void) doHeadlessSetup { - [super doHeadlessSetup]; + //No super call here as we've already set headless from command line or info.plist extern BOOL gSqueakHeadless; // Notice that setActivationPolicy: is available in OSX 10.6 and later if ([NSApp respondsToSelector:@selector(setActivationPolicy:)]) { @@ -147,7 +147,6 @@ - (int) parseArgument: (NSString *) argData peek: (char *) peek { - if ([argData isEqualToString: @"--"]) { return 1; } @@ -344,41 +343,54 @@ - (void) parseArgs: (NSArray *) args { - commandLineArguments = [args copyWithZone:null]; - argsArguments = [[NSMutableArray alloc] initWithCapacity: [args count]]; - - if ([args count] < 2) - return; - //NSLog(@"%@",args); - int i; - BOOL optionsCompleted = NO; - for (i = 1; i < [args count]; i++) { - NSString *argData = args[i]; - char *peek = i + 1 >= [args count] ? 0 : (char *)[args[i+1] UTF8String]; - //printf("argData %s peek %s\n", [argData UTF8String], peek ? peek : "NULL"); - if ([argData isEqualToString: @"--"]) { - optionsCompleted = YES; - continue; - } - if (!optionsCompleted && ![[argData substringToIndex: 1] isEqualToString: @"-"]) { - optionsCompleted = YES; - //guessing first parameter as image name - if ([argData compare: @"--"] != NSOrderedSame) + commandLineArguments = [args copyWithZone:null]; + argsArguments = [[NSMutableArray alloc] initWithCapacity: [args count]]; + + if ([args count] < 2) + return; + NSMutableArray *revisedArgs = AUTORELEASEOBJ([args mutableCopyWithZone: NULL]); + [revisedArgs removeObjectAtIndex:0]; + + NSUInteger i,result; + BOOL optionsCompleted = NO; + for (i=0; i<[revisedArgs count]; i++) { + NSString *argData = revisedArgs[i]; + + NSString *peek = (i == ([revisedArgs count] - 1)) ? @"" : revisedArgs[i+1]; + + if ([argData isEqualToString: @"-NSDocumentRevisionsDebugMode"]) { + //This is an Xcode debug option, skip it for us + i++; + continue; + } + if ([argData compare: @"--"] == NSOrderedSame) { + optionsCompleted = YES; + continue; + } + if (!optionsCompleted && ![[argData substringToIndex: 1] isEqualToString: @"-"]) { + optionsCompleted = YES; + + //guessing first parameter as image name + if ([argData compare: @"--"] != NSOrderedSame) { [self setImageNamePathIfItWasReadable:argData]; - continue; - } - if (optionsCompleted) - [self.argsArguments addObject: argData]; - else { - int result = [self parseArgument: argData peek: peek]; - if (result <= 0) { /* option not recognised */ - fprintf(stderr, "unknown option: %s\n", [argData UTF8String]); - [self usage]; - exit(1); - } - i += result - 1; - } - } + } else { + continue; + } + } + if (optionsCompleted) { + [self.argsArguments addObject: argData]; + } else { + result = [self parseArgument: argData peek: peek.UTF8String]; + if (result == 0) /* option not recognised */ { + fprintf(stderr, "unknown option: %s\n", [argData UTF8String]); + [self usage]; + exit(1); + } + if (result == 2) + i++; + } + + } } - (long long) strtobkm: (const char *) str { Modified: branches/Cog/platforms/iOS/vm/OSX/sqSqueakOSXDropAPI.m =================================================================== --- branches/Cog/platforms/iOS/vm/OSX/sqSqueakOSXDropAPI.m 2016-05-14 21:02:58 UTC (rev 3717) +++ branches/Cog/platforms/iOS/vm/OSX/sqSqueakOSXDropAPI.m 2016-05-14 22:43:36 UTC (rev 3718) @@ -53,7 +53,7 @@ char* dropRequestFileName(sqInt dropIndex) { /* return name of file or NULL if error */ - sqSqueakOSXOpenGLView *view = ((sqSqueakOSXScreenAndWindow*)((__bridge NSWindow *)windowHandleFromIndex(1)).delegate).mainViewOnWindow; + sqSqueakOSXOpenGLView *view = [((sqSqueakOSXScreenAndWindow*)((__bridge NSWindow *)windowHandleFromIndex(1)).delegate) getMainViewOnWindow]; NSString *fileNameString = [view dragFileNameStringAtIndex: dropIndex]; return (char *) [fileNameString UTF8String]; } Modified: branches/Cog/platforms/iOS/vm/OSX/sqSqueakOSXOpenGLView.m =================================================================== --- branches/Cog/platforms/iOS/vm/OSX/sqSqueakOSXOpenGLView.m 2016-05-14 21:02:58 UTC (rev 3717) +++ branches/Cog/platforms/iOS/vm/OSX/sqSqueakOSXOpenGLView.m 2016-05-14 22:43:36 UTC (rev 3718) @@ -175,12 +175,6 @@ } - (void) drawThelayers { - extern BOOL gSqueakHeadless; - if (gSqueakHeadless) { - firstDrawCompleted = YES; - return; - } - if (syncNeeded) { [self drawRect: NSRectFromCGRect(clippy)]; syncNeeded = NO; Modified: branches/Cog/platforms/iOS/vm/OSX/sqSqueakOSXScreenAndWindow.h =================================================================== --- branches/Cog/platforms/iOS/vm/OSX/sqSqueakOSXScreenAndWindow.h 2016-05-14 21:02:58 UTC (rev 3717) +++ branches/Cog/platforms/iOS/vm/OSX/sqSqueakOSXScreenAndWindow.h 2016-05-14 22:43:36 UTC (rev 3718) @@ -43,6 +43,8 @@ @interface sqSqueakOSXScreenAndWindow : sqSqueakScreenAndWindow <NSWindowDelegate>{ sqSqueakOSXOpenGLView *mainViewOnWindow; } -@property (nonatomic,strong) sqSqueakOSXOpenGLView *mainViewOnWindow; +- (sqSqueakOSXOpenGLView *) getMainViewOnWindow; +- (void) mainViewOnWindow: (sqSqueakOSXOpenGLView *) aView; + @end Modified: branches/Cog/platforms/iOS/vm/OSX/sqSqueakOSXScreenAndWindow.m =================================================================== --- branches/Cog/platforms/iOS/vm/OSX/sqSqueakOSXScreenAndWindow.m 2016-05-14 21:02:58 UTC (rev 3717) +++ branches/Cog/platforms/iOS/vm/OSX/sqSqueakOSXScreenAndWindow.m 2016-05-14 22:43:36 UTC (rev 3718) @@ -45,6 +45,10 @@ extern SqueakOSXAppDelegate *gDelegateApp; +@interface sqSqueakOSXScreenAndWindow() + @property (nonatomic,strong) sqSqueakOSXOpenGLView *mainViewOnWindow; +@end + @implementation sqSqueakOSXScreenAndWindow @synthesize mainViewOnWindow; @@ -52,6 +56,14 @@ return self.mainViewOnWindow; } +- (void) mainViewOnWindow: (id) aView { + self.mainViewOnWindow = aView; +} + +- (sqSqueakOSXOpenGLView *) getMainViewOnWindow { + return self.mainViewOnWindow; +} + - (void) dealloc { RELEASEOBJ(mainViewOnWindow); SUPERDEALLOC |
Hi John,
Do you have any numbers on how big this overhead is/was? I'm curious :) Best, Fabio -- On Sun, May 15, 2016 at 12:43 AM <[hidden email]> wrote:
|
Over in sqSqueakScreenAndWindow We managed the clip area and the timer for flushing the screen based on the incoming draw requests, and morphic sync. These are the raw abstraction points for drawing. In a flush or force update we would then call the subclass view implementation to do the draw, in this case the open/gl logic. In that logic we checked to see if we were headless and avoided the actual draw. The new logic abstracts the sqSqueakScreenAndWindow further into a new superclass where we do nothing for the VM screen calls except say we are supporting a 10x10 32bit view. So the actual implementation for draw & flush is nothing thus avoiding the clip area management (trivial). But we also avoid setup of a timer which is scheduled on the run loop and it's management. Although non-trivial I think the overhead couldn't really be measured either. Sent from my iPhone
smime.p7s (6K) Download Attachment |
Thanks for the clarification, John! That makes sense :)
Fabio -- On Tue, May 17, 2016 at 11:15 AM John McIntosh <[hidden email]> wrote:
|
Free forum by Nabble | Edit this page |