[Vm-dev] [commit] r2281 - iOS 5.8b9 app quit and window close

commits at squeakvm.org commits at squeakvm.org
Tue Sep 7 02:39:17 UTC 2010


Author: johnmci
Date: 2010-09-06 19:39:16 -0700 (Mon, 06 Sep 2010)
New Revision: 2281

Added:
   trunk/platforms/iOS/vm/OSX/plugins/HostWindowPlugin/
   trunk/platforms/iOS/vm/OSX/plugins/HostWindowPlugin/sqMacHostWindow.h
   trunk/platforms/iOS/vm/OSX/plugins/HostWindowPlugin/sqMacHostWindow.m
Modified:
   trunk/platforms/iOS/vm/English.lproj/MainMenu.xib
   trunk/platforms/iOS/vm/OSX/SqueakOSXAppDelegate.m
   trunk/platforms/iOS/vm/OSX/sqSqueakOSXApplication+attributes.m
   trunk/platforms/iOS/vm/OSX/sqSqueakOSXApplication+events.h
   trunk/platforms/iOS/vm/OSX/sqSqueakOSXApplication+events.m
   trunk/platforms/iOS/vm/OSX/sqSqueakOSXScreenAndWindow.m
   trunk/platforms/iOS/vm/SqueakPureObjc-InfoCOG.plist
Log:
iOS 5.8b9  app quit and window close
Ensure window close send a host window close window event. Ensure the default file quite just then attempts a close window. Smalltalk code has to handle what the host window close event means

Modified: trunk/platforms/iOS/vm/English.lproj/MainMenu.xib
===================================================================
--- trunk/platforms/iOS/vm/English.lproj/MainMenu.xib	2010-09-05 03:39:36 UTC (rev 2280)
+++ trunk/platforms/iOS/vm/English.lproj/MainMenu.xib	2010-09-07 02:39:16 UTC (rev 2281)
@@ -1,14 +1,14 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <archive type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="7.10">
 	<data>
-		<int key="IBDocument.SystemTarget">1050</int>
-		<string key="IBDocument.SystemVersion">10D573</string>
-		<string key="IBDocument.InterfaceBuilderVersion">762</string>
+		<int key="IBDocument.SystemTarget">1060</int>
+		<string key="IBDocument.SystemVersion">10F569</string>
+		<string key="IBDocument.InterfaceBuilderVersion">804</string>
 		<string key="IBDocument.AppKitVersion">1038.29</string>
-		<string key="IBDocument.HIToolboxVersion">460.00</string>
+		<string key="IBDocument.HIToolboxVersion">461.00</string>
 		<object class="NSMutableDictionary" key="IBDocument.PluginVersions">
 			<string key="NS.key.0">com.apple.InterfaceBuilder.CocoaPlugin</string>
-			<string key="NS.object.0">762</string>
+			<string key="NS.object.0">804</string>
 		</object>
 		<object class="NSMutableArray" key="IBDocument.EditedObjectIDs">
 			<bool key="EncodedWithXMLCoder">YES</bool>
@@ -19,13 +19,8 @@
 			<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
 		</object>
 		<object class="NSMutableDictionary" key="IBDocument.Metadata">
-			<bool key="EncodedWithXMLCoder">YES</bool>
-			<object class="NSArray" key="dict.sortedKeys" id="0">
-				<bool key="EncodedWithXMLCoder">YES</bool>
-			</object>
-			<object class="NSMutableArray" key="dict.values">
-				<bool key="EncodedWithXMLCoder">YES</bool>
-			</object>
+			<string key="NS.key.0">PluginDependencyRecalculationVersion</string>
+			<integer value="1" key="NS.object.0"/>
 		</object>
 		<object class="NSMutableArray" key="IBDocument.RootObjects" id="1048">
 			<bool key="EncodedWithXMLCoder">YES</bool>
@@ -496,7 +491,7 @@
 				<string key="NSName">_NSMainMenu</string>
 			</object>
 			<object class="NSWindowTemplate" id="972006081">
-				<int key="NSWindowStyleMask">13</int>
+				<int key="NSWindowStyleMask">15</int>
 				<int key="NSWindowBacking">2</int>
 				<string key="NSWindowRect">{{335, 390}, {480, 360}}</string>
 				<int key="NSWTFlags">880279552</int>
@@ -753,7 +748,9 @@
 					<bool key="EncodedWithXMLCoder">YES</bool>
 					<object class="IBObjectRecord">
 						<int key="objectID">0</int>
-						<reference key="object" ref="0"/>
+						<object class="NSArray" key="object" id="0">
+							<bool key="EncodedWithXMLCoder">YES</bool>
+						</object>
 						<reference key="children" ref="1048"/>
 						<nil key="parent"/>
 					</object>
