forked from bartvdbraak/blender
Cocoa port :
Bug fix : newly created window not seen as activated by WM Added more conservative memory management (may need to optimize later)
This commit is contained in:
parent
e936c80985
commit
88613b9184
@ -806,7 +806,10 @@ GHOST_IWindow* GHOST_SystemCocoa::createWindow(
|
|||||||
GHOST_ASSERT(m_windowManager, "m_windowManager not initialized");
|
GHOST_ASSERT(m_windowManager, "m_windowManager not initialized");
|
||||||
m_windowManager->addWindow(window);
|
m_windowManager->addWindow(window);
|
||||||
m_windowManager->setActiveWindow(window);
|
m_windowManager->setActiveWindow(window);
|
||||||
|
//Need to tell window manager the new window is the active one (Cocoa does not send the event activate upon window creation)
|
||||||
|
pushEvent(new GHOST_Event(getMilliSeconds(), GHOST_kEventWindowActivate, window));
|
||||||
pushEvent(new GHOST_Event(getMilliSeconds(), GHOST_kEventWindowSize, window));
|
pushEvent(new GHOST_Event(getMilliSeconds(), GHOST_kEventWindowSize, window));
|
||||||
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
GHOST_PRINT("GHOST_SystemCocoa::createWindow(): window invalid\n");
|
GHOST_PRINT("GHOST_SystemCocoa::createWindow(): window invalid\n");
|
||||||
@ -1156,7 +1159,6 @@ GHOST_TSuccess GHOST_SystemCocoa::handleMouseEvent(void *eventPtr)
|
|||||||
GHOST_IWindow* window = m_windowManager->getActiveWindow();
|
GHOST_IWindow* window = m_windowManager->getActiveWindow();
|
||||||
|
|
||||||
if (!window) {
|
if (!window) {
|
||||||
printf("\nM invalid window");
|
|
||||||
return GHOST_kFailure;
|
return GHOST_kFailure;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -319,7 +319,7 @@ GHOST_WindowCocoa::~GHOST_WindowCocoa()
|
|||||||
/*if(ugly_hack==m_windowRef) ugly_hack= NULL;
|
/*if(ugly_hack==m_windowRef) ugly_hack= NULL;
|
||||||
|
|
||||||
if(ugly_hack==NULL) setDrawingContextType(GHOST_kDrawingContextTypeNone);*/
|
if(ugly_hack==NULL) setDrawingContextType(GHOST_kDrawingContextTypeNone);*/
|
||||||
|
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
|
||||||
[m_openGLView release];
|
[m_openGLView release];
|
||||||
|
|
||||||
if (m_window) {
|
if (m_window) {
|
||||||
@ -327,6 +327,7 @@ GHOST_WindowCocoa::~GHOST_WindowCocoa()
|
|||||||
[m_window release];
|
[m_window release];
|
||||||
m_window = nil;
|
m_window = nil;
|
||||||
}
|
}
|
||||||
|
[pool drain];
|
||||||
}
|
}
|
||||||
|
|
||||||
#pragma mark accessors
|
#pragma mark accessors
|
||||||
@ -566,7 +567,9 @@ GHOST_TSuccess GHOST_WindowCocoa::swapBuffers()
|
|||||||
{
|
{
|
||||||
if (m_drawingContextType == GHOST_kDrawingContextTypeOpenGL) {
|
if (m_drawingContextType == GHOST_kDrawingContextTypeOpenGL) {
|
||||||
if (m_openGLContext != nil) {
|
if (m_openGLContext != nil) {
|
||||||
|
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
|
||||||
[m_openGLContext flushBuffer];
|
[m_openGLContext flushBuffer];
|
||||||
|
[pool drain];
|
||||||
return GHOST_kSuccess;
|
return GHOST_kSuccess;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -577,7 +580,9 @@ GHOST_TSuccess GHOST_WindowCocoa::updateDrawingContext()
|
|||||||
{
|
{
|
||||||
if (m_drawingContextType == GHOST_kDrawingContextTypeOpenGL) {
|
if (m_drawingContextType == GHOST_kDrawingContextTypeOpenGL) {
|
||||||
if (m_openGLContext != nil) {
|
if (m_openGLContext != nil) {
|
||||||
|
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
|
||||||
[m_openGLContext update];
|
[m_openGLContext update];
|
||||||
|
[pool drain];
|
||||||
return GHOST_kSuccess;
|
return GHOST_kSuccess;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -588,6 +593,8 @@ GHOST_TSuccess GHOST_WindowCocoa::activateDrawingContext()
|
|||||||
{
|
{
|
||||||
if (m_drawingContextType == GHOST_kDrawingContextTypeOpenGL) {
|
if (m_drawingContextType == GHOST_kDrawingContextTypeOpenGL) {
|
||||||
if (m_openGLContext != nil) {
|
if (m_openGLContext != nil) {
|
||||||
|
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
|
||||||
|
|
||||||
[m_openGLContext makeCurrentContext];
|
[m_openGLContext makeCurrentContext];
|
||||||
#ifdef GHOST_DRAW_CARBON_GUTTER
|
#ifdef GHOST_DRAW_CARBON_GUTTER
|
||||||
// Restrict drawing to non-gutter area
|
// Restrict drawing to non-gutter area
|
||||||
@ -603,6 +610,7 @@ GHOST_TSuccess GHOST_WindowCocoa::activateDrawingContext()
|
|||||||
};
|
};
|
||||||
GLboolean result = ::aglSetInteger(m_aglCtx, AGL_BUFFER_RECT, b);
|
GLboolean result = ::aglSetInteger(m_aglCtx, AGL_BUFFER_RECT, b);
|
||||||
#endif //GHOST_DRAW_CARBON_GUTTER
|
#endif //GHOST_DRAW_CARBON_GUTTER
|
||||||
|
[pool drain];
|
||||||
return GHOST_kSuccess;
|
return GHOST_kSuccess;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user