Commit: 2038eb10d069352cefa83abc6a6c6071807970ae
Author: Brecht Van Lommel
Date:   Mon Feb 10 23:05:35 2014 +0100
https://developer.blender.org/rB2038eb10d069352cefa83abc6a6c6071807970ae

Fix T38537: issue with OS X full screen startup.blend after recent changes.

Also fixed the redrawing while entering and exiting fullscreen, it would show
a distracting white window contents during the animation.

===================================================================

M       intern/ghost/intern/GHOST_WindowCocoa.h
M       intern/ghost/intern/GHOST_WindowCocoa.mm

===================================================================

diff --git a/intern/ghost/intern/GHOST_WindowCocoa.h 
b/intern/ghost/intern/GHOST_WindowCocoa.h
index 28a463c..082256a 100644
--- a/intern/ghost/intern/GHOST_WindowCocoa.h
+++ b/intern/ghost/intern/GHOST_WindowCocoa.h
@@ -272,6 +272,10 @@ public:
        
        /** public function to get the window containing the OpenGL view */
        CocoaWindow *getCocoaWindow() const {return m_window;};
+
+       /* Internal value to ensure proper redraws during animations */
+       void setImmediateDraw(bool value) { m_immediateDraw = value; }
+       bool getImmediateDraw(void) const { return m_immediateDraw; }
        
 protected:
        /**
@@ -338,6 +342,10 @@ protected:
        NSCursor *m_customCursor;
 
        GHOST_TabletData m_tablet;
+
+       bool m_lionStyleFullScreen;
+
+       bool m_immediateDraw;
 };
 
 #endif // __GHOST_WINDOWCOCOA_H__
diff --git a/intern/ghost/intern/GHOST_WindowCocoa.mm 
b/intern/ghost/intern/GHOST_WindowCocoa.mm
index 93036da..a1dcbe7 100644
--- a/intern/ghost/intern/GHOST_WindowCocoa.mm
+++ b/intern/ghost/intern/GHOST_WindowCocoa.mm
@@ -105,6 +105,26 @@ enum {
        systemCocoa->handleWindowEvent(GHOST_kEventWindowMove, 
associatedWindow);
 }
 
+- (void)windowWillEnterFullScreen:(NSNotification *)notification
+{
+       associatedWindow->setImmediateDraw(true);
+}
+
+- (void)windowDidEnterFullScreen:(NSNotification *)notification
+{
+       associatedWindow->setImmediateDraw(false);
+}
+
+- (void)windowWillExitFullScreen:(NSNotification *)notification
+{
+       associatedWindow->setImmediateDraw(true);
+}
+
+- (void)windowDidExitFullScreen:(NSNotification *)notification
+{
+       associatedWindow->setImmediateDraw(false);
+}
+
 - (void)windowDidResize:(NSNotification *)notification
 {
 #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1060
@@ -247,6 +267,8 @@ enum {
 
        bool composing;
        NSString *composing_text;
+
+       bool immediate_draw;
 }
 - (void)setSystemAndWindowCocoa:(GHOST_SystemCocoa *)sysCocoa 
windowCocoa:(GHOST_WindowCocoa *)winCocoa;
 @end
@@ -259,6 +281,8 @@ enum {
 
        composing = false;
        composing_text = nil;
+
+       immediate_draw = false;
 }
 
 - (BOOL)acceptsFirstResponder
@@ -397,6 +421,11 @@ enum {
        else {
                [super drawRect:rect];
                systemCocoa->handleWindowEvent(GHOST_kEventWindowUpdate, 
associatedWindow);
+
+               /* For some cases like entering fullscreen we need to redraw 
immediately
+                * so our window does not show blank during the animation */
+               if (associatedWindow->getImmediateDraw())
+                       systemCocoa->dispatchEvents();
        }
 }
 
@@ -526,7 +555,9 @@ GHOST_WindowCocoa::GHOST_WindowCocoa(
                
        m_systemCocoa = systemCocoa;
        m_fullScreen = false;
-       
+       m_immediateDraw = false;
+       m_lionStyleFullScreen = false;
+
        NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
        
        //Creates the window
@@ -694,6 +725,14 @@ GHOST_WindowCocoa::GHOST_WindowCocoa(
        
        if (state == GHOST_kWindowStateFullScreen)
                setState(GHOST_kWindowStateFullScreen);
+
+       //Starting with 10.9, we always use Lion fullscreen, since it
+       //now has proper multi-monitor support for fullscreen
+       struct { SInt32 major, minor; } systemversion;
+       Gestalt(gestaltSystemVersionMajor, &systemversion.major);
+       Gestalt(gestaltSystemVersionMinor, &systemversion.minor);
+
+       m_lionStyleFullScreen = (systemversion.major > 10 || 
(systemversion.major == 10 && systemversion.minor >= 9));
                
        [pool drain];
 }
@@ -1038,13 +1077,7 @@ GHOST_TSuccess 
GHOST_WindowCocoa::setState(GHOST_TWindowState state)
                        NSUInteger masks = [m_window styleMask];
 
                        if (!m_fullScreen && !(masks & NSFullScreenWindowMask)) 
{
-                               /* Starting with 10.9, we always use Lion 
fullscreen, since it
-                                * now has proper multi-monitor support for 
fullscreen */
-                               struct { SInt32 major, minor; } systemversion;
-                               Gestalt(gestaltSystemVersionMajor, 
&systemversion.major);
-                               Gestalt(gestaltSystemVersionMinor, 
&systemversion.minor);
-
-                               if (systemversion.major > 10 || 
(systemversion.major == 10 && systemversion.minor >= 9)) {
+                               if (m_lionStyleFullScreen) {
                                        [m_window toggleFullScreen:nil];
                                        break;
                                }

_______________________________________________
Bf-blender-cvs mailing list
[email protected]
http://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to