diff options
author | Brecht Van Lommel <brechtvanlommel@gmail.com> | 2014-02-11 02:05:35 +0400 |
---|---|---|
committer | Brecht Van Lommel <brechtvanlommel@gmail.com> | 2014-02-11 02:09:23 +0400 |
commit | 2038eb10d069352cefa83abc6a6c6071807970ae (patch) | |
tree | 8cb6461e208e9f1146df0b026da216caba490e51 /intern | |
parent | e29a45b396ccf507d858ec4afc301bdaf816b328 (diff) |
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.
Diffstat (limited to 'intern')
-rw-r--r-- | intern/ghost/intern/GHOST_WindowCocoa.h | 8 | ||||
-rw-r--r-- | intern/ghost/intern/GHOST_WindowCocoa.mm | 49 |
2 files changed, 49 insertions, 8 deletions
diff --git a/intern/ghost/intern/GHOST_WindowCocoa.h b/intern/ghost/intern/GHOST_WindowCocoa.h index 28a463c47f4..082256af8c9 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 93036da4dae..a1dcbe7ad9a 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; } |