@@ -1418,9 +1415,28 @@
 							<string>NSWindow</string>
 						</object>
 					</object>
+					<object class="NSMutableDictionary" key="toOneOutletInfosByName">
+						<bool key="EncodedWithXMLCoder">YES</bool>
+						<object class="NSArray" key="dict.sortedKeys">
+							<bool key="EncodedWithXMLCoder">YES</bool>
+							<string>mainView</string>
+							<string>window</string>
+						</object>
+						<object class="NSMutableArray" key="dict.values">
+							<bool key="EncodedWithXMLCoder">YES</bool>
+							<object class="IBToOneOutletInfo">
+								<string key="name">mainView</string>
+								<string key="candidateClassName">sqSqueakOSXNSView</string>
+							</object>
+							<object class="IBToOneOutletInfo">
+								<string key="name">window</string>
+								<string key="candidateClassName">NSWindow</string>
+							</object>
+						</object>
+					</object>
 					<object class="IBClassDescriptionSource" key="sourceIdentifier">
 						<string key="majorKey">IBProjectSource</string>
-						<string key="minorKey">platforms/Mac OSObjC/vm/OSX/SqueakOSXAppDelegate.h</string>
+						<string key="minorKey">OSX/SqueakOSXAppDelegate.h</string>
 					</object>
 				</object>
 				<object class="IBPartialClassDescription">
@@ -1428,7 +1444,7 @@
 					<string key="superclassName">NSApplication</string>
 					<object class="IBClassDescriptionSource" key="sourceIdentifier">
 						<string key="majorKey">IBProjectSource</string>
-						<string key="minorKey">platforms/Mac OSObjC/vm/OSX/SqueakOSXApplication.h</string>
+						<string key="minorKey">OSX/SqueakOSXApplication.h</string>
 					</object>
 				</object>
 				<object class="IBPartialClassDescription">
@@ -1436,29 +1452,29 @@
 					<string key="superclassName">NSObject</string>
 					<object class="IBClassDescriptionSource" key="sourceIdentifier">
 						<string key="majorKey">IBProjectSource</string>
-						<string key="minorKey">platforms/Mac OSObjC/vm/Common/Classes/sqSqueakAppDelegate.h</string>
+						<string key="minorKey">Common/Classes/sqSqueakAppDelegate.h</string>
 					</object>
 				</object>
 				<object class="IBPartialClassDescription">
 					<string key="className">sqSqueakOSXNSView</string>
 					<object class="IBClassDescriptionSource" key="sourceIdentifier">
 						<string key="majorKey">IBProjectSource</string>
-						<string key="minorKey">platforms/Mac OSObjC/vm/OSX/SqViewBitmapConversion.h</string>
+						<string key="minorKey">OSX/SqViewBitmapConversion.h</string>
 					</object>
 				</object>
 				<object class="IBPartialClassDescription">
 					<string key="className">sqSqueakOSXNSView</string>
 					<object class="IBClassDescriptionSource" key="sourceIdentifier">
 						<string key="majorKey">IBProjectSource</string>
-						<string key="minorKey">platforms/Mac OSObjC/vm/OSX/SqViewClut.h</string>
+						<string key="minorKey">OSX/SqViewClut.h</string>
 					</object>
 				</object>
 				<object class="IBPartialClassDescription">
 					<string key="className">sqSqueakOSXNSView</string>
-					<string key="superclassName">NSView</string>
+					<string key="superclassName">NSOpenGLView</string>
 					<object class="IBClassDescriptionSource" key="sourceIdentifier">
 						<string key="majorKey">IBProjectSource</string>
-						<string key="minorKey">platforms/Mac OSObjC/vm/OSX/sqSqueakOSXNSView.h</string>
+						<string key="minorKey">OSX/sqSqueakOSXNSView.h</string>
 					</object>
 				</object>
 			</object>
@@ -1547,6 +1563,45 @@
 							<string>id</string>
 						</object>
 					</object>
