diff options
author | Stefano Pigozzi <stefano.pigozzi@gmail.com> | 2013-07-20 12:08:14 +0200 |
---|---|---|
committer | Stefano Pigozzi <stefano.pigozzi@gmail.com> | 2013-07-20 12:08:14 +0200 |
commit | 7088fe3fec99ed60d73e7caded387165a67ab89d (patch) | |
tree | 5627f536afc20678664370922c58df4a09284825 /video/out | |
parent | cd219e2c5d8116fd150de62e8e8dc8d5b49560d9 (diff) | |
download | mpv-7088fe3fec99ed60d73e7caded387165a67ab89d.tar.bz2 mpv-7088fe3fec99ed60d73e7caded387165a67ab89d.tar.xz |
cocoa_common: make the fullscreen transition only when necessary
This makes the cocoa backend follow more closely the new fullscreen semantics
added in c4b08a9a.
Diffstat (limited to 'video/out')
-rw-r--r-- | video/out/cocoa_common.m | 21 |
1 files changed, 16 insertions, 5 deletions
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. |