mirror of
https://github.com/gnustep/libs-gui.git
synced 2025-04-23 12:00:52 +00:00
More fix for #26414, and makes NSOpenGLView closer to the specs
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@26417 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
c537e70555
commit
f5c9c19113
2 changed files with 15 additions and 21 deletions
|
@ -1,3 +1,8 @@
|
|||
2008-03-31 Xavier Glattard <xavier.glattard@online.fr>
|
||||
|
||||
* Source/NSOpenGLView.m: Use _lockFocusInContext:withRect instead of
|
||||
canDraw. Some changes to be closer to the specifications.
|
||||
|
||||
2008-03-31 Fred Kiefer <FredKiefer@gmx.de>
|
||||
|
||||
* Headers/AppKit/NSOpenGLView.h: Add MacOS 10.3 method.
|
||||
|
|
|
@ -102,7 +102,9 @@ static NSOpenGLPixelFormatAttribute attrs[] =
|
|||
{
|
||||
[self clearGLContext];
|
||||
ASSIGN(glcontext, context);
|
||||
attached = NO;
|
||||
[glcontext setView: self];
|
||||
[glcontext makeCurrentContext];
|
||||
[self prepareOpenGL];
|
||||
}
|
||||
|
||||
- (void) prepareOpenGL
|
||||
|
@ -116,9 +118,9 @@ static NSOpenGLPixelFormatAttribute attrs[] =
|
|||
{
|
||||
if (glcontext == nil)
|
||||
{
|
||||
glcontext = [[NSOpenGLContext alloc] initWithFormat: pixel_format
|
||||
shareContext: nil];
|
||||
attached = NO;
|
||||
[self setOpenGLContext:
|
||||
[[NSOpenGLContext alloc] initWithFormat: pixel_format
|
||||
shareContext: nil]];
|
||||
}
|
||||
return glcontext;
|
||||
}
|
||||
|
@ -187,25 +189,12 @@ static NSOpenGLPixelFormatAttribute attrs[] =
|
|||
[self reshape];
|
||||
}
|
||||
|
||||
/* FIXME: This is a hack to get a chance to attach the current
|
||||
context before any drawing happens. I think this code should
|
||||
be moved to openGLContext.
|
||||
/* FIXME: this should be done in [lockFocus] or [lockFocusInRect:].
|
||||
*/
|
||||
- (BOOL) canDraw
|
||||
- (void) _lockFocusInContext: (NSGraphicsContext *)ctxt inRect: (NSRect)rect
|
||||
{
|
||||
if (!glcontext)
|
||||
{
|
||||
[self openGLContext];
|
||||
NSAssert(glcontext, NSInternalInconsistencyException);
|
||||
}
|
||||
if (attached == NO && glcontext != nil)
|
||||
{
|
||||
NSDebugMLLog(@"GL", @"Attaching context to the view");
|
||||
[glcontext setView: self];
|
||||
attached = YES;
|
||||
[self prepareOpenGL];
|
||||
}
|
||||
return [super canDraw];
|
||||
[super _lockFocusInContext: ctxt inRect: rect];
|
||||
[[self openGLContext] makeCurrentContext];
|
||||
}
|
||||
|
||||
@end
|
||||
|
|
Loading…
Reference in a new issue