summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAkemi <der.richter@gmx.de>2017-01-14 21:12:16 +0100
committerAkemi <der.richter@gmx.de>2017-01-19 14:52:51 +0100
commit202f9b218af093e2002bf2551b44afffcba26f7d (patch)
treee523f235a10f5de6f9e0336962c1f62187d0a893
parent4fe45fb3a18dd705bfeeab751323133481abf36e (diff)
downloadmpv-202f9b218af093e2002bf2551b44afffcba26f7d.tar.bz2
mpv-202f9b218af093e2002bf2551b44afffcba26f7d.tar.xz
cocoa: properly recover from toggleFullscreen fail
in some circumstances cocoa isn't able to enter or exit fullscreen but we still set window sizes and flags accordingly. this leaves us in a hanging state between fullscreen and window. it also prevents the toggleFullscreen method and its events to work properly afterwards. in that state it's impossible to enter or exit this 'semi-fullscreen'. add a proper fallback to recover from this state. Fixes #4035
-rw-r--r--video/out/cocoa/window.m28
1 files changed, 20 insertions, 8 deletions
diff --git a/video/out/cocoa/window.m b/video/out/cocoa/window.m
index a661565c1d..770469bf38 100644
--- a/video/out/cocoa/window.m
+++ b/video/out/cocoa/window.m
@@ -97,18 +97,28 @@
[super toggleFullScreen:sender];
if (![self.adapter isInFullScreenMode]) {
- [self setStyleMask:([self styleMask] | NSWindowStyleMaskFullScreen)];
- NSRect frame = [[self targetScreen] frame];
- [self setFrame:frame display:YES];
+ [self setToFullScreen];
} else {
- [self setStyleMask:([self styleMask] & ~NSWindowStyleMaskFullScreen)];
- NSRect frame = [self calculateWindowPositionForScreen:[self targetScreen]];
- [self setFrame:frame display:YES];
- [self setContentAspectRatio:_unfs_content_frame.size];
- [self setCenteredContentSize:_unfs_content_frame.size];
+ [self setToWindow];
}
}
+- (void)setToFullScreen
+{
+ [self setStyleMask:([self styleMask] | NSWindowStyleMaskFullScreen)];
+ NSRect frame = [[self targetScreen] frame];
+ [self setFrame:frame display:YES];
+}
+
+- (void)setToWindow
+{
+ [self setStyleMask:([self styleMask] & ~NSWindowStyleMaskFullScreen)];
+ NSRect frame = [self calculateWindowPositionForScreen:[self targetScreen]];
+ [self setFrame:frame display:YES];
+ [self setContentAspectRatio:_unfs_content_frame.size];
+ [self setCenteredContentSize:_unfs_content_frame.size];
+}
+
- (NSArray *)customWindowsToEnterFullScreenForWindow:(NSWindow *)window
{
return [NSArray arrayWithObject:window];
@@ -139,11 +149,13 @@
- (void)windowDidFailToEnterFullScreen:(NSWindow *)window
{
_is_animating = 0;
+ [self setToWindow];
}
- (void)windowDidFailToExitFullScreen:(NSWindow *)window
{
_is_animating = 0;
+ [self setToFullScreen];
}
- (void)windowDidChangeBackingProperties:(NSNotification *)notification