[vlc-devel] [PATCH] macOS: Set correct fullscreen window level

Andreas Mieke andreas at 1750studios.com
Tue May 2 21:15:00 CEST 2017


Setting the correct fullscreen window level to hide menu bar
when other apps are active, according to
https://developer.apple.com/library/content/documentation/GraphicsImaging/Conceptual/OpenGL-MacProgGuide/opengl_fullscreen/opengl_cgl.html

Fix #18117
---
 Thanks for the review, I have checked out the helper windows and adapted
 my code to keep them working with the new fullscreen level too. Also
 I have added the fullscreen playback controller to the
 updateWindowLevelForHelperWindows: to keep the controller working too.

 modules/gui/macosx/VLCVoutWindowController.m |  1 +
 modules/gui/macosx/Windows.m                 | 11 +++++------
 2 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/modules/gui/macosx/VLCVoutWindowController.m b/modules/gui/macosx/VLCVoutWindowController.m
index eaf17ab..a0aaa18 100644
--- a/modules/gui/macosx/VLCVoutWindowController.m
+++ b/modules/gui/macosx/VLCVoutWindowController.m
@@ -597,6 +597,7 @@ - (void)updateWindowLevelForHelperWindows:(NSInteger)i_level
     [[main bookmarks] updateCocoaWindowLevel:currentStatusWindowLevel];
     [[main trackSyncPanel] updateCocoaWindowLevel:currentStatusWindowLevel];
     [[main resumeDialog] updateCocoaWindowLevel:currentStatusWindowLevel];
+    [[[[[VLCMain sharedInstance] mainWindow] fspanel] window] setLevel:currentStatusWindowLevel];
 }
 
 @end
diff --git a/modules/gui/macosx/Windows.m b/modules/gui/macosx/Windows.m
index 1e4e982..4a03716 100644
--- a/modules/gui/macosx/Windows.m
+++ b/modules/gui/macosx/Windows.m
@@ -661,8 +661,8 @@ - (void)windowWillEnterFullScreen:(NSNotification *)notification
 
     NSInteger i_currLevel = [self level];
     // self.fullscreen and _inFullscreenTransition must not be true yet
-    [[[VLCMain sharedInstance] voutController] updateWindowLevelForHelperWindows: NSNormalWindowLevel];
-    [self setLevel:NSNormalWindowLevel];
+    [[[VLCMain sharedInstance] voutController] updateWindowLevelForHelperWindows: NSMainMenuWindowLevel + 1];
+    [self setLevel:NSMainMenuWindowLevel + 1];
     i_originalLevel = i_currLevel;
 
     _inFullscreenTransition = YES;
@@ -815,8 +815,8 @@ - (void)enterFullscreenWithAnimation:(BOOL)b_animation
     /* Make sure we don't see the window flashes in float-on-top mode */
     NSInteger i_currLevel = [self level];
     // self.fullscreen must not be true yet
-    [[[VLCMain sharedInstance] voutController] updateWindowLevelForHelperWindows: NSNormalWindowLevel];
-    [self setLevel:NSNormalWindowLevel];
+    [[[VLCMain sharedInstance] voutController] updateWindowLevelForHelperWindows: NSMainMenuWindowLevel + 1];
+    [self setLevel:NSMainMenuWindowLevel + 1];
     i_originalLevel = i_currLevel; // would be overwritten by previous call
 
     /* Only create the o_fullscreen_window if we are not in the middle of the zooming animation */
@@ -832,6 +832,7 @@ - (void)enterFullscreenWithAnimation:(BOOL)b_animation
         [o_fullscreen_window setCanBecomeMainWindow: YES];
         [o_fullscreen_window setHasActiveVideo: YES];
         [o_fullscreen_window setFullscreen: YES];
+        [o_fullscreen_window setLevel:NSMainMenuWindowLevel + 1];
 
         /* Make sure video view gets visible in case the playlist was visible before */
         b_video_view_was_hidden = [_videoView isHidden];
@@ -862,8 +863,6 @@ - (void)enterFullscreenWithAnimation:(BOOL)b_animation
 
             [o_fullscreen_window orderFront:self animate:YES];
 
-            [o_fullscreen_window setLevel:NSNormalWindowLevel];
-
             if (blackout_other_displays) {
                 CGDisplayFade(token, 0.3, kCGDisplayBlendSolidColor, kCGDisplayBlendNormal, 0, 0, 0, NO);
                 CGReleaseDisplayFadeReservation(token);
-- 
2.10.1 (Apple Git-78)



More information about the vlc-devel mailing list