crasher and child window fixes

This commit is contained in:
Christopher Lloyd 2012-01-23 09:11:53 -05:00
parent 77beebf4ef
commit 592c5a3a2e
2 changed files with 8 additions and 9 deletions

View File

@ -120,10 +120,12 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
- (void)lockFocus { - (void)lockFocus {
[super lockFocus]; [super lockFocus];
// create if needed
CGLLockContext([_context CGLContextObj]); NSOpenGLContext *context = [self openGLContext];
CGLLockContext([context CGLContextObj]);
[_context setView:self]; [_context setView:self];
[[self openGLContext] makeCurrentContext]; [context makeCurrentContext];
if (_needsReshape){ if (_needsReshape){
[self reshape]; [self reshape];

View File

@ -90,7 +90,7 @@ static LRESULT CALLBACK windowProcedure(HWND handle,UINT message,WPARAM wParam,L
if(message==WM_PAINT){ if(message==WM_PAINT){
Win32Window *parentWindow=GetProp(handle,"Win32Window"); Win32Window *parentWindow=GetProp(handle,"Win32Window");
#if 0 #if 1
ValidateRect(handle, NULL); ValidateRect(handle, NULL);
return [parentWindow WM_APP1_wParam:wParam lParam:lParam]; return [parentWindow WM_APP1_wParam:wParam lParam:lParam];
@ -571,10 +571,7 @@ CGL_EXPORT CGLError CGLUnlockContext(CGLContextObj context) {
return kCGLNoError; return kCGLNoError;
} }
static BOOL usesChildWindow(CGLContextObj context){ static BOOL usesChildWindow(CGLContextObj context){
if(context->forceChildWindow)
return YES;
Win32Window *parentWindow=[CGWindow windowWithWindowNumber:context->parentWindowNumber]; Win32Window *parentWindow=[CGWindow windowWithWindowNumber:context->parentWindowNumber];
if(parentWindow==nil) if(parentWindow==nil)
@ -583,7 +580,7 @@ static BOOL usesChildWindow(CGLContextObj context){
if([parentWindow isLayeredWindow]) if([parentWindow isLayeredWindow])
return NO; return NO;
return NO; return context->forceChildWindow;
} }
static BOOL shouldPutChildInParent(CGLContextObj context) { static BOOL shouldPutChildInParent(CGLContextObj context) {