Module: wine Branch: master Commit: 89a4e5a6d1c77646fd397e3419a91a08533bbfb4 URL: http://source.winehq.org/git/wine.git/?a=commit;h=89a4e5a6d1c77646fd397e3419...
Author: Ken Thomases ken@codeweavers.com Date: Sun Mar 10 17:38:25 2013 -0500
winemac: Don't defer attaching OpenGL context to view if it is backed by a window device.
This fixes a problem with certain OpenGL programs which create a context very briefly before destroying it, like while handling WM_PAINT.
---
dlls/winemac.drv/cocoa_opengl.m | 16 +++++++++++++++- 1 files changed, 15 insertions(+), 1 deletions(-)
diff --git a/dlls/winemac.drv/cocoa_opengl.m b/dlls/winemac.drv/cocoa_opengl.m index 66eec63..5879b4d 100644 --- a/dlls/winemac.drv/cocoa_opengl.m +++ b/dlls/winemac.drv/cocoa_opengl.m @@ -21,6 +21,7 @@ #import "cocoa_opengl.h"
#include "macdrv_cocoa.h" +#include "cocoa_app.h"
@interface WineOpenGLContext () @@ -97,8 +98,21 @@ void macdrv_make_context_current(macdrv_opengl_context c, macdrv_view v) context.needsUpdate = FALSE; if (view) { + __block BOOL windowHasDevice; + macdrv_add_view_opengl_context(v, c); - [context setLatentView:view]; + + OnMainThread(^{ + windowHasDevice = [[view window] windowNumber] > 0; + }); + if (windowHasDevice) + { + [context setView:view]; + [context setLatentView:nil]; + } + else + [context setLatentView:view]; + [context makeCurrentContext]; } else