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.
This commit is contained in:
Brecht Van Lommel 2011-06-27 13:57:27 +00:00
parent a961d62653
commit 24c0f1873e
5 changed files with 15 additions and 30 deletions

@ -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*/;
}

@ -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
***************************************************************************************/

@ -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
*/

@ -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;

@ -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];