[vlc-commits] macosx: add workaround to avoid grey or transparent top bars in fullscreen mode

David Fuhrmann git at videolan.org
Mon Feb 24 15:28:20 CET 2014


vlc | branch: master | David Fuhrmann <david.fuhrmann at googlemail.com> | Sun Feb 23 18:12:14 2014 +0100| [e568e69e603f0fd6993acd376b343750e899a7bf] | committer: David Fuhrmann

macosx: add workaround to avoid grey or transparent top bars in fullscreen mode

close #9469

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=e568e69e603f0fd6993acd376b343750e899a7bf
---

 modules/gui/macosx/Windows.m |   33 +++++++++++++++++++++++++++++++++
 1 file changed, 33 insertions(+)

diff --git a/modules/gui/macosx/Windows.m b/modules/gui/macosx/Windows.m
index c9962d2..cad88fd 100644
--- a/modules/gui/macosx/Windows.m
+++ b/modules/gui/macosx/Windows.m
@@ -229,6 +229,39 @@
     return nil;
 }
 
+- (NSRect)constrainFrameRect:(NSRect)frameRect toScreen:(NSScreen *)screen
+{
+    if (!screen)
+        screen = [self screen];
+    NSRect screenRect = [screen frame];
+    NSRect constrainedRect = [super constrainFrameRect:frameRect toScreen:screen];
+
+    /*
+     * Ugly workaround!
+     * With Mavericks, there is a nasty bug resulting in grey bars on top in fullscreen mode.
+     * It looks like this is enforced by the os because the window is in the way for the menu bar.
+     *
+     * According to the documentation, this constraining can be changed by overwriting this
+     * method. But in this situation, even the received frameRect is already contrained with the
+     * menu bars height substracted. This case is detected here, and the full height is
+     * enforced again.
+     *
+     * See #9469 and radar://15583566
+     */
+
+    BOOL b_inFullscreen = [self fullscreen] || ([self respondsToSelector:@selector(inFullscreenTransition)] && [(VLCVideoWindowCommon *)self inFullscreenTransition]);
+
+    if(OSX_MAVERICKS && b_inFullscreen && constrainedRect.size.width == screenRect.size.width
+          && constrainedRect.size.height != screenRect.size.height
+          && abs(screenRect.size.height - constrainedRect.size.height) <= 25.) {
+
+        msg_Dbg(VLCIntf, "Contrain window height %.1f to screen height %.1f",
+                constrainedRect.size.height, screenRect.size.height);
+        constrainedRect.size.height = screenRect.size.height;
+    }
+
+    return constrainedRect;
+}
 
 @end
 



More information about the vlc-commits mailing list