[vlc-commits] macosx: Hide title bar and controls bar for lion fullscreen

David Fuhrmann git at videolan.org
Sat Apr 22 16:35:13 CEST 2017


vlc | branch: master | David Fuhrmann <dfuhrmann at videolan.org> | Sat Apr 22 09:20:49 2017 +0200| [df494a0b20d2e9a5c8cdcbf319136d8dc4fac82a] | committer: David Fuhrmann

macosx: Hide title bar and controls bar for lion fullscreen

Titlebar is now included into the view hierarchy by default and
simply removed for white appearance.
For fullscreen, title bar and controls bar are hidden only. Video
view in fullscreen mode has constraints with higher priority, to
reach the content view frame. In windowed mode, constraints to
title bar and controls bar have precedence.

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

 .../package/macosx/VLC.xcodeproj/project.pbxproj   |   4 +
 modules/gui/macosx/UI/DetachedVideoWindow.xib      | 200 +++++++++++----------
 modules/gui/macosx/VLCMainWindow.m                 |  16 +-
 modules/gui/macosx/Windows.h                       |   3 +
 modules/gui/macosx/Windows.m                       |  28 ++-
 5 files changed, 131 insertions(+), 120 deletions(-)

diff --git a/extras/package/macosx/VLC.xcodeproj/project.pbxproj b/extras/package/macosx/VLC.xcodeproj/project.pbxproj
index 23456d5f08..f9f2624f96 100644
--- a/extras/package/macosx/VLC.xcodeproj/project.pbxproj
+++ b/extras/package/macosx/VLC.xcodeproj/project.pbxproj
@@ -160,6 +160,8 @@
 		1C3114281E508D1B00D4DD76 /* VLCFullScreenPanel.xib in Sources */ = {isa = PBXBuildFile; fileRef = 6B8224181E4D2A9000833BE1 /* VLCFullScreenPanel.xib */; };
 		1C3114291E508D1B00D4DD76 /* VLCRendererDialog.xib in Sources */ = {isa = PBXBuildFile; fileRef = 6B8224191E4D2A9000833BE1 /* VLCRendererDialog.xib */; };
 		1C31142A1E508D1B00D4DD76 /* VLCStatusBarIconMainMenu.xib in Sources */ = {isa = PBXBuildFile; fileRef = 6B82241A1E4D2A9000833BE1 /* VLCStatusBarIconMainMenu.xib */; };
+		1C69FDF51EAB30C7007724ED /* Windows.h in Sources */ = {isa = PBXBuildFile; fileRef = E06CF7F416020F6200C698B7 /* Windows.h */; };
+		1C69FDF61EAB30C7007724ED /* Windows.m in Sources */ = {isa = PBXBuildFile; fileRef = E06CF7F516020F6200C698B7 /* Windows.m */; };
 		1CFE8D591EA0D42A00E94451 /* VLCErrorWindowController.m in Sources */ = {isa = PBXBuildFile; fileRef = 1CFE8D581EA0D42A00E94451 /* VLCErrorWindowController.m */; };
 		6B3BE42C1E6217CB008D098A /* VLCHUDImageButton.m in Sources */ = {isa = PBXBuildFile; fileRef = 6B3BE42B1E6217CB008D098A /* VLCHUDImageButton.m */; };
 		6B3BE4321E621F24008D098A /* VLCHUDToggleButton.m in Sources */ = {isa = PBXBuildFile; fileRef = 6B3BE4311E621F24008D098A /* VLCHUDToggleButton.m */; };
