- 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)
This commit is contained in:
Damien Plisson
2009-10-20 08:13:12 +00:00
parent 8a8e00af07
commit 1f9d8826db
+25
View File
@@ -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 @@ extern "C" {
- (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 @@ GHOST_WindowCocoa::GHOST_WindowCocoa(
//Creates the window
NSRect rect;
NSSize minSize;
rect.origin.x = left;
rect.origin.y = top;
@@ -208,6 +217,11 @@ GHOST_WindowCocoa::GHOST_WindowCocoa(
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 @@ GHOST_TSuccess GHOST_WindowCocoa::installDrawingContext(GHOST_TDrawingContextTyp
NSOpenGLPixelFormat *pixelFormat;
NSOpenGLContext *tmpOpenGLContext;
/***** Multithreaded opengl code : uncomment for enabling
CGLContextObj cglCtx;
*/
switch (type) {
case GHOST_kDrawingContextTypeOpenGL:
if (!getValid()) break;
@@ -731,6 +749,13 @@ GHOST_TSuccess GHOST_WindowCocoa::installDrawingContext(GHOST_TDrawingContextTyp
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 */