[Vm-dev] [commit][3701] JMM work on full screen mode, Crash on Change, or Garbage on Change SQK-44

commits at squeakvm.org commits at squeakvm.org
Fri May 6 00:18:29 UTC 2016


Revision: 3701
Author:   johnmci
Date:     2016-05-05 17:18:27 -0700 (Thu, 05 May 2016)
Log Message:
-----------
JMM work on full screen mode, Crash on Change, or Garbage on Change SQK-44

Modified Paths:
--------------
    branches/Cog/build.macos32x86/common/Makefile.vm
    branches/Cog/platforms/iOS/vm/OSX/sqSqueakOSXCGView.h
    branches/Cog/platforms/iOS/vm/OSX/sqSqueakOSXOpenGLView.h
    branches/Cog/platforms/iOS/vm/OSX/sqSqueakOSXOpenGLView.m

Modified: branches/Cog/build.macos32x86/common/Makefile.vm
===================================================================
--- branches/Cog/build.macos32x86/common/Makefile.vm	2016-05-06 00:00:29 UTC (rev 3700)
+++ branches/Cog/build.macos32x86/common/Makefile.vm	2016-05-06 00:18:27 UTC (rev 3701)
@@ -54,7 +54,7 @@
 CROSSSRC:= $(wildcard $(CROSSDIR)/*.c)
 #XEX:= ... %/sqMacV2Browser.m ...
 XEX:=%/sqSqueakMainApplication+screen.m %/sqMacV2Window.m \
-	 %/SqViewBitmapConversion.m
+	 %/SqViewBitmapConversion.m %/sqSqueakOSXCGView.m
 OSXSRC=$(wildcard $(OSXDIR)/*.c) $(wildcard $(OSXDIR)/*.m) \
 		$(wildcard $(OSXCOMMONDIR)/*.c) $(wildcard $(OSXCOMMONDIR)/*.m) \
 		$(wildcard $(OSXCLASSESDIR)/*.c) $(wildcard $(OSXCLASSESDIR)/*.m)

Modified: branches/Cog/platforms/iOS/vm/OSX/sqSqueakOSXCGView.h
===================================================================
--- branches/Cog/platforms/iOS/vm/OSX/sqSqueakOSXCGView.h	2016-05-06 00:00:29 UTC (rev 3700)
+++ branches/Cog/platforms/iOS/vm/OSX/sqSqueakOSXCGView.h	2016-05-06 00:18:27 UTC (rev 3701)
@@ -80,8 +80,6 @@
 //Accessing
 -(NSString*)dragFileNameStringAtIndex:(sqInt) index;
 -(void) ioSetFullScreen: (sqInt) fullScreen;
--(void)fadeOut;
--(void)fadeIn;
 -(void) drawImageUsingClip: (CGRect) clip;
 -(NSUInteger)countNumberOfNoneSqueakImageFilesInDraggedFiles: (id<NSDraggingInfo>)info;
 -(NSMutableArray *)filterOutSqueakImageFilesFromDraggedFiles: (id<NSDraggingInfo>)info;

Modified: branches/Cog/platforms/iOS/vm/OSX/sqSqueakOSXOpenGLView.h
===================================================================
--- branches/Cog/platforms/iOS/vm/OSX/sqSqueakOSXOpenGLView.h	2016-05-06 00:00:29 UTC (rev 3700)
+++ branches/Cog/platforms/iOS/vm/OSX/sqSqueakOSXOpenGLView.h	2016-05-06 00:18:27 UTC (rev 3701)
@@ -56,11 +56,12 @@
 	BOOL	syncNeeded;
 	NSMutableArray*  dragItems;
 	CGDisplayFadeReservationToken    fadeToken;
-	NSRect	savedScreenBoundsAtTimeOfFullScreen;
-	CGColorSpaceRef colorspace;	
+	CGColorSpaceRef colorspace;
 	unsigned int*      colorMap32;
-	BOOL clippyIsEmpty;
+    BOOL clippyIsEmpty;
+    BOOL fullScreenInProgress;
 	CGRect clippy;
+    void* fullScreendispBitsIndex;
 }
 @property (nonatomic,assign) NSTrackingRectTag squeakTrackingRectForCursor;
 @property (nonatomic,strong) keyBoardStrokeDetails* lastSeenKeyBoardStrokeDetails;
@@ -69,14 +70,13 @@
 @property (nonatomic,assign) int dragCount;
 @property (nonatomic,strong) NSMutableArray* dragItems;
 @property (nonatomic,weak) sqSqueakOSXScreenAndWindow *windowLogic;
- at property (nonatomic,assign) NSRect	savedScreenBoundsAtTimeOfFullScreen;
+ at property (nonatomic,assign) BOOL fullScreenInProgress;
+ at property (nonatomic,assign) void* fullScreendispBitsIndex;
 
 - (void) initializeVariables;
 - (void) fakeKeyDownUp: (NSEvent*) theEvent;
 - (NSString*) dragFileNameStringAtIndex:(sqInt) index;
 - (void)  ioSetFullScreen: (sqInt) fullScreen;
-- (void)fadeOut;
-- (void)fadeIn;
 - (void) drawImageUsingClip: (CGRect) clip;
 - (NSUInteger) countNumberOfNoneSqueakImageFilesInDraggedFiles: (id<NSDraggingInfo>)info;
 - (NSMutableArray *) filterOutSqueakImageFilesFromDraggedFiles: (id<NSDraggingInfo>)info;

Modified: branches/Cog/platforms/iOS/vm/OSX/sqSqueakOSXOpenGLView.m
===================================================================
--- branches/Cog/platforms/iOS/vm/OSX/sqSqueakOSXOpenGLView.m	2016-05-06 00:00:29 UTC (rev 3700)
+++ branches/Cog/platforms/iOS/vm/OSX/sqSqueakOSXOpenGLView.m	2016-05-06 00:18:27 UTC (rev 3701)
@@ -64,7 +64,7 @@
 
 @implementation sqSqueakOSXOpenGLView
 @synthesize squeakTrackingRectForCursor,lastSeenKeyBoardStrokeDetails,
-lastSeenKeyBoardModifierDetails,dragInProgress,dragCount,dragItems,windowLogic,savedScreenBoundsAtTimeOfFullScreen;
+lastSeenKeyBoardModifierDetails,dragInProgress,dragCount,dragItems,windowLogic,fullScreenInProgress,fullScreendispBitsIndex;
 
 + (NSOpenGLPixelFormat *)defaultPixelFormat {
 	NSOpenGLPixelFormatAttribute attrs[] =
@@ -97,6 +97,7 @@
 	dragCount = 0;
 	dragItems = NULL;
 	clippyIsEmpty = YES;
+    fullScreenInProgress = NO;
 	colorspace = CGColorSpaceCreateDeviceRGB();
 	[self initializeSqueakColorMap];
 }
@@ -165,7 +166,18 @@
         firstDrawCompleted = YES;
         return;
     }
-	if (syncNeeded) { 
+    
+    if (self.fullScreenInProgress) {
+        sqInt formObj = interpreterProxy->displayObject();
+        sqInt formPtrOop = interpreterProxy->fetchPointerofObject(0, formObj);
+        void* dispBitsIndex = interpreterProxy->firstIndexableField(formPtrOop);
+        if (self.fullScreendispBitsIndex == dispBitsIndex) {
+            return;
+        }
+        self.fullScreenInProgress = NO;
+    }
+    
+	if (syncNeeded) {
 		[self drawRect: NSRectFromCGRect(clippy)];
 		syncNeeded = NO;
 		clippyIsEmpty = YES;
@@ -224,6 +236,7 @@
 - (void)loadTexturesFrom: (void*) lastBitsIndex subRectangle: (NSRect) subRect { 
 //	CGL_MACRO_DECLARE_VARIABLES();
 	static void *previousLastBitsIndex=null;
+    
 	NSRect r=[self frame];
 	if (!(previousLastBitsIndex == lastBitsIndex)) {
 		previousLastBitsIndex = lastBitsIndex;
@@ -310,16 +323,17 @@
 //	NSLog(@" draw %f %f %f %f",rect.origin.x,rect.origin.y,rect.size.width,rect.size.height);
 	NSOpenGLContext *oldContext = [NSOpenGLContext currentContext];
 	sqInt formObj = interpreterProxy->displayObject();
-	sqInt formPtrOop = interpreterProxy->fetchPointerofObject(0, formObj);	
-	void* dispBitsIndex = interpreterProxy->firstIndexableField(formPtrOop);
+	sqInt formPtrOop = interpreterProxy->fetchPointerofObject(0, formObj);
+    self.fullScreendispBitsIndex = interpreterProxy->firstIndexableField(formPtrOop);
+    
     static int inited=NO;
-    if ( dispBitsIndex ) {
+    if ( fullScreendispBitsIndex ) {
 		[[self openGLContext] makeCurrentContext];
 		if (!inited) {
 			[self setupOpenGL];
 			inited=YES;
 		}
-		[self loadTexturesFrom:dispBitsIndex subRectangle: rect];
+		[self loadTexturesFrom:fullScreendispBitsIndex subRectangle: rect];
 		[self defineQuad:rect];
     }
     
@@ -721,22 +735,20 @@
 		return;
 	
 	if ([self isInFullScreenMode] == NO && (fullScreen == 1)) {
-		self.savedScreenBoundsAtTimeOfFullScreen = (NSRect) [self bounds];
+       self.fullScreenInProgress = YES;
 		NSDictionary* options = [NSDictionary dictionaryWithObjectsAndKeys:
 			[NSNumber numberWithInt:
 				NSApplicationPresentationHideDock |
 				NSApplicationPresentationHideMenuBar ],
 			NSFullScreenModeApplicationPresentationOptions, nil];
 		[self enterFullScreenMode:[NSScreen mainScreen] withOptions:options];
-		extern struct	VirtualMachine* interpreterProxy;
-		interpreterProxy->fullDisplayUpdate();
 	}
 	
 	if ([self isInFullScreenMode] == YES && (fullScreen == 0)) {
+        self.fullScreenInProgress = YES;
 		[self exitFullScreenModeWithOptions: NULL];
 		if ([self.window isKeyWindow] == NO) {
 			[self.window makeKeyAndOrderFront: self];
-			//	NOT SURE IF THIS IS NEEDED, MORE TESTING	[self.window setContentSize: self.savedScreenBoundsAtTimeOfFullScreen.size];
 		}
 	}
 }



More information about the Vm-dev mailing list