From 7088fe3fec99ed60d73e7caded387165a67ab89d Mon Sep 17 00:00:00 2001 From: Stefano Pigozzi Date: Sat, 20 Jul 2013 12:08:14 +0200 Subject: cocoa_common: make the fullscreen transition only when necessary This makes the cocoa backend follow more closely the new fullscreen semantics added in c4b08a9a. --- video/out/cocoa_common.m | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) (limited to 'video') diff --git a/video/out/cocoa_common.m b/video/out/cocoa_common.m index df4bd0be9d..4679eaf4a5 100644 --- a/video/out/cocoa_common.m +++ b/video/out/cocoa_common.m @@ -621,23 +621,32 @@ int vo_cocoa_cgl_color_size(struct vo *vo) } } +- (BOOL)isInFullScreenMode +{ + return (([self styleMask] & NSFullScreenWindowMask) == + NSFullScreenWindowMask); +} + - (void)toggleMissionControlFullScreen:(BOOL)willBeFullscreen { struct vo_cocoa_state *s = self.videoOutput->cocoa; - if (willBeFullscreen) { + if (willBeFullscreen && ![self isInFullScreenMode]) { [self setContentResizeIncrements:NSMakeSize(1, 1)]; - } else { + [self toggleFullScreen:nil]; + } + + if (!willBeFullscreen && [self isInFullScreenMode]) { [self setContentAspectRatio:s->current_video_size]; + [self toggleFullScreen:nil]; } - [self toggleFullScreen:nil]; } - (void)toggleViewFullscreen:(BOOL)willBeFullscreen { struct vo_cocoa_state *s = self.videoOutput->cocoa; - if (willBeFullscreen) { + if (willBeFullscreen && ![s->view isInFullScreenMode]) { NSApplicationPresentationOptions popts = NSApplicationPresentationDefault; @@ -659,7 +668,9 @@ int vo_cocoa_cgl_color_size(struct vo *vo) // sending the View fullscreen to another screen. Make it go away // manually. [s->window orderOut:self]; - } else { + } + + if (!willBeFullscreen && [s->view isInFullScreenMode]) { [s->view exitFullScreenModeWithOptions:nil]; // Show the "windowed" window again. -- cgit v1.2.3