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.
This commit is contained in:
Ken Thomases 2013-03-10 17:38:25 -05:00 committed by Alexandre Julliard
parent fd00c806bf
commit 89a4e5a6d1

View File

@ -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