summaryrefslogtreecommitdiffstats
path: root/video
diff options
context:
space:
mode:
authorAkemi <der.richter@gmx.de>2017-07-27 21:28:33 +0200
committerAkemi <der.richter@gmx.de>2017-08-06 22:48:26 +0200
commitf550fdaa91293fa1dd125b5743728c1d387d21c4 (patch)
tree5c506fbb24dc5421abf5f983019c98bcacd68e34 /video
parent2b83f7e391ab68b23602e89b97ebc07ca09d8e7c (diff)
downloadmpv-f550fdaa91293fa1dd125b5743728c1d387d21c4.tar.bz2
mpv-f550fdaa91293fa1dd125b5743728c1d387d21c4.tar.xz
cocoa: add an option to disable the native macOS fullscreen
Fixes #4014
Diffstat (limited to 'video')
-rw-r--r--video/out/cocoa/mpvadapter.h3
-rw-r--r--video/out/cocoa/window.m37
-rw-r--r--video/out/cocoa_common.m9
3 files changed, 39 insertions, 10 deletions
diff --git a/video/out/cocoa/mpvadapter.h b/video/out/cocoa/mpvadapter.h
index f6d9ae2eaf..7a858f56ab 100644
--- a/video/out/cocoa/mpvadapter.h
+++ b/video/out/cocoa/mpvadapter.h
@@ -28,8 +28,11 @@
- (void)didChangeWindowedScreenProfile:(NSNotification *)notification;
- (void)performAsyncResize:(NSSize)size;
- (void)windowDidChangePhysicalScreen;
+- (void)windowDidEnterFullScreen;
+- (void)windowDidExitFullScreen;
- (BOOL)isInFullScreenMode;
+- (BOOL)wantsNativeFullscreen;
- (BOOL)keyboardEnabled;
- (BOOL)mouseEnabled;
diff --git a/video/out/cocoa/window.m b/video/out/cocoa/window.m
index 9b602436dd..e08f4745bc 100644
--- a/video/out/cocoa/window.m
+++ b/video/out/cocoa/window.m
@@ -106,7 +106,8 @@
[self setFrame:frame display:YES];
}
- [super toggleFullScreen:sender];
+ if ([self.adapter wantsNativeFullscreen])
+ [super toggleFullScreen:sender];
if (![self.adapter isInFullScreenMode]) {
[self setToFullScreen];
@@ -119,7 +120,16 @@
{
[self setStyleMask:([self styleMask] | NSWindowStyleMaskFullScreen)];
NSRect frame = [[self targetScreen] frame];
- [self setFrame:frame display:YES];
+
+ if ([self.adapter wantsNativeFullscreen]) {
+ [self setFrame:frame display:YES];
+ } else {
+ [NSApp setPresentationOptions:NSApplicationPresentationAutoHideMenuBar|
+ NSApplicationPresentationAutoHideDock];
+ [self setFrame:frame display:YES];
+ _is_animating = 0;
+ [self.adapter windowDidEnterFullScreen];
+ }
}
- (void)setToWindow
@@ -127,9 +137,19 @@
[self setStyleMask:([self styleMask] & ~NSWindowStyleMaskFullScreen)];
NSRect frame = [self calculateWindowPositionForScreen:[self targetScreen]
withoutBounds:[[self targetScreen] isEqual:[self screen]]];
- [self setFrame:frame display:YES];
- [self setContentAspectRatio:_unfs_content_frame.size];
- [self setCenteredContentSize:_unfs_content_frame.size];
+
+ if ([self.adapter wantsNativeFullscreen]) {
+ [self setFrame:frame display:YES];
+ [self setContentAspectRatio:_unfs_content_frame.size];
+ [self setCenteredContentSize:_unfs_content_frame.size];
+ } else {
+ [NSApp setPresentationOptions:NSApplicationPresentationDefault];
+ [self setFrame:frame display:YES];
+ [self setContentAspectRatio:_unfs_content_frame.size];
+ [self setCenteredContentSize:_unfs_content_frame.size];
+ _is_animating = 0;
+ [self.adapter windowDidExitFullScreen];
+ }
}
- (NSArray *)customWindowsToEnterFullScreenForWindow:(NSWindow *)window
@@ -150,13 +170,13 @@
- (void)windowDidEnterFullScreen:(NSNotification *)notification
{
_is_animating = 0;
- [self.adapter windowDidEnterFullScreen:notification];
+ [self.adapter windowDidEnterFullScreen];
}
- (void)windowDidExitFullScreen:(NSNotification *)notification
{
_is_animating = 0;
- [self.adapter windowDidExitFullScreen:notification];
+ [self.adapter windowDidExitFullScreen];
}
- (void)windowWillEnterFullScreen:(NSNotification *)notification
@@ -390,7 +410,8 @@
if (NSMaxX(nf) < NSMinX(vf))
nf.origin.x = NSMinX(vf);
- if (NSHeight(nf) < NSHeight(vf) && NSHeight(of) > NSHeight(vf))
+ if (NSHeight(nf) < NSHeight(vf) && NSHeight(of) > NSHeight(vf) &&
+ ![self.adapter isInFullScreenMode])
// If the window height is smaller than the visible frame, but it was
// bigger previously recenter the smaller window vertically. This is
// needed to counter the 'snap to top' behaviour.
diff --git a/video/out/cocoa_common.m b/video/out/cocoa_common.m
index 56cfd221d8..b535de279d 100644
--- a/video/out/cocoa_common.m
+++ b/video/out/cocoa_common.m
@@ -1014,6 +1014,11 @@ int vo_cocoa_control(struct vo *vo, int *events, int request, void *arg)
return self.vout->cocoa->fullscreen;
}
+- (BOOL)wantsNativeFullscreen
+{
+ return self.vout->opts->native_fs;
+}
+
- (NSScreen *)getTargetScreen
{
struct vo_cocoa_state *s = self.vout->cocoa;
@@ -1039,7 +1044,7 @@ int vo_cocoa_control(struct vo *vo, int *events, int request, void *arg)
flag_events(self.vout, VO_EVENT_WIN_STATE);
}
-- (void)windowDidEnterFullScreen:(NSNotification *)notification
+- (void)windowDidEnterFullScreen
{
struct vo_cocoa_state *s = self.vout->cocoa;
s->fullscreen = 1;
@@ -1047,7 +1052,7 @@ int vo_cocoa_control(struct vo *vo, int *events, int request, void *arg)
vo_cocoa_anim_unlock(self.vout);
}
-- (void)windowDidExitFullScreen:(NSNotification *)notification
+- (void)windowDidExitFullScreen
{
struct vo_cocoa_state *s = self.vout->cocoa;
s->fullscreen = 0;