+					<object class="NSMutableDictionary" key="actionInfosByName">
+						<bool key="EncodedWithXMLCoder">YES</bool>
+						<object class="NSArray" key="dict.sortedKeys">
+							<bool key="EncodedWithXMLCoder">YES</bool>
+							<string>printDocument:</string>
+							<string>revertDocumentToSaved:</string>
+							<string>runPageLayout:</string>
+							<string>saveDocument:</string>
+							<string>saveDocumentAs:</string>
+							<string>saveDocumentTo:</string>
+						</object>
+						<object class="NSMutableArray" key="dict.values">
+							<bool key="EncodedWithXMLCoder">YES</bool>
+							<object class="IBActionInfo">
+								<string key="name">printDocument:</string>
+								<string key="candidateClassName">id</string>
+							</object>
+							<object class="IBActionInfo">
+								<string key="name">revertDocumentToSaved:</string>
+								<string key="candidateClassName">id</string>
+							</object>
+							<object class="IBActionInfo">
+								<string key="name">runPageLayout:</string>
+								<string key="candidateClassName">id</string>
+							</object>
+							<object class="IBActionInfo">
+								<string key="name">saveDocument:</string>
+								<string key="candidateClassName">id</string>
+							</object>
+							<object class="IBActionInfo">
+								<string key="name">saveDocumentAs:</string>
+								<string key="candidateClassName">id</string>
+							</object>
+							<object class="IBActionInfo">
+								<string key="name">saveDocumentTo:</string>
+								<string key="candidateClassName">id</string>
+							</object>
+						</object>
+					</object>
 					<object class="IBClassDescriptionSource" key="sourceIdentifier">
 						<string key="majorKey">IBFrameworkSource</string>
 						<string key="minorKey">AppKit.framework/Headers/NSDocument.h</string>
@@ -1579,6 +1634,35 @@
 							<string>id</string>
 						</object>
 					</object>
+					<object class="NSMutableDictionary" key="actionInfosByName">
+						<bool key="EncodedWithXMLCoder">YES</bool>
+						<object class="NSArray" key="dict.sortedKeys">
+							<bool key="EncodedWithXMLCoder">YES</bool>
+							<string>clearRecentDocuments:</string>
+							<string>newDocument:</string>
+							<string>openDocument:</string>
+							<string>saveAllDocuments:</string>
+						</object>
+						<object class="NSMutableArray" key="dict.values">
+							<bool key="EncodedWithXMLCoder">YES</bool>
+							<object class="IBActionInfo">
+								<string key="name">clearRecentDocuments:</string>
+								<string key="candidateClassName">id</string>
+							</object>
+							<object class="IBActionInfo">
+								<string key="name">newDocument:</string>
+								<string key="candidateClassName">id</string>
+							</object>
+							<object class="IBActionInfo">
+								<string key="name">openDocument:</string>
+								<string key="candidateClassName">id</string>
+							</object>
+							<object class="IBActionInfo">
+								<string key="name">saveAllDocuments:</string>
+								<string key="candidateClassName">id</string>
+							</object>
+						</object>
+					</object>
 					<object class="IBClassDescriptionSource" key="sourceIdentifier">
 						<string key="majorKey">IBFrameworkSource</string>
 						<string key="minorKey">AppKit.framework/Headers/NSDocumentController.h</string>
@@ -1744,20 +1828,6 @@
 					<string key="className">NSObject</string>
 					<object class="IBClassDescriptionSource" key="sourceIdentifier">
 						<string key="majorKey">IBFrameworkSource</string>
-						<string key="minorKey">Foundation.framework/Headers/NSArchiver.h</string>
-					</object>
-				</object>
-				<object class="IBPartialClassDescription">
-					<string key="className">NSObject</string>
-					<object class="IBClassDescriptionSource" key="sourceIdentifier">
-						<string key="majorKey">IBFrameworkSource</string>
-						<string key="minorKey">Foundation.framework/Headers/NSClassDescription.h</string>
-					</object>
-				</object>
-				<object class="IBPartialClassDescription">
-					<string key="className">NSObject</string>
-					<object class="IBClassDescriptionSource" key="sourceIdentifier">
-						<string key="majorKey">IBFrameworkSource</string>
 						<string key="minorKey">Foundation.framework/Headers/NSError.h</string>
 					</object>
 				</object>
@@ -1800,20 +1870,6 @@
 					<string key="className">NSObject</string>
 					<object class="IBClassDescriptionSource" key="sourceIdentifier">
 						<string key="majorKey">IBFrameworkSource</string>
-						<string key="minorKey">Foundation.framework/Headers/NSObjectScripting.h</string>
-					</object>
-				</object>
-				<object class="IBPartialClassDescription">
-					<string key="className">NSObject</string>
-					<object class="IBClassDescriptionSource" key="sourceIdentifier">
-						<string key="majorKey">IBFrameworkSource</string>
-						<string key="minorKey">Foundation.framework/Headers/NSPortCoder.h</string>
-					</object>
-				</object>
-				<object class="IBPartialClassDescription">
-					<string key="className">NSObject</string>
-					<object class="IBClassDescriptionSource" key="sourceIdentifier">
-						<string key="majorKey">IBFrameworkSource</string>
 						<string key="minorKey">Foundation.framework/Headers/NSRunLoop.h</string>
 					</object>
 				</object>
@@ -1821,87 +1877,81 @@
 					<string key="className">NSObject</string>
 					<object class="IBClassDescriptionSource" key="sourceIdentifier">
 						<string key="majorKey">IBFrameworkSource</string>