@@ -1918,6 +1920,8 @@
 			isa = PBXSourcesBuildPhase;
 			buildActionMask = 2147483647;
 			files = (
+				1C69FDF51EAB30C7007724ED /* Windows.h in Sources */,
+				1C69FDF61EAB30C7007724ED /* Windows.m in Sources */,
 				1C31140E1E508D1B00D4DD76 /* About.xib in Sources */,
 				6B3BE42C1E6217CB008D098A /* VLCHUDImageButton.m in Sources */,
 				1C31140F1E508D1B00D4DD76 /* AddonManager.xib in Sources */,
diff --git a/modules/gui/macosx/UI/DetachedVideoWindow.xib b/modules/gui/macosx/UI/DetachedVideoWindow.xib
index 4acbc91c96..45d42158ae 100644
--- a/modules/gui/macosx/UI/DetachedVideoWindow.xib
+++ b/modules/gui/macosx/UI/DetachedVideoWindow.xib
@@ -21,6 +21,95 @@
                 <rect key="frame" x="0.0" y="0.0" width="363" height="239"/>
                 <autoresizingMask key="autoresizingMask"/>
                 <subviews>
+                    <customView translatesAutoresizingMaskIntoConstraints="NO" id="1" userLabel="Detached Title View" customClass="VLCMainWindowTitleView">
+                        <rect key="frame" x="0.0" y="217" width="363" height="22"/>
+                        <subviews>
+                            <button translatesAutoresizingMaskIntoConstraints="NO" id="24" customClass="VLCCustomWindowCloseButton">
+                                <rect key="frame" x="7" y="3" width="14" height="16"/>
+                                <constraints>
+                                    <constraint firstAttribute="height" constant="16" id="HAp-cx-URj"/>
+                                    <constraint firstAttribute="width" constant="14" id="LNf-Qy-TG9"/>
+                                </constraints>
+                                <buttonCell key="cell" type="bevel" bezelStyle="regularSquare" imagePosition="only" alignment="left" imageScaling="axesIndependently" inset="2" id="33" customClass="VLCWindowButtonCell">
+                                    <behavior key="behavior" lightByContents="YES"/>
+                                    <font key="font" metaFont="system"/>
+                                </buttonCell>
+                                <connections>
+                                    <action selector="buttonAction:" target="1" id="53"/>
+                                </connections>
+                            </button>
+                            <button translatesAutoresizingMaskIntoConstraints="NO" id="25" customClass="VLCCustomWindowMinimizeButton">
+                                <rect key="frame" x="27" y="3" width="14" height="16"/>
+                                <constraints>
+                                    <constraint firstAttribute="height" constant="16" id="4re-Vn-YFb"/>
+                                    <constraint firstAttribute="width" constant="14" id="PBv-gC-vlV"/>
+                                </constraints>
+                                <buttonCell key="cell" type="bevel" bezelStyle="regularSquare" imagePosition="only" alignment="left" imageScaling="axesIndependently" inset="2" id="32" customClass="VLCWindowButtonCell">
+                                    <behavior key="behavior" lightByContents="YES"/>
+                                    <font key="font" metaFont="system"/>
+                                </buttonCell>
+                                <connections>
+                                    <action selector="buttonAction:" target="1" id="38"/>
+                                </connections>
+                            </button>
+                            <button translatesAutoresizingMaskIntoConstraints="NO" id="26" customClass="VLCCustomWindowZoomButton">
+                                <rect key="frame" x="47" y="3" width="14" height="16"/>
+                                <constraints>
+                                    <constraint firstAttribute="height" constant="16" id="2tY-4g-xst"/>
+                                    <constraint firstAttribute="width" constant="14" id="YKz-Lu-TFt"/>
+                                </constraints>
+                                <buttonCell key="cell" type="bevel" bezelStyle="regularSquare" imagePosition="only" alignment="left" imageScaling="axesIndependently" inset="2" id="31" customClass="VLCWindowButtonCell">
+                                    <behavior key="behavior" lightByContents="YES"/>
+                                    <font key="font" metaFont="system"/>
+                                </buttonCell>
+                                <connections>
+                                    <action selector="buttonAction:" target="1" id="52"/>
+                                </connections>
+                            </button>
+                            <button translatesAutoresizingMaskIntoConstraints="NO" id="27" customClass="VLCCustomWindowFullscreenButton">
+                                <rect key="frame" x="345" y="3" width="14" height="15"/>
+                                <constraints>
+                                    <constraint firstAttribute="width" constant="14" id="dit-fr-XIj"/>
+                                </constraints>
+                                <buttonCell key="cell" type="square" bezelStyle="shadowlessSquare" alignment="center" state="on" inset="2" id="30" customClass="VLCWindowButtonCell">
+                                    <behavior key="behavior" lightByContents="YES"/>
+                                    <font key="font" metaFont="system"/>
+                                </buttonCell>
+                                <connections>
+                                    <action selector="buttonAction:" target="1" id="55"/>
+                                </connections>
+                            </button>
+                            <textField verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="28" customClass="VLCWindowTitleTextField">
+                                <rect key="frame" x="65" y="3" width="224" height="17"/>
+                                <textFieldCell key="cell" lineBreakMode="truncatingTail" sendsActionOnEndEditing="YES" alignment="center" title="VLC media player" allowsEditingTextAttributes="YES" usesSingleLineMode="YES" id="29">
+                                    <font key="font" metaFont="system"/>
+                                    <color key="textColor" red="1" green="1" blue="1" alpha="1" colorSpace="calibratedRGB"/>
+                                    <color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
+                                </textFieldCell>
+                            </textField>
+                        </subviews>
+                        <constraints>
+                            <constraint firstAttribute="height" constant="22" id="6c1-oq-5vw"/>
+                            <constraint firstAttribute="trailing" secondItem="27" secondAttribute="trailing" constant="4" id="EUa-A3-U77"/>
+                            <constraint firstItem="26" firstAttribute="leading" secondItem="25" secondAttribute="trailing" constant="6" id="EgY-Oe-oRg"/>
+                            <constraint firstItem="28" firstAttribute="centerY" secondItem="1" secondAttribute="centerY" id="FVC-gH-9JQ"/>
+                            <constraint firstItem="25" firstAttribute="leading" secondItem="24" secondAttribute="trailing" constant="6" id="JgK-vs-BrQ"/>
+                            <constraint firstItem="25" firstAttribute="centerY" secondItem="1" secondAttribute="centerY" id="Lw5-nW-6lW"/>
+                            <constraint firstItem="24" firstAttribute="leading" secondItem="1" secondAttribute="leading" constant="7" id="NvG-rV-YhY"/>
+                            <constraint firstItem="27" firstAttribute="centerY" secondItem="1" secondAttribute="centerY" id="YIS-Te-ToL"/>
+                            <constraint firstItem="24" firstAttribute="centerY" secondItem="1" secondAttribute="centerY" id="aUJ-zT-GaH"/>
+                            <constraint firstItem="27" firstAttribute="leading" secondItem="28" secondAttribute="trailing" constant="58" id="pUY-UB-1Wm"/>
+                            <constraint firstItem="26" firstAttribute="centerY" secondItem="1" secondAttribute="centerY" id="rKd-Tw-gjS"/>
+                            <constraint firstItem="28" firstAttribute="leading" secondItem="26" secondAttribute="trailing" constant="6" id="uRA-WS-6cJ"/>
+                        </constraints>
+                        <connections>
+                            <outlet property="fullscreenButton" destination="27" id="Q7Q-c7-2mT"/>
+                            <outlet property="greenButton" destination="26" id="ene-pt-Lib"/>
+                            <outlet property="redButton" destination="24" id="gRU-rk-buI"/>
+                            <outlet property="titleLabel" destination="28" id="hLC-1g-oFA"/>
+                            <outlet property="yellowButton" destination="25" id="RzQ-RH-CMN"/>
+                        </connections>
+                    </customView>
                     <customView translatesAutoresizingMaskIntoConstraints="NO" id="5" customClass="VLCThreePartImageView">
                         <rect key="frame" x="0.0" y="0.0" width="363" height="36"/>
                         <subviews>
@@ -165,114 +254,41 @@
                         </constraints>
                     </customView>
                     <customView translatesAutoresizingMaskIntoConstraints="NO" id="63" customClass="VLCVoutView">
-                        <rect key="frame" x="0.0" y="36" width="363" height="203"/>
+                        <rect key="frame" x="0.0" y="36" width="363" height="181"/>
                     </customView>
                 </subviews>
                 <constraints>
                     <constraint firstItem="5" firstAttribute="leading" secondItem="4" secondAttribute="leading" id="9Ml-c7-Mey"/>
-                    <constraint firstItem="63" firstAttribute="top" secondItem="4" secondAttribute="top" id="SR5-da-lz7"/>
-                    <constraint firstItem="5" firstAttribute="top" secondItem="63" secondAttribute="bottom" id="VbV-nq-qDN"/>
+                    <constraint firstItem="1" firstAttribute="leading" secondItem="4" secondAttribute="leading" id="Ax8-ub-dBJ"/>
+                    <constraint firstItem="1" firstAttribute="top" secondItem="4" secondAttribute="top" id="F0d-2K-Uhn"/>
+                    <constraint firstItem="63" firstAttribute="top" secondItem="1" secondAttribute="bottom" priority="999" id="FwP-Fl-7P6"/>
+                    <constraint firstItem="63" firstAttribute="top" secondItem="4" secondAttribute="top" priority="750" id="SR5-da-lz7">
+                        <attributedString key="userComments">
+                            <fragment content="Optional constraint if no titlebar">
+                                <attributes>
+                                    <font key="NSFont" metaFont="smallSystem"/>
+                                    <paragraphStyle key="NSParagraphStyle" alignment="natural" lineBreakMode="wordWrapping" baseWritingDirection="natural" tighteningFactorForTruncation="0.0"/>
+                                </attributes>
+                            </fragment>
+                        </attributedString>
+                    </constraint>
+                    <constraint firstItem="5" firstAttribute="top" secondItem="63" secondAttribute="bottom" priority="999" id="VbV-nq-qDN"/>
+                    <constraint firstAttribute="bottom" secondItem="63" secondAttribute="bottom" priority="750" id="Xml-gb-MF1"/>
                     <constraint firstItem="63" firstAttribute="leading" secondItem="4" secondAttribute="leading" id="b8K-0j-YLT"/>
                     <constraint firstAttribute="trailing" secondItem="63" secondAttribute="trailing" id="b8X-Kc-BfD"/>
                     <constraint firstAttribute="trailing" secondItem="5" secondAttribute="trailing" id="jZw-zr-cck"/>
                     <constraint firstAttribute="bottom" secondItem="5" secondAttribute="bottom" id="mhi-VL-aFb"/>
+                    <constraint firstAttribute="trailing" secondItem="1" secondAttribute="trailing" id="qhH-vy-333"/>
                 </constraints>
             </view>
             <connections>
                 <outlet property="controlsBar" destination="3" id="69"/>
                 <outlet property="titlebarView" destination="1" id="70"/>
                 <outlet property="videoView" destination="63" id="68"/>
+                <outlet property="videoViewBottomConstraint" destination="VbV-nq-qDN" id="twJ-2J-MZX"/>
+                <outlet property="videoViewTopConstraint" destination="FwP-Fl-7P6" id="aVJ-aJ-MxQ"/>
             </connections>
         </window>
-        <customView id="1" userLabel="Detached Title View" customClass="VLCMainWindowTitleView">
-            <rect key="frame" x="0.0" y="0.0" width="400" height="22"/>
-            <autoresizingMask key="autoresizingMask" widthSizable="YES" flexibleMinY="YES"/>
-            <subviews>
-                <button translatesAutoresizingMaskIntoConstraints="NO" id="24" customClass="VLCCustomWindowCloseButton">
-                    <rect key="frame" x="7" y="3" width="14" height="16"/>
-                    <constraints>
-                        <constraint firstAttribute="height" constant="16" id="HAp-cx-URj"/>
-                        <constraint firstAttribute="width" constant="14" id="LNf-Qy-TG9"/>
-                    </constraints>
-                    <buttonCell key="cell" type="bevel" bezelStyle="regularSquare" imagePosition="only" alignment="left" imageScaling="axesIndependently" inset="2" id="33" customClass="VLCWindowButtonCell">
-                        <behavior key="behavior" lightByContents="YES"/>
-                        <font key="font" metaFont="system"/>
-                    </buttonCell>
-                    <connections>
-                        <action selector="buttonAction:" target="1" id="53"/>
-                    </connections>
-                </button>
-                <button translatesAutoresizingMaskIntoConstraints="NO" id="25" customClass="VLCCustomWindowMinimizeButton">
-                    <rect key="frame" x="27" y="3" width="14" height="16"/>
-                    <constraints>
-                        <constraint firstAttribute="height" constant="16" id="4re-Vn-YFb"/>
-                        <constraint firstAttribute="width" constant="14" id="PBv-gC-vlV"/>
-                    </constraints>
-                    <buttonCell key="cell" type="bevel" bezelStyle="regularSquare" imagePosition="only" alignment="left" imageScaling="axesIndependently" inset="2" id="32" customClass="VLCWindowButtonCell">
-                        <behavior key="behavior" lightByContents="YES"/>
-                        <font key="font" metaFont="system"/>
-                    </buttonCell>
-                    <connections>
-                        <action selector="buttonAction:" target="1" id="38"/>
-                    </connections>
-                </button>
-                <button translatesAutoresizingMaskIntoConstraints="NO" id="26" customClass="VLCCustomWindowZoomButton">
-                    <rect key="frame" x="47" y="3" width="14" height="16"/>
-                    <constraints>
-                        <constraint firstAttribute="height" constant="16" id="2tY-4g-xst"/>
-                        <constraint firstAttribute="width" constant="14" id="YKz-Lu-TFt"/>
-                    </constraints>
-                    <buttonCell key="cell" type="bevel" bezelStyle="regularSquare" imagePosition="only" alignment="left" imageScaling="axesIndependently" inset="2" id="31" customClass="VLCWindowButtonCell">
-                        <behavior key="behavior" lightByContents="YES"/>
-                        <font key="font" metaFont="system"/>
-                    </buttonCell>
-                    <connections>
-                        <action selector="buttonAction:" target="1" id="52"/>
-                    </connections>
-                </button>
-                <button translatesAutoresizingMaskIntoConstraints="NO" id="27" customClass="VLCCustomWindowFullscreenButton">
-                    <rect key="frame" x="382" y="3" width="14" height="15"/>
-                    <constraints>
-                        <constraint firstAttribute="width" constant="14" id="dit-fr-XIj"/>
-                    </constraints>
-                    <buttonCell key="cell" type="square" bezelStyle="shadowlessSquare" alignment="center" state="on" inset="2" id="30" customClass="VLCWindowButtonCell">
-                        <behavior key="behavior" lightByContents="YES"/>
-                        <font key="font" metaFont="system"/>
-                    </buttonCell>
-                    <connections>
-                        <action selector="buttonAction:" target="1" id="55"/>
-                    </connections>
-                </button>
-                <textField verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="28" customClass="VLCWindowTitleTextField">
-                    <rect key="frame" x="65" y="3" width="261" height="17"/>
-                    <textFieldCell key="cell" lineBreakMode="truncatingTail" sendsActionOnEndEditing="YES" alignment="center" title="VLC media player" allowsEditingTextAttributes="YES" usesSingleLineMode="YES" id="29">
-                        <font key="font" metaFont="system"/>
-                        <color key="textColor" red="1" green="1" blue="1" alpha="1" colorSpace="calibratedRGB"/>
-                        <color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
-                    </textFieldCell>
-                </textField>
-            </subviews>
-            <constraints>
-                <constraint firstAttribute="trailing" secondItem="27" secondAttribute="trailing" constant="4" id="EUa-A3-U77"/>
-                <constraint firstItem="26" firstAttribute="leading" secondItem="25" secondAttribute="trailing" constant="6" id="EgY-Oe-oRg"/>
-                <constraint firstItem="28" firstAttribute="centerY" secondItem="1" secondAttribute="centerY" id="FVC-gH-9JQ"/>
-                <constraint firstItem="25" firstAttribute="leading" secondItem="24" secondAttribute="trailing" constant="6" id="JgK-vs-BrQ"/>
-                <constraint firstItem="25" firstAttribute="centerY" secondItem="1" secondAttribute="centerY" id="Lw5-nW-6lW"/>
-                <constraint firstItem="24" firstAttribute="leading" secondItem="1" secondAttribute="leading" constant="7" id="NvG-rV-YhY"/>
-                <constraint firstItem="27" firstAttribute="centerY" secondItem="1" secondAttribute="centerY" id="YIS-Te-ToL"/>
-                <constraint firstItem="24" firstAttribute="centerY" secondItem="1" secondAttribute="centerY" id="aUJ-zT-GaH"/>
-                <constraint firstItem="27" firstAttribute="leading" secondItem="28" secondAttribute="trailing" constant="58" id="pUY-UB-1Wm"/>
-                <constraint firstItem="26" firstAttribute="centerY" secondItem="1" secondAttribute="centerY" id="rKd-Tw-gjS"/>
-                <constraint firstItem="28" firstAttribute="leading" secondItem="26" secondAttribute="trailing" constant="6" id="uRA-WS-6cJ"/>
-            </constraints>
-            <connections>
-                <outlet property="fullscreenButton" destination="27" id="Q7Q-c7-2mT"/>
-                <outlet property="greenButton" destination="26" id="ene-pt-Lib"/>
-                <outlet property="redButton" destination="24" id="gRU-rk-buI"/>
-                <outlet property="titleLabel" destination="28" id="hLC-1g-oFA"/>
-                <outlet property="yellowButton" destination="25" id="RzQ-RH-CMN"/>
-            </connections>
-        </customView>
         <customObject id="3" userLabel="Detached Window Controls Bar" customClass="VLCControlsBarCommon">
             <connections>
                 <outlet property="backwardButton" destination="11" id="aQU-S3-4ZI"/>
diff --git a/modules/gui/macosx/VLCMainWindow.m b/modules/gui/macosx/VLCMainWindow.m
index fa6f247602..25c4b30779 100644
--- a/modules/gui/macosx/VLCMainWindow.m
+++ b/modules/gui/macosx/VLCMainWindow.m
@@ -1380,25 +1380,15 @@ static const float f_min_window_height = 307.;
         [self setHasShadow:NO];
         [self setHasShadow:YES];
 
-        NSRect winrect = [self frame];
-        CGFloat f_titleBarHeight = [self.titlebarView frame].size.height;
-
         [self setTitle: _NS("VLC media player")];
-        [self.titlebarView setFrame: NSMakeRect(0, winrect.size.height - f_titleBarHeight, winrect.size.width, f_titleBarHeight)];
-        [[self contentView] addSubview: self.titlebarView positioned: NSWindowAbove relativeTo: nil];
 
     } else {
+        [self.titlebarView removeFromSuperview];
+        self.titlebarView = nil;
+
         [self setBackgroundColor: [NSColor blackColor]];
     }
 
