[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [23992] trunk/blender/intern/ghost/intern/ GHOST_WindowCocoa.mm: Cocoa:
Damien Plisson
damien.plisson at yahoo.fr
Tue Oct 20 10:13:12 CEST 2009
Revision: 23992
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=23992
Author: damien78
Date: 2009-10-20 10:13:12 +0200 (Tue, 20 Oct 2009)
Log Message:
-----------
Cocoa:
- fix 10.6 API used in window resizing callback causing crash on 10.5 systems (Thx Jasper Mine for the bug report)
- implemented min window size enforcement to prevent tiny windows messing up blender's internal ui layout (same as done by Campbell on X11, is a partial fix of bug #19550)
- added (commented) code for enabling multithreaded opengl (this optimization is here for experimental tests, not for mainstream, so bleeding edge testers would want to uncomment the three "Multithreaded opengl code : uncomment for enabling" sections)
Modified Paths:
--------------
trunk/blender/intern/ghost/intern/GHOST_WindowCocoa.mm
Modified: trunk/blender/intern/ghost/intern/GHOST_WindowCocoa.mm
===================================================================
--- trunk/blender/intern/ghost/intern/GHOST_WindowCocoa.mm 2009-10-20 08:01:17 UTC (rev 23991)
+++ trunk/blender/intern/ghost/intern/GHOST_WindowCocoa.mm 2009-10-20 08:13:12 UTC (rev 23992)
@@ -34,6 +34,10 @@
#include <Carbon/Carbon.h>
#endif
+/***** Multithreaded opengl code : uncomment for enabling
+#include <OpenGL/OpenGL.h>
+*/
+
#include "GHOST_WindowCocoa.h"
#include "GHOST_SystemCocoa.h"
#include "GHOST_Debug.h"
@@ -110,10 +114,14 @@
- (void)windowDidResize:(NSNotification *)notification
{
+#ifdef MAC_OS_X_VERSION_10_6
if (![[notification object] inLiveResize]) {
//Send event only once, at end of resize operation (when user has released mouse button)
+#endif
systemCocoa->handleWindowEvent(GHOST_kEventWindowSize, associatedWindow);
+#ifdef MAC_OS_X_VERSION_10_6
}
+#endif
/* Live resize ugly patch. Needed because live resize runs in a modal loop, not letting main loop run
if ([[notification object] inLiveResize]) {
systemCocoa->dispatchEvents();
@@ -194,6 +202,7 @@
//Creates the window
NSRect rect;
+ NSSize minSize;
rect.origin.x = left;
rect.origin.y = top;
@@ -208,6 +217,11 @@
return;
}
+ //Forbid to resize the window below the blender defined minimum one
+ minSize.width = 320;
+ minSize.height = 240;
+ [m_window setContentMinSize:minSize];
+
setTitle(title);
@@ -719,6 +733,10 @@
NSOpenGLPixelFormat *pixelFormat;
NSOpenGLContext *tmpOpenGLContext;
+ /***** Multithreaded opengl code : uncomment for enabling
+ CGLContextObj cglCtx;
+ */
+
switch (type) {
case GHOST_kDrawingContextTypeOpenGL:
if (!getValid()) break;
@@ -731,6 +749,13 @@
break;
}
+ //Switch openGL to multhreaded mode
+ /******* Multithreaded opengl code : uncomment for enabling
+ cglCtx = (CGLContextObj)[tmpOpenGLContext CGLContextObj];
+ if (CGLEnable(cglCtx, kCGLCEMPEngine) == kCGLNoError)
+ printf("\nSwitched openGL to multithreaded mode");
+ */
+
if (!s_firstOpenGLcontext) s_firstOpenGLcontext = tmpOpenGLContext;
#ifdef WAIT_FOR_VSYNC
/* wait for vsync, to avoid tearing artifacts */
More information about the Bf-blender-cvs
mailing list