Ken Thomases : winemac: Override -[NSOpenGLContext clearDrawable] to not hide the GL surface.
Alexandre Julliard
julliard at winehq.org
Mon Mar 11 16:24:51 CDT 2013
Module: wine
Branch: master
Commit: 4d51a688e37d070d6345587d63facbc630a43a3d
URL: http://source.winehq.org/git/wine.git/?a=commit;h=4d51a688e37d070d6345587d63facbc630a43a3d
Author: Ken Thomases <ken at codeweavers.com>
Date: Sun Mar 10 17:38:30 2013 -0500
winemac: Override -[NSOpenGLContext clearDrawable] to not hide the GL surface.
This fixes a problem with flickering when repeatedly attaching and detaching
a GL context from a window, such as for each WM_PAINT.
---
dlls/winemac.drv/cocoa_opengl.m | 25 +++++++++++++++++++++++++
1 files changed, 25 insertions(+), 0 deletions(-)
diff --git a/dlls/winemac.drv/cocoa_opengl.m b/dlls/winemac.drv/cocoa_opengl.m
index 5879b4d..f67ea89 100644
--- a/dlls/winemac.drv/cocoa_opengl.m
+++ b/dlls/winemac.drv/cocoa_opengl.m
@@ -38,6 +38,31 @@
[super dealloc];
}
+ /* On at least some versions of Mac OS X, -[NSOpenGLContext clearDrawable] has the
+ undesirable side effect of ordering the view's GL surface off-screen. This isn't
+ done when just changing the context's view to a different view (which I would
+ think would be analogous, since the old view and surface end up without a
+ context attached). So, we finesse things by first setting the context's view to
+ a different view (the content view of an off-screen window) and then letting the
+ original implementation proceed. */
+ - (void) clearDrawable
+ {
+ static NSWindow* dummyWindow;
+ static dispatch_once_t once;
+
+ dispatch_once(&once, ^{
+ OnMainThread(^{
+ dummyWindow = [[NSWindow alloc] initWithContentRect:NSMakeRect(0, 0, 100, 100)
+ styleMask:NSBorderlessWindowMask
+ backing:NSBackingStoreBuffered
+ defer:NO];
+ });
+ });
+
+ [self setView:[dummyWindow contentView]];
+ [super clearDrawable];
+ }
+
@end
More information about the wine-cvs
mailing list