-						<string key="minorKey">Foundation.framework/Headers/NSScriptClassDescription.h</string>
+						<string key="minorKey">Foundation.framework/Headers/NSThread.h</string>
 					</object>
 				</object>
 				<object class="IBPartialClassDescription">
 					<string key="className">NSObject</string>
 					<object class="IBClassDescriptionSource" key="sourceIdentifier">
 						<string key="majorKey">IBFrameworkSource</string>
-						<string key="minorKey">Foundation.framework/Headers/NSScriptKeyValueCoding.h</string>
+						<string key="minorKey">Foundation.framework/Headers/NSURL.h</string>
 					</object>
 				</object>
 				<object class="IBPartialClassDescription">
 					<string key="className">NSObject</string>
 					<object class="IBClassDescriptionSource" key="sourceIdentifier">
 						<string key="majorKey">IBFrameworkSource</string>
-						<string key="minorKey">Foundation.framework/Headers/NSScriptObjectSpecifiers.h</string>
+						<string key="minorKey">Foundation.framework/Headers/NSURLConnection.h</string>
 					</object>
 				</object>
 				<object class="IBPartialClassDescription">
 					<string key="className">NSObject</string>
 					<object class="IBClassDescriptionSource" key="sourceIdentifier">
 						<string key="majorKey">IBFrameworkSource</string>
-						<string key="minorKey">Foundation.framework/Headers/NSScriptWhoseTests.h</string>
+						<string key="minorKey">PrintCore.framework/Headers/PDEPluginInterface.h</string>
 					</object>
 				</object>
 				<object class="IBPartialClassDescription">
 					<string key="className">NSObject</string>
 					<object class="IBClassDescriptionSource" key="sourceIdentifier">
 						<string key="majorKey">IBFrameworkSource</string>
-						<string key="minorKey">Foundation.framework/Headers/NSThread.h</string>
+						<string key="minorKey">QuartzCore.framework/Headers/CAAnimation.h</string>
 					</object>
 				</object>
 				<object class="IBPartialClassDescription">
 					<string key="className">NSObject</string>
 					<object class="IBClassDescriptionSource" key="sourceIdentifier">
 						<string key="majorKey">IBFrameworkSource</string>
-						<string key="minorKey">Foundation.framework/Headers/NSURL.h</string>
+						<string key="minorKey">QuartzCore.framework/Headers/CALayer.h</string>
 					</object>
 				</object>
 				<object class="IBPartialClassDescription">
 					<string key="className">NSObject</string>
 					<object class="IBClassDescriptionSource" key="sourceIdentifier">
 						<string key="majorKey">IBFrameworkSource</string>
-						<string key="minorKey">Foundation.framework/Headers/NSURLConnection.h</string>
+						<string key="minorKey">QuartzCore.framework/Headers/CIImageProvider.h</string>
 					</object>
 				</object>
 				<object class="IBPartialClassDescription">
 					<string key="className">NSObject</string>
 					<object class="IBClassDescriptionSource" key="sourceIdentifier">
 						<string key="majorKey">IBFrameworkSource</string>
-						<string key="minorKey">Foundation.framework/Headers/NSURLDownload.h</string>
+						<string key="minorKey">UIKit.framework/Headers/UIAccessibility.h</string>
 					</object>
 				</object>
 				<object class="IBPartialClassDescription">
 					<string key="className">NSObject</string>
 					<object class="IBClassDescriptionSource" key="sourceIdentifier">
 						<string key="majorKey">IBFrameworkSource</string>
-						<string key="minorKey">PrintCore.framework/Headers/PDEPluginInterface.h</string>
+						<string key="minorKey">UIKit.framework/Headers/UINibLoading.h</string>
 					</object>
 				</object>
 				<object class="IBPartialClassDescription">
 					<string key="className">NSObject</string>
 					<object class="IBClassDescriptionSource" key="sourceIdentifier">
 						<string key="majorKey">IBFrameworkSource</string>
-						<string key="minorKey">QuartzCore.framework/Headers/CAAnimation.h</string>
+						<string key="minorKey">UIKit.framework/Headers/UIResponder.h</string>
 					</object>
 				</object>
 				<object class="IBPartialClassDescription">
-					<string key="className">NSObject</string>
+					<string key="className">NSOpenGLView</string>
+					<string key="superclassName">NSView</string>
 					<object class="IBClassDescriptionSource" key="sourceIdentifier">
 						<string key="majorKey">IBFrameworkSource</string>
-						<string key="minorKey">QuartzCore.framework/Headers/CALayer.h</string>
+						<string key="minorKey">AppKit.framework/Headers/NSOpenGLView.h</string>
 					</object>
 				</object>
 				<object class="IBPartialClassDescription">
-					<string key="className">NSObject</string>
-					<object class="IBClassDescriptionSource" key="sourceIdentifier">
-						<string key="majorKey">IBFrameworkSource</string>
-						<string key="minorKey">QuartzCore.framework/Headers/CIImageProvider.h</string>
-					</object>
-				</object>
-				<object class="IBPartialClassDescription">
 					<string key="className">NSResponder</string>
 					<object class="IBClassDescriptionSource" key="sourceIdentifier">
 						<string key="majorKey">IBFrameworkSource</string>
@@ -1980,14 +2030,14 @@
 		<string key="IBDocument.TargetRuntimeIdentifier">IBCocoaFramework</string>
 		<object class="NSMutableDictionary" key="IBDocument.PluginDeclaredDependencyDefaults">
 			<string key="NS.key.0">com.apple.InterfaceBuilder.CocoaPlugin.macosx</string>
-			<integer value="1050" key="NS.object.0"/>
+			<integer value="1060" key="NS.object.0"/>
 		</object>
 		<object class="NSMutableDictionary" key="IBDocument.PluginDeclaredDevelopmentDependencies">
 			<string key="NS.key.0">com.apple.InterfaceBuilder.CocoaPlugin.InterfaceBuilder3</string>
 			<integer value="3000" key="NS.object.0"/>
 		</object>
 		<bool key="IBDocument.PluginDeclaredDependenciesTrackSystemTargetVersion">YES</bool>
-		<string key="IBDocument.LastKnownRelativeProjectPath">../SqueakPureObjc.xcodeproj</string>
+		<string key="IBDocument.LastKnownRelativeProjectPath">../SqueakPureObjcCOGVM.xcodeproj</string>
 		<int key="IBDocument.defaultPropertyAccessControl">3</int>
 		<object class="NSMutableDictionary" key="IBDocument.LastKnownImageSizes">
 			<bool key="EncodedWithXMLCoder">YES</bool>

Modified: trunk/platforms/iOS/vm/OSX/SqueakOSXAppDelegate.m
===================================================================
--- trunk/platforms/iOS/vm/OSX/SqueakOSXAppDelegate.m	2010-09-05 03:39:36 UTC (rev 2280)
+++ trunk/platforms/iOS/vm/OSX/SqueakOSXAppDelegate.m	2010-09-07 02:39:16 UTC (rev 2281)
@@ -76,6 +76,15 @@
 	
 }
 
+- (BOOL)applicationShouldTerminateAfterLastWindowClosed:(NSApplication *)sender {
+	return NO;
+}
+
+- (NSApplicationTerminateReply)applicationShouldTerminate:(NSApplication *)sender {
+	[self.window performClose: self.window];
+	return NSTerminateCancel;
+}
+
 - (id) createPossibleWindow {
 	sqInt width,height;
 	extern sqInt getSavedWindowSize(void); //This is VM Callback

Added: trunk/platforms/iOS/vm/OSX/plugins/HostWindowPlugin/sqMacHostWindow.h
===================================================================
--- trunk/platforms/iOS/vm/OSX/plugins/HostWindowPlugin/sqMacHostWindow.h	                        (rev 0)
+++ trunk/platforms/iOS/vm/OSX/plugins/HostWindowPlugin/sqMacHostWindow.h	2010-09-07 02:39:16 UTC (rev 2281)
@@ -0,0 +1,71 @@
+/*
+ *  sqMacHostWindow.h
+ *  SqueakVMForCarbon
+ *
+ *  Created by John M McIntosh on Tue Jul 20 2004.
+ *
+ 
+   3.8.15b3  Feb 19th, 2007 JMM add cursor set logic
+   Altered for IPhone
+
+ */
+/*
+ Copyright (c) 2008 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.
+ */
+//
+
+#include "HostWindowPlugin.h"
+#ifdef BUILD_FOR_OSX
+#include <ApplicationServices/ApplicationServices.h>
+#else
+#include <CoreGraphics/CoreGraphics.h>
+#endif
+/* window handle type */
+#define wHandleType void *
+#define wIndexType sqInt 
+
+typedef struct windowDescriptorBlock {
+	struct windowDescriptorBlock * next;
+	wHandleType		handle;
+	wIndexType		windowIndex;
+	/* extra fields to support your platform needs */
+	void * context;
+	CGRect	updateArea;
+	sqInt	width;
+	sqInt	height;
+} windowDescriptorBlock;
+
+windowDescriptorBlock *windowBlockFromHandle(wHandleType windowHandle);
+sqInt windowIndexFromBlock( windowDescriptorBlock * thisWindow);
+sqInt windowIndexFromHandle(wHandleType windowHandle);
+wHandleType windowHandleFromIndex(wIndexType windowIndex);
+windowDescriptorBlock *AddWindowBlock(void);
+windowDescriptorBlock *windowBlockFromIndex(sqInt windowIndex);
+sqInt getCurrentIndexInUse(void);

Added: trunk/platforms/iOS/vm/OSX/plugins/HostWindowPlugin/sqMacHostWindow.m
===================================================================
--- trunk/platforms/iOS/vm/OSX/plugins/HostWindowPlugin/sqMacHostWindow.m	                        (rev 0)
+++ trunk/platforms/iOS/vm/OSX/plugins/HostWindowPlugin/sqMacHostWindow.m	2010-09-07 02:39:16 UTC (rev 2281)
@@ -0,0 +1,219 @@
+/*
+ *  sqMacHostWindow.m
+ *  SqueakVMForCarbon
+ *
+ *  Created by John M McIntosh on Tue Jul 20 2004.
+ *  Copyright Corporate Smalltalk Consulting Ltd 2008. All rights reserved.
+ *
+	July 15th 2005 add logic to flush QD buffers for os-x 10.4
+	 3.8.15b3  Feb 19th, 2007 JMM add cursor set logic
+	May 15th, 2008 IPhone
+	Sept 6th, 2010 Cocoa
+
+ */
+/*
+ Copyright (c) 2008 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.
+ */
+
+//
+#include <Cocoa/Cocoa.h>
+#include "sqVirtualMachine.h"
+#include "sqMacHostWindow.h"
+#include <stdlib.h>
+
+extern struct VirtualMachine *interpreterProxy;
+sqInt RemoveWindowBlock(windowDescriptorBlock * thisWindow);
+
+sqInt createWindowWidthheightoriginXyattrlength(sqInt w,sqInt h,sqInt x,sqInt y,  char * list, sqInt listLength) {
+	return -1;
+}
+
+int closeWindow(int windowIndex) {
+	NSWindow	*windowHandle;
+	windowHandle = windowHandleFromIndex(windowIndex);
+	if(windowHandle == NULL) 
+		return 0;
+	windowBlockFromIndex(windowIndex)->context = NULL;
+	RemoveWindowBlock(windowBlockFromIndex(windowIndex));	
+	[windowHandle close];
+	return 1;
+}
+
+sqInt ioPositionOfWindow(wIndexType windowIndex)
+{
+	if (windowHandleFromIndex(windowIndex) == NULL)
+		return -1;
+	return (0 << 16) | (0 & 0xFFFF);  /* left is high 16 bits; top is low 16 bits */
+}
+
+sqInt ioPositionOfWindowSetxy(wIndexType windowIndex, sqInt x, sqInt y)
+{
+	return -1;
+}
+
+sqInt ioSizeOfWindow(wIndexType windowIndex)
+{
+	sqInt w=0, h=0;
+	return (w << 16) | (h & 0xFFFF);  /* w is high 16 bits; h is low 16 bits */
+}
+
+int ioPositionOfNativeDisplay(unsigned long windowHandle)
+{
+	sqInt w=0, h=0;
+	return (w << 16) | (h & 0xFFFF);  /* w is high 16 bits; h is low 16 bits */
+}
+
+sqInt ioSizeOfWindowSetxy(wIndexType windowIndex, sqInt x, sqInt y)
+{
+	return (0);  /* w is high 16 bits; h is low 16 bits */
+}
+
+sqInt ioSetTitleOfWindow(sqInt windowIndex, char * newTitle, sqInt sizeOfTitle) {
+	return 1;
+}
+
+sqInt ioCloseAllWindows(void) {
+	return 1;
+}
+
+
+
+/* addendum to sqPlatformSpecific.h */
+/* multiple host windows stuff */
+
+static windowDescriptorBlock *windowListRoot = NULL;
+
+/* end addendum to sqPlatformSpecific.h */
+
+/* simple linked list management code */
+/* window list management */
+
+windowDescriptorBlock *windowBlockFromIndex(sqInt windowIndex) {
+windowDescriptorBlock *entry;
+	entry = windowListRoot;
+	while(entry) {
+		if(entry->windowIndex == windowIndex) return entry;
+		entry = entry->next;
+	}
+	return NULL;
+}
+
+windowDescriptorBlock *windowBlockFromHandle(wHandleType windowHandle) {
+windowDescriptorBlock *entry;
+	entry = windowListRoot;
+	while(entry) {
+		if(entry->handle == windowHandle) return entry;
+		entry = entry->next;
+	}
+	return NULL;
+}
+
+
+wHandleType windowHandleFromIndex(sqInt windowIndex)  {
+windowDescriptorBlock *entry;
+	entry = windowListRoot;
+	while(entry) {
+		if(entry->windowIndex == windowIndex) return entry->handle;
+		entry = entry->next;
+	}
+	return NULL;
+}
+
+sqInt windowIndexFromHandle(wHandleType windowHandle) {
+windowDescriptorBlock *entry;
+	entry = windowListRoot;
+	while(entry) {
+		if(entry->handle == windowHandle) return entry->windowIndex;
+		entry = entry->next;
+	}
+	return 0;
+}
+
+sqInt windowIndexFromBlock( windowDescriptorBlock * thisWindow) {
+windowDescriptorBlock *entry;
+	entry = windowListRoot;
+	while(entry) {
+		if(entry == thisWindow) return entry->windowIndex;
+		entry = entry->next;
+	}
+	return 0;
+}
+
+static sqInt nextIndex = 1; 
+
+windowDescriptorBlock *AddWindowBlock(void) {
+/* create a new entry in the linkedlist of windows.
+ * If the calloc fails, return NULL which will then go back to the
+ * prim and fail it cleanly.
+ * Initialize the block to a sensible state
+ */
+windowDescriptorBlock *thisWindow;
+
+	thisWindow = (windowDescriptorBlock*) calloc(1, sizeof(windowDescriptorBlock));
+	if ( thisWindow == NULL) {
+		return NULL;
+	}
+	thisWindow->next = windowListRoot;
+	thisWindow->windowIndex = nextIndex++;
+	thisWindow->handle = NULL;
+	windowListRoot = thisWindow;
+
+	return windowListRoot;
+}
+
+/*
+ * RemoveWindowBlock:
+ * Remove the given entry from the list of windows.
+ * free it, if found.
+ */
+ sqInt RemoveWindowBlock(windowDescriptorBlock * thisWindow) {
+windowDescriptorBlock *prevEntry;
+
+
+	/* Unlink the entry from the module chain */
+	if(thisWindow == windowListRoot) {
+		windowListRoot = thisWindow->next;
+	} else {
+		prevEntry = windowListRoot;
+		while(prevEntry->next != thisWindow) {
+			prevEntry = prevEntry->next;
+			if (prevEntry == NULL) {
+				return 0;
+			}
+		}
+		prevEntry->next = thisWindow->next;
+	}
+	free(thisWindow);
+	return 1;
+}
+
+sqInt getCurrentIndexInUse(void) {
+	return nextIndex-1;
+}

Modified: trunk/platforms/iOS/vm/OSX/sqSqueakOSXApplication+attributes.m
===================================================================
--- trunk/platforms/iOS/vm/OSX/sqSqueakOSXApplication+attributes.m	2010-09-05 03:39:36 UTC (rev 2280)
+++ trunk/platforms/iOS/vm/OSX/sqSqueakOSXApplication+attributes.m	2010-09-07 02:39:16 UTC (rev 2281)
@@ -83,7 +83,8 @@
 			
 #if STACKVM
 			
-			return "Mac Cocoa Cog 5.8b8 04-Sep-10 >8A66B7E0-B578-4E5F-97B4-6195547A35F5<";
+			return "Mac Cocoa Cog 5.8b9 06-Sep-10 >01641B99-1842-4422-A99D-43153BEDEFFA<";
+//			return "Mac Cocoa Cog 5.8b8 04-Sep-10 >8A66B7E0-B578-4E5F-97B4-6195547A35F5<";
 //			return "Mac Cocoa Cog 5.8b7 02-Sep-10 >4EBF00E3-453E-4010-9AC8-6B64C292984B<";
 //			return "Mac Cocoa Cog 5.8b6 31-Aug-10 >DFB49E57-40FB-44B9-97D3-B7CA51608429<";
 //			return "Mac Cocoa Cog 5.8b5 30-Aug-10 >0A92B82A-9AC1-4B0E-9DEE-440C3FFAE568<";

Modified: trunk/platforms/iOS/vm/OSX/sqSqueakOSXApplication+events.h
===================================================================
--- trunk/platforms/iOS/vm/OSX/sqSqueakOSXApplication+events.h	2010-09-05 03:39:36 UTC (rev 2280)
+++ trunk/platforms/iOS/vm/OSX/sqSqueakOSXApplication+events.h	2010-09-07 02:39:16 UTC (rev 2281)
@@ -38,7 +38,7 @@
 #import "sqSqueakOSXApplication.h"
 #import "sqSqueakMainApplication+events.h"
 #import "sqSqueakOSXNSView.h"
-
+ at class NSWIndow;
 @interface sqSqueakOSXApplication (events) 
 
 - (void) recordCharEvent:(NSString *) unicodeString fromView: (sqSqueakOSXNSView *) mainView;
@@ -51,4 +51,5 @@
 - (NSUInteger) translateCocoaModifiersToCarbonModifiers: (NSUInteger) modifiers;
 - (int) translateCocoaModifiersToSqueakModifiers: (NSUInteger) modifiers;
 - (void) recordDragEvent: (int) dragType numberOfFiles: (int) numFiles where: (NSPoint) local_point windowIndex: (sqInt) windowIndex;
+- (void) recordWindowEvent: (int) type window: (NSWIndow *) window;
 @end

Modified: trunk/platforms/iOS/vm/OSX/sqSqueakOSXApplication+events.m
===================================================================
--- trunk/platforms/iOS/vm/OSX/sqSqueakOSXApplication+events.m	2010-09-05 03:39:36 UTC (rev 2280)
+++ trunk/platforms/iOS/vm/OSX/sqSqueakOSXApplication+events.m	2010-09-07 02:39:16 UTC (rev 2281)
@@ -43,6 +43,7 @@
 #import "sqSqueakOSXInfoPlistInterface.h"
 #import "keyBoardStrokeDetails.h"
 #import "sqSqueakOSXNSView.h"
+#import "sqMacHostWindow.h"
 
 extern struct	VirtualMachine* interpreterProxy;
 extern SqueakOSXAppDelegate *gDelegateApp;
@@ -390,4 +391,20 @@
 	interpreterProxy->signalSemaphoreWithIndex(gDelegateApp.squeakApplication.inputSemaphoreIndex);
 }
 
