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