mirror of
https://github.com/gnustep/libs-gui.git
synced 2025-05-31 18:00:48 +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
510592e289
commit
c407b83170
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>
|
2008-03-31 Fred Kiefer <FredKiefer@gmx.de>
|
||||||
|
|
||||||
* Headers/AppKit/NSOpenGLView.h: Add MacOS 10.3 method.
|
* Headers/AppKit/NSOpenGLView.h: Add MacOS 10.3 method.
|
||||||
|
|
|
@ -102,7 +102,9 @@ static NSOpenGLPixelFormatAttribute attrs[] =
|
||||||
{
|
{
|
||||||
[self clearGLContext];
|
[self clearGLContext];
|
||||||
ASSIGN(glcontext, context);
|
ASSIGN(glcontext, context);
|
||||||
attached = NO;
|
[glcontext setView: self];
|
||||||
|
[glcontext makeCurrentContext];
|
||||||
|
[self prepareOpenGL];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void) prepareOpenGL
|
- (void) prepareOpenGL
|
||||||
|
@ -116,9 +118,9 @@ static NSOpenGLPixelFormatAttribute attrs[] =
|
||||||
{
|
{
|
||||||
if (glcontext == nil)
|
if (glcontext == nil)
|
||||||
{
|
{
|
||||||
glcontext = [[NSOpenGLContext alloc] initWithFormat: pixel_format
|
[self setOpenGLContext:
|
||||||
shareContext: nil];
|
[[NSOpenGLContext alloc] initWithFormat: pixel_format
|
||||||
attached = NO;
|
shareContext: nil]];
|
||||||
}
|
}
|
||||||
return glcontext;
|
return glcontext;
|
||||||
}
|
}
|
||||||
|
@ -187,25 +189,12 @@ static NSOpenGLPixelFormatAttribute attrs[] =
|
||||||
[self reshape];
|
[self reshape];
|
||||||
}
|
}
|
||||||
|
|
||||||
/* FIXME: This is a hack to get a chance to attach the current
|
/* FIXME: this should be done in [lockFocus] or [lockFocusInRect:].
|
||||||
context before any drawing happens. I think this code should
|
|
||||||
be moved to openGLContext.
|
|
||||||
*/
|
*/
|
||||||
- (BOOL) canDraw
|
- (void) _lockFocusInContext: (NSGraphicsContext *)ctxt inRect: (NSRect)rect
|
||||||
{
|
{
|
||||||
if (!glcontext)
|
[super _lockFocusInContext: ctxt inRect: rect];
|
||||||
{
|
[[self openGLContext] makeCurrentContext];
|
||||||
[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];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue