Removes the redundant window on OSX

This commit is contained in:
Braden 2013-03-13 21:34:52 -05:00
parent 382be2aabd
commit a0fdcaced8
2 changed files with 10 additions and 10 deletions

View File

@ -50,7 +50,7 @@ typedef struct {
int x, y; int x, y;
unsigned int width, height; unsigned int width, height;
#elif defined(__APPLE__) #elif defined(__APPLE__)
NSWindow *cocoaWin; NSView *cocoaWin;
NSOpenGLContext *cocoaCtx; NSOpenGLContext *cocoaCtx;
#elif defined(HAVE_X11) && HAVE_X11 #elif defined(HAVE_X11) && HAVE_X11
int screen; int screen;

View File

@ -20,6 +20,8 @@
#include "RenderBase.h" #include "RenderBase.h"
#include "ConfigManager.h" #include "ConfigManager.h"
#include <wx/panel.h>
#include "VertexShaderManager.h" #include "VertexShaderManager.h"
#include "../GLInterface.h" #include "../GLInterface.h"
#include "AGL.h" #include "AGL.h"
@ -32,7 +34,7 @@ void cInterfaceAGL::Swap()
// Show the current FPS // Show the current FPS
void cInterfaceAGL::UpdateFPSDisplay(const char *text) void cInterfaceAGL::UpdateFPSDisplay(const char *text)
{ {
[GLWin.cocoaWin setTitle: [NSString stringWithUTF8String: text]]; [[GLWin.cocoaWin window] setTitle: [NSString stringWithUTF8String: text]];
} }
// Create rendering window. // Create rendering window.
@ -72,8 +74,7 @@ bool cInterfaceAGL::Create(void *&window_handle)
style |= NSResizableWindowMask | NSTitledWindowMask; style |= NSResizableWindowMask | NSTitledWindowMask;
} }
GLWin.cocoaWin = [[NSWindow alloc] initWithContentRect: size GLWin.cocoaWin = (NSView*)(((wxPanel*)window_handle)->GetHandle());;
styleMask: style backing: NSBackingStoreBuffered defer: NO];
if (GLWin.cocoaWin == nil) { if (GLWin.cocoaWin == nil) {
ERROR_LOG(VIDEO, "failed to create window"); ERROR_LOG(VIDEO, "failed to create window");
return NULL; return NULL;
@ -84,8 +85,8 @@ bool cInterfaceAGL::Create(void *&window_handle)
[GLWin.cocoaWin setLevel: CGShieldingWindowLevel()]; [GLWin.cocoaWin setLevel: CGShieldingWindowLevel()];
} }
[GLWin.cocoaCtx setView: [GLWin.cocoaWin contentView]]; [GLWin.cocoaCtx setView: GLWin.cocoaWin];
[GLWin.cocoaWin makeKeyAndOrderFront: nil]; [[GLWin.cocoaWin window] makeKeyAndOrderFront: nil];
return true; return true;
} }
@ -94,12 +95,12 @@ bool cInterfaceAGL::MakeCurrent()
{ {
int width, height; int width, height;
width = [[GLWin.cocoaWin contentView] frame].size.width; width = [GLWin.cocoaWin frame].size.width;
height = [[GLWin.cocoaWin contentView] frame].size.height; height = [GLWin.cocoaWin frame].size.height;
//if (width == s_backbuffer_width && height == s_backbuffer_height) //if (width == s_backbuffer_width && height == s_backbuffer_height)
// return true; // return true;
[GLWin.cocoaCtx setView: [GLWin.cocoaWin contentView]]; [GLWin.cocoaCtx setView: GLWin.cocoaWin];
[GLWin.cocoaCtx update]; [GLWin.cocoaCtx update];
[GLWin.cocoaCtx makeCurrentContext]; [GLWin.cocoaCtx makeCurrentContext];
s_backbuffer_width = width; s_backbuffer_width = width;
@ -110,7 +111,6 @@ bool cInterfaceAGL::MakeCurrent()
// Close backend // Close backend
void cInterfaceAGL::Shutdown() void cInterfaceAGL::Shutdown()
{ {
[GLWin.cocoaWin close];
[GLWin.cocoaCtx clearDrawable]; [GLWin.cocoaCtx clearDrawable];
[GLWin.cocoaCtx release]; [GLWin.cocoaCtx release];
} }