+- (void) recordWindowEvent: (int) windowType window: (NSWIndow *) window {
+	sqWindowEvent evt;
+	
+	evt.type= WindowEventClose;
+	evt.timeStamp= (int) ioMSecs();
+	evt.action= windowType;
+	evt.value1 =  0;
+	evt.value2 =  0;
+	evt.value3 =  0;
+	evt.value4 =  0;
+	evt.windowIndex = windowIndexFromHandle((wHandleType)window);
+	[self pushEventToQueue: (sqInputEvent *) &evt];
+	
+	interpreterProxy->signalSemaphoreWithIndex(gDelegateApp.squeakApplication.inputSemaphoreIndex);
+}
+
 @end

Modified: trunk/platforms/iOS/vm/OSX/sqSqueakOSXScreenAndWindow.m
===================================================================
--- trunk/platforms/iOS/vm/OSX/sqSqueakOSXScreenAndWindow.m	2010-09-05 03:39:36 UTC (rev 2280)
+++ trunk/platforms/iOS/vm/OSX/sqSqueakOSXScreenAndWindow.m	2010-09-07 02:39:16 UTC (rev 2281)
@@ -43,7 +43,6 @@
 #import "SqViewBitmapConversion.h"
 
 extern SqueakOSXAppDelegate *gDelegateApp;
-wHandleType windowHandleFromIndex(sqInt windowIndex);
 
 @implementation sqSqueakOSXScreenAndWindow
 @synthesize mainViewOnWindow;
@@ -67,4 +66,8 @@
 	return false;
 }
 
+- (BOOL)windowShouldClose:(id)window {
+	[gDelegateApp.squeakApplication recordWindowEvent: WindowEventClose window: window];
+	return NO;
+}
 @end

Modified: trunk/platforms/iOS/vm/SqueakPureObjc-InfoCOG.plist
===================================================================
--- trunk/platforms/iOS/vm/SqueakPureObjc-InfoCOG.plist	2010-09-05 03:39:36 UTC (rev 2280)
+++ trunk/platforms/iOS/vm/SqueakPureObjc-InfoCOG.plist	2010-09-07 02:39:16 UTC (rev 2281)
@@ -350,7 +350,7 @@
 	<key>CFBundleExecutable</key>
 	<string>${EXECUTABLE_NAME}</string>
 	<key>CFBundleGetInfoString</key>
-	<string>Squeak VM 5.8b8 http://www.squeak.org</string>
+	<string>Squeak VM 5.8b9 http://www.squeak.org</string>
 	<key>CFBundleIconFile</key>
 	<string>Squeak.icns</string>
 	<key>CFBundleIdentifier</key>
@@ -362,11 +362,11 @@
 	<key>CFBundlePackageType</key>
 	<string>APPL</string>
 	<key>CFBundleShortVersionString</key>
-	<string>5.8b8</string>
+	<string>5.8b9</string>
 	<key>CFBundleSignature</key>
 	<string>FAST</string>
 	<key>CFBundleVersion</key>
-	<string>26.0</string>
+	<string>27.0</string>
 	<key>LSBackgroundOnly</key>
 	<false/>
 	<key>LSMinimumSystemVersion</key>



More information about the Vm-dev mailing list