diff options
author | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2011-06-27 17:57:27 +0400 |
---|---|---|
committer | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2011-06-27 17:57:27 +0400 |
commit | 24c0f1873e747dbfdf99637e89ba8c0d6b166f37 (patch) | |
tree | 87d9e0042dd4a2cc32a69c25ae1ac7c8cf112cc3 /intern | |
parent | a961d62653554f69d15c08a45c083c3200d8e1cf (diff) |
Fix part of #26850: Cocoa OS X game player was not working, two issues:
* Unlike blender, the game player draws only on windows update callbacks,
and those wer not implemented.
* Going fullscreen for player was not implemented correct, it expected an
existing window but actually it should create one.
Diffstat (limited to 'intern')
-rw-r--r-- | intern/ghost/intern/GHOST_DisplayManagerCocoa.mm | 2 | ||||
-rw-r--r-- | intern/ghost/intern/GHOST_SystemCocoa.h | 8 | ||||
-rw-r--r-- | intern/ghost/intern/GHOST_SystemCocoa.mm | 20 | ||||
-rw-r--r-- | intern/ghost/intern/GHOST_WindowCocoa.h | 3 | ||||
-rw-r--r-- | intern/ghost/intern/GHOST_WindowCocoa.mm | 12 |
5 files changed, 15 insertions, 30 deletions
diff --git a/intern/ghost/intern/GHOST_DisplayManagerCocoa.mm b/intern/ghost/intern/GHOST_DisplayManagerCocoa.mm index ab3abdd659f..86f5f4cdddb 100644 --- a/intern/ghost/intern/GHOST_DisplayManagerCocoa.mm +++ b/intern/ghost/intern/GHOST_DisplayManagerCocoa.mm @@ -164,5 +164,5 @@ GHOST_TSuccess GHOST_DisplayManagerCocoa::setCurrentDisplaySetting(GHOST_TUns8 d //CGDisplayErr err = ::CGDisplaySwitchToMode(m_displayIDs[display], displayModeValues); - return /*err == CGDisplayNoErr ? GHOST_kSuccess :*/ GHOST_kFailure; + return /*err == CGDisplayNoErr ?*/ GHOST_kSuccess /*: GHOST_kFailure*/; } diff --git a/intern/ghost/intern/GHOST_SystemCocoa.h b/intern/ghost/intern/GHOST_SystemCocoa.h index e7a8178a382..ce777358389 100644 --- a/intern/ghost/intern/GHOST_SystemCocoa.h +++ b/intern/ghost/intern/GHOST_SystemCocoa.h @@ -119,14 +119,6 @@ public: const GHOST_TEmbedderWindowID parentWindow = 0 ); - virtual GHOST_TSuccess beginFullScreen( - const GHOST_DisplaySetting& setting, - GHOST_IWindow** window, - const bool stereoVisual - ); - - virtual GHOST_TSuccess endFullScreen( void ); - /*************************************************************************************** ** Event management functionality ***************************************************************************************/ diff --git a/intern/ghost/intern/GHOST_SystemCocoa.mm b/intern/ghost/intern/GHOST_SystemCocoa.mm index 2649929713a..69423f2dfbf 100644 --- a/intern/ghost/intern/GHOST_SystemCocoa.mm +++ b/intern/ghost/intern/GHOST_SystemCocoa.mm @@ -773,26 +773,6 @@ GHOST_IWindow* GHOST_SystemCocoa::createWindow( return window; } -GHOST_TSuccess GHOST_SystemCocoa::beginFullScreen(const GHOST_DisplaySetting& setting, GHOST_IWindow** window, const bool stereoVisual) -{ - GHOST_IWindow* currentWindow = m_windowManager->getActiveWindow(); - *window = currentWindow; - - if(!currentWindow) return GHOST_kFailure; - - return currentWindow->setState(GHOST_kWindowStateFullScreen); -} - -GHOST_TSuccess GHOST_SystemCocoa::endFullScreen(void) -{ - GHOST_IWindow* currentWindow = m_windowManager->getActiveWindow(); - if(!currentWindow) return GHOST_kFailure; - - return currentWindow->setState(GHOST_kWindowStateNormal); -} - - - /** * @note : returns coordinates in Cocoa screen coordinates */ diff --git a/intern/ghost/intern/GHOST_WindowCocoa.h b/intern/ghost/intern/GHOST_WindowCocoa.h index e6de2bf07b4..ce28f8c4538 100644 --- a/intern/ghost/intern/GHOST_WindowCocoa.h +++ b/intern/ghost/intern/GHOST_WindowCocoa.h @@ -42,6 +42,7 @@ #include "STR_String.h" @class CocoaWindow; +@class CocoaOpenGLView; class GHOST_SystemCocoa; @@ -309,7 +310,7 @@ protected: CocoaWindow *m_window; /** The openGL view */ - NSOpenGLView *m_openGLView; + CocoaOpenGLView *m_openGLView; /** The opgnGL drawing context */ NSOpenGLContext *m_openGLContext; diff --git a/intern/ghost/intern/GHOST_WindowCocoa.mm b/intern/ghost/intern/GHOST_WindowCocoa.mm index 93bc87b2458..937dffe9fba 100644 --- a/intern/ghost/intern/GHOST_WindowCocoa.mm +++ b/intern/ghost/intern/GHOST_WindowCocoa.mm @@ -241,10 +241,19 @@ extern "C" { //We need to subclass it in order to give Cocoa the feeling key events are trapped @interface CocoaOpenGLView : NSOpenGLView { + GHOST_SystemCocoa *systemCocoa; + GHOST_WindowCocoa *associatedWindow; } +- (void)setSystemAndWindowCocoa:(GHOST_SystemCocoa *)sysCocoa windowCocoa:(GHOST_WindowCocoa *)winCocoa; @end @implementation CocoaOpenGLView +- (void)setSystemAndWindowCocoa:(GHOST_SystemCocoa *)sysCocoa windowCocoa:(GHOST_WindowCocoa *)winCocoa +{ + systemCocoa = sysCocoa; + associatedWindow = winCocoa; +} + - (BOOL)acceptsFirstResponder { return YES; @@ -294,6 +303,7 @@ extern "C" { else { [super drawRect:rect]; + systemCocoa->handleWindowEvent(GHOST_kEventWindowUpdate, associatedWindow); } } @@ -424,6 +434,8 @@ GHOST_WindowCocoa::GHOST_WindowCocoa( //Creates the OpenGL View inside the window m_openGLView = [[CocoaOpenGLView alloc] initWithFrame:rect pixelFormat:pixelFormat]; + + [m_openGLView setSystemAndWindowCocoa:systemCocoa windowCocoa:this]; [pixelFormat release]; |