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:
parent
fd00c806bf
commit
89a4e5a6d1
|
@ -21,6 +21,7 @@
|
||||||
#import "cocoa_opengl.h"
|
#import "cocoa_opengl.h"
|
||||||
|
|
||||||
#include "macdrv_cocoa.h"
|
#include "macdrv_cocoa.h"
|
||||||
|
#include "cocoa_app.h"
|
||||||
|
|
||||||
|
|
||||||
@interface WineOpenGLContext ()
|
@interface WineOpenGLContext ()
|
||||||
|
@ -97,8 +98,21 @@ void macdrv_make_context_current(macdrv_opengl_context c, macdrv_view v)
|
||||||
context.needsUpdate = FALSE;
|
context.needsUpdate = FALSE;
|
||||||
if (view)
|
if (view)
|
||||||
{
|
{
|
||||||
|
__block BOOL windowHasDevice;
|
||||||
|
|
||||||
macdrv_add_view_opengl_context(v, c);
|
macdrv_add_view_opengl_context(v, c);
|
||||||
|
|
||||||
|
OnMainThread(^{
|
||||||
|
windowHasDevice = [[view window] windowNumber] > 0;
|
||||||
|
});
|
||||||
|
if (windowHasDevice)
|
||||||
|
{
|
||||||
|
[context setView:view];
|
||||||
|
[context setLatentView:nil];
|
||||||
|
}
|
||||||
|
else
|
||||||
[context setLatentView:view];
|
[context setLatentView:view];
|
||||||
|
|
||||||
[context makeCurrentContext];
|
[context makeCurrentContext];
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
Loading…
Reference in New Issue