-    NSRect videoViewRect = [[self contentView] bounds];
-    if (darkInterface)
-        videoViewRect.size.height -= [self.titlebarView frame].size.height;
-    CGFloat f_bottomBarHeight = [[self controlsBar] height];
-    videoViewRect.size.height -= f_bottomBarHeight;
-    videoViewRect.origin.y = f_bottomBarHeight;
-    [self.videoView setFrame: videoViewRect];
-
     if (darkInterface) {
         o_color_backdrop = [[VLCColorView alloc] initWithFrame: [self.videoView frame]];
         [[self contentView] addSubview: o_color_backdrop positioned: NSWindowBelow relativeTo: self.videoView];
diff --git a/modules/gui/macosx/Windows.h b/modules/gui/macosx/Windows.h
index e44052f761..6bd62c2620 100644
--- a/modules/gui/macosx/Windows.h
+++ b/modules/gui/macosx/Windows.h
@@ -63,6 +63,9 @@ static const float f_min_video_height = 70.0;
 @interface VLCVideoWindowCommon : VLCWindow <NSWindowDelegate, NSAnimationDelegate>
 
 @property (nonatomic, weak) IBOutlet VLCMainWindowTitleView *titlebarView; // only set in main or detached window
+ at property (weak) IBOutlet NSLayoutConstraint *videoViewTopConstraint;
+ at property (weak) IBOutlet NSLayoutConstraint *videoViewBottomConstraint;
+
 @property (nonatomic, weak) IBOutlet VLCVoutView* videoView;
 @property (nonatomic, weak) IBOutlet VLCControlsBarCommon* controlsBar;
 @property (readonly) BOOL inFullscreenTransition;
diff --git a/modules/gui/macosx/Windows.m b/modules/gui/macosx/Windows.m
index 6850ce14b9..be68af5f6c 100644
--- a/modules/gui/macosx/Windows.m
+++ b/modules/gui/macosx/Windows.m
@@ -678,19 +678,23 @@
         [[[VLCMain sharedInstance] mainWindow] recreateHideMouseTimer];
 
     if (_darkInterface) {
-        [self.titlebarView removeFromSuperviewWithoutNeedingDisplay];
+        [self.titlebarView setHidden:YES];
+        self.videoViewTopConstraint.priority = 1;
 
-        NSRect winrect;
+        // shrink window height
         CGFloat f_titleBarHeight = [self.titlebarView frame].size.height;
-        winrect = [self frame];
+        NSRect winrect = [self frame];
 
         winrect.size.height = winrect.size.height - f_titleBarHeight;
         [self setFrame: winrect display:NO animate:NO];
     }
 
+    // TODO remove
     [_videoView setFrame: [[self contentView] frame]];
+
     if (![_videoView isHidden]) {
         [[self.controlsBar bottomBarView] setHidden: YES];
+        self.videoViewBottomConstraint.priority = 1;
     }
 
     [self setMovableByWindowBackground: NO];
@@ -738,24 +742,17 @@
     [NSCursor setHiddenUntilMouseMoves: NO];
     [[[[VLCMain sharedInstance] mainWindow] fspanel] setNonActive];
 
-
     if (_darkInterface) {
-        NSRect winrect;
-        CGFloat f_titleBarHeight = [self.titlebarView frame].size.height;
-
-        winrect = [_videoView frame];
-        winrect.size.height -= f_titleBarHeight;
-        [_videoView setFrame: winrect];
-
-        winrect = [self frame];
-        [self.titlebarView setFrame: NSMakeRect(0, winrect.size.height - f_titleBarHeight,
-                                              winrect.size.width, f_titleBarHeight)];
-        [[self contentView] addSubview: self.titlebarView];
+        [self.titlebarView setHidden:NO];
+        self.videoViewTopConstraint.priority = 999;
 
+        NSRect winrect = [self frame];
+        CGFloat f_titleBarHeight = [self.titlebarView frame].size.height;
         winrect.size.height = winrect.size.height + f_titleBarHeight;
         [self setFrame: winrect display:NO animate:NO];
     }
 
+    // TODO remove
     NSRect videoViewFrame = [_videoView frame];
     videoViewFrame.origin.y += [self.controlsBar height];
     videoViewFrame.size.height -= [self.controlsBar height];
@@ -763,6 +760,7 @@
 
     if (![_videoView isHidden]) {
         [[self.controlsBar bottomBarView] setHidden: NO];
+        self.videoViewBottomConstraint.priority = 999;
     }
 
     [self setMovableByWindowBackground: YES];



More information about the vlc-commits mailing list