When entering fullscreen mode, the CocoaRenderView is attached as a subview to a new full screen window.
When the class is torn down, the view was not being attached back to it's original NSView. I added a new class variable to remember the original superview and then reattach it at the appropriate time. Review URL: http://webrtc-codereview.appspot.com/290009 git-svn-id: http://webrtc.googlecode.com/svn/trunk@1070 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
@@ -182,6 +182,8 @@ private: // variables
|
|||||||
std::multimap<int, int> _zOrderToChannel;
|
std::multimap<int, int> _zOrderToChannel;
|
||||||
unsigned int _threadID;
|
unsigned int _threadID;
|
||||||
bool _renderingIsPaused;
|
bool _renderingIsPaused;
|
||||||
|
NSView* _windowRefSuperView;
|
||||||
|
NSRect _windowRefSuperViewFrame;
|
||||||
};
|
};
|
||||||
|
|
||||||
} //namespace webrtc
|
} //namespace webrtc
|
||||||
|
|||||||
@@ -387,7 +387,9 @@ _windowHeight( 0),
|
|||||||
_nsglChannels( ),
|
_nsglChannels( ),
|
||||||
_zOrderToChannel( ),
|
_zOrderToChannel( ),
|
||||||
_threadID (0),
|
_threadID (0),
|
||||||
_renderingIsPaused (FALSE)
|
_renderingIsPaused (FALSE),
|
||||||
|
_windowRefSuperView(NULL),
|
||||||
|
_windowRefSuperViewFrame(NSMakeRect(0,0,0,0))
|
||||||
{
|
{
|
||||||
_screenUpdateThread = ThreadWrapper::CreateThread(ScreenUpdateThreadProc, this, kRealtimePriority);
|
_screenUpdateThread = ThreadWrapper::CreateThread(ScreenUpdateThreadProc, this, kRealtimePriority);
|
||||||
_screenUpdateEvent = EventWrapper::Create();
|
_screenUpdateEvent = EventWrapper::Create();
|
||||||
@@ -609,11 +611,17 @@ int VideoRenderNSOpenGL::setRenderTargetFullScreen()
|
|||||||
|
|
||||||
NSOpenGLPixelFormat* fmt = [[NSOpenGLPixelFormat alloc] initWithAttributes: (NSOpenGLPixelFormatAttribute*) attribs];
|
NSOpenGLPixelFormat* fmt = [[NSOpenGLPixelFormat alloc] initWithAttributes: (NSOpenGLPixelFormatAttribute*) attribs];
|
||||||
|
|
||||||
|
// Store original superview and frame for use when exiting full screens
|
||||||
|
_windowRefSuperViewFrame = [_windowRef frame];
|
||||||
|
_windowRefSuperView = [_windowRef superview];
|
||||||
|
|
||||||
|
|
||||||
// create new fullscreen window
|
// create new fullscreen window
|
||||||
NSRect screenRect = [[NSScreen mainScreen]frame];
|
NSRect screenRect = [[NSScreen mainScreen]frame];
|
||||||
[_windowRef setFrame:screenRect];
|
[_windowRef setFrame:screenRect];
|
||||||
[_windowRef setBounds:screenRect];
|
[_windowRef setBounds:screenRect];
|
||||||
|
|
||||||
|
|
||||||
_fullScreenWindow = [[CocoaFullScreenWindow alloc]init];
|
_fullScreenWindow = [[CocoaFullScreenWindow alloc]init];
|
||||||
[_fullScreenWindow grabFullScreen];
|
[_fullScreenWindow grabFullScreen];
|
||||||
[[[_fullScreenWindow window] contentView] addSubview:_windowRef];
|
[[[_fullScreenWindow window] contentView] addSubview:_windowRef];
|
||||||
@@ -650,8 +658,18 @@ VideoRenderNSOpenGL::~VideoRenderNSOpenGL()
|
|||||||
{
|
{
|
||||||
if(_fullScreenWindow)
|
if(_fullScreenWindow)
|
||||||
{
|
{
|
||||||
|
// Detach CocoaRenderView from full screen view back to
|
||||||
|
// it's original parent.
|
||||||
|
[_windowRef removeFromSuperview];
|
||||||
|
if(_windowRefSuperView)
|
||||||
|
{
|
||||||
|
[_windowRefSuperView addSubview:_windowRef];
|
||||||
|
[_windowRef setFrame:_windowRefSuperViewFrame];
|
||||||
|
}
|
||||||
|
|
||||||
WEBRTC_TRACE(kTraceDebug, kTraceVideoRenderer, 0, "%s:%d Attempting to release fullscreen window", __FUNCTION__, __LINE__);
|
WEBRTC_TRACE(kTraceDebug, kTraceVideoRenderer, 0, "%s:%d Attempting to release fullscreen window", __FUNCTION__, __LINE__);
|
||||||
[_fullScreenWindow releaseFullScreen];
|
[_fullScreenWindow releaseFullScreen];
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user