From a8347eb9ba9e09177da50592fde7f3ae7261ce59 Mon Sep 17 00:00:00 2001 From: Akemi Date: Sun, 4 Dec 2016 22:52:14 +0100 Subject: cocoa: fullscreen refactoring this replaces the old fullscreen with the native macOS fullscreen. additional the --fs-black-out-screens was removed since the new API doesn't support it in a way the old one did. it can possibly be re-added if done manually. Fixes #2857 #3272 #1352 #2062 #3864 --- video/out/cocoa/events_view.m | 71 ------------------------------------------- 1 file changed, 71 deletions(-) (limited to 'video/out/cocoa/events_view.m') diff --git a/video/out/cocoa/events_view.m b/video/out/cocoa/events_view.m index 5de4a99eec..53d1da86ff 100644 --- a/video/out/cocoa/events_view.m +++ b/video/out/cocoa/events_view.m @@ -28,8 +28,6 @@ @property(nonatomic, assign) BOOL clearing; @property(nonatomic, assign) BOOL hasMouseDown; @property(nonatomic, retain) NSTrackingArea *tracker; -- (BOOL)hasDock:(NSScreen*)screen; -- (BOOL)hasMenubar:(NSScreen*)screen; - (int)mpvButtonNumber:(NSEvent*)event; - (void)mouseDownEvent:(NSEvent *)event; - (void)mouseUpEvent:(NSEvent *)event; @@ -51,54 +49,6 @@ return self; } -- (void)setFullScreen:(BOOL)willBeFullscreen -{ - if (willBeFullscreen && ![self isInFullScreenMode]) { - NSApplicationPresentationOptions popts = - NSApplicationPresentationDefault; - - if ([self hasMenubar:[self.adapter fsScreen]]) - // Cocoa raises an exception when autohiding the menubar but - // not the dock. They probably got bored while programming the - // multi screen support and took some shortcuts (tested on 10.8). - popts |= NSApplicationPresentationAutoHideMenuBar | - NSApplicationPresentationAutoHideDock; - - if ([self hasDock:[self.adapter fsScreen]]) - popts |= NSApplicationPresentationAutoHideDock; - - NSDictionary *fsopts = @{ - NSFullScreenModeAllScreens : @([self.adapter fsModeAllScreens]), - NSFullScreenModeApplicationPresentationOptions : @(popts) - }; - - // The original "windowed" window will stay around since sending a - // view fullscreen wraps it in another window. This is noticeable when - // sending the View fullscreen to another screen. Make it go away - // manually. - [self.window orderOut:self]; - - [self enterFullScreenMode:[self.adapter fsScreen] - withOptions:fsopts]; - } - - if (!willBeFullscreen && [self isInFullScreenMode]) { - [self exitFullScreenModeWithOptions:nil]; - - // Show the "windowed" window again. - [self.window makeKeyAndOrderFront:self]; - [self.window makeFirstResponder:self]; - } -} - -- (void)clear -{ - if ([self isInFullScreenMode]) { - self.clearing = YES; - [self exitFullScreenModeWithOptions:nil]; - } -} - // mpv uses flipped coordinates, because X11 uses those. So let's just use them // as well without having to do any coordinate conversion of mouse positions. - (BOOL)isFlipped { return YES; } @@ -379,27 +329,6 @@ return NO; } -- (BOOL)hasDock:(NSScreen*)screen -{ - NSRect vF = [screen visibleFrame]; - NSRect f = [screen frame]; - return - // The visible frame's width is smaller: dock is on left or right end - // of this method's receiver. - vF.size.width < f.size.width || - // The visible frame's veritical origin is bigger: dock is - // on the bottom of this method's receiver. - vF.origin.y > f.origin.y; - -} - -- (BOOL)hasMenubar:(NSScreen*)screen -{ - NSRect vF = [screen visibleFrame]; - NSRect f = [screen frame]; - return f.size.height + f.origin.y > vF.size.height + vF.origin.y; -} - - (int)mpvButtonNumber:(NSEvent*)event { int buttonNumber = [event buttonNumber]; -- cgit v1.2.3