[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [23718] trunk/blender/intern/ghost/intern: Cocoa port :

Damien Plisson damien.plisson at yahoo.fr
Thu Oct 8 17:28:32 CEST 2009


Revision: 23718
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=23718
Author:   damien78
Date:     2009-10-08 17:28:31 +0200 (Thu, 08 Oct 2009)

Log Message:
-----------
Cocoa port :
Bug fix : newly created window not seen as activated by WM

Added more conservative memory management (may need to optimize later)

Modified Paths:
--------------
    trunk/blender/intern/ghost/intern/GHOST_SystemCocoa.mm
    trunk/blender/intern/ghost/intern/GHOST_WindowCocoa.mm

Modified: trunk/blender/intern/ghost/intern/GHOST_SystemCocoa.mm
===================================================================
--- trunk/blender/intern/ghost/intern/GHOST_SystemCocoa.mm	2009-10-08 15:19:57 UTC (rev 23717)
+++ trunk/blender/intern/ghost/intern/GHOST_SystemCocoa.mm	2009-10-08 15:28:31 UTC (rev 23718)
@@ -806,7 +806,10 @@
             GHOST_ASSERT(m_windowManager, "m_windowManager not initialized");
             m_windowManager->addWindow(window);
             m_windowManager->setActiveWindow(window);
-            pushEvent(new GHOST_Event(getMilliSeconds(), GHOST_kEventWindowSize, 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));
+
         }
         else {
 			GHOST_PRINT("GHOST_SystemCocoa::createWindow(): window invalid\n");
@@ -1156,7 +1159,6 @@
     GHOST_IWindow* window = m_windowManager->getActiveWindow();
 	
 	if (!window) {
-		printf("\nM invalid window");
 		return GHOST_kFailure;
 	}
 	

Modified: trunk/blender/intern/ghost/intern/GHOST_WindowCocoa.mm
===================================================================
--- trunk/blender/intern/ghost/intern/GHOST_WindowCocoa.mm	2009-10-08 15:19:57 UTC (rev 23717)
+++ trunk/blender/intern/ghost/intern/GHOST_WindowCocoa.mm	2009-10-08 15:28:31 UTC (rev 23718)
@@ -319,7 +319,7 @@
 	/*if(ugly_hack==m_windowRef) ugly_hack= NULL;
 	
 	if(ugly_hack==NULL) setDrawingContextType(GHOST_kDrawingContextTypeNone);*/
-    
+    NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
 	[m_openGLView release];
 	
 	if (m_window) {
@@ -327,6 +327,7 @@
 		[m_window release];
 		m_window = nil;
 	}
+	[pool drain];
 }
 
 #pragma mark accessors
@@ -566,7 +567,9 @@
 {
     if (m_drawingContextType == GHOST_kDrawingContextTypeOpenGL) {
         if (m_openGLContext != nil) {
+			NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
 			[m_openGLContext flushBuffer];
+			[pool drain];
             return GHOST_kSuccess;
         }
     }
@@ -577,7 +580,9 @@
 {
 	if (m_drawingContextType == GHOST_kDrawingContextTypeOpenGL) {
 		if (m_openGLContext != nil) {
+			NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
 			[m_openGLContext update];
+			[pool drain];
 			return GHOST_kSuccess;
 		}
 	}
@@ -588,6 +593,8 @@
 {
 	if (m_drawingContextType == GHOST_kDrawingContextTypeOpenGL) {
 		if (m_openGLContext != nil) {
+			NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
+			
 			[m_openGLContext makeCurrentContext];
 #ifdef GHOST_DRAW_CARBON_GUTTER
 			// Restrict drawing to non-gutter area
@@ -603,6 +610,7 @@
 			};
 			GLboolean result = ::aglSetInteger(m_aglCtx, AGL_BUFFER_RECT, b);
 #endif //GHOST_DRAW_CARBON_GUTTER
+			[pool drain];
 			return GHOST_kSuccess;
 		}
 	}





More information about the Bf-blender-cvs mailing list