[vlc-commits] macosx: exit the native fullscreen mode if video is finished

David Fuhrmann git at videolan.org
Sun Mar 30 23:45:06 CEST 2014


vlc | branch: master | David Fuhrmann <dfuhrmann at videolan.org> | Sun Mar 30 21:43:15 2014 +0200| [dd6454da613a5791a1e228f1c14da9b2a4a88bb5] | committer: David Fuhrmann

macosx: exit the native fullscreen mode if video is finished

This implements the behaviour in a similar way as in non-native mode.
Only if the window was set to fullscreen already before video started,
it will stay in this state.

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

 modules/gui/macosx/VLCVoutWindowController.m |   14 +++++++++++---
 modules/gui/macosx/Windows.h                 |    3 +++
 modules/gui/macosx/Windows.m                 |    3 +++
 3 files changed, 17 insertions(+), 3 deletions(-)

diff --git a/modules/gui/macosx/VLCVoutWindowController.m b/modules/gui/macosx/VLCVoutWindowController.m
index ba08b18..828e42c 100644
--- a/modules/gui/macosx/VLCVoutWindowController.m
+++ b/modules/gui/macosx/VLCVoutWindowController.m
@@ -237,9 +237,17 @@
 
     // prevent visible extra window if in fullscreen
     NSDisableScreenUpdates();
-    if (![[VLCMainWindow sharedInstance] nativeFullscreenMode] &&
-            ([o_window fullscreen] || [o_window inFullscreenTransition]))
-        [o_window leaveFullscreenWithAnimation: NO];
+    BOOL b_native = [[VLCMainWindow sharedInstance] nativeFullscreenMode];
+
+    // close fullscreen, without changing fullscreen vars
+    if (!b_native && ([o_window fullscreen] || [o_window inFullscreenTransition]))
+        [o_window leaveFullscreenWithAnimation:NO];
+
+    // native fullscreen window will not be closed if
+    // fullscreen was triggered without video
+    if ((b_native && [o_window class] == [VLCMainWindow class] && [o_window fullscreen] && [o_window windowShouldExitFullscreenWhenFinished])) {
+        [o_window toggleFullScreen:self];
+    }
 
     [[o_window videoView] releaseVoutThread];
 
diff --git a/modules/gui/macosx/Windows.h b/modules/gui/macosx/Windows.h
index db4171e..d3dec6b 100644
--- a/modules/gui/macosx/Windows.h
+++ b/modules/gui/macosx/Windows.h
@@ -110,11 +110,14 @@ static const float f_min_video_height = 70.0;
     BOOL b_in_fullscreen_transition;
 
     NSRect frameBeforeLionFullscreen;
+
+    BOOL b_windowShouldExitFullscreenWhenFinished;
 }
 
 @property (nonatomic, assign) VLCVoutView* videoView;
 @property (readonly) VLCControlsBarCommon* controlsBar;
 @property (readonly) BOOL inFullscreenTransition;
+ at property (readonly) BOOL windowShouldExitFullscreenWhenFinished;
 
 - (void)setWindowLevel:(NSInteger)i_state;
 
diff --git a/modules/gui/macosx/Windows.m b/modules/gui/macosx/Windows.m
index d45ee79..4ddf544 100644
--- a/modules/gui/macosx/Windows.m
+++ b/modules/gui/macosx/Windows.m
@@ -288,6 +288,7 @@
 @synthesize videoView=o_video_view;
 @synthesize controlsBar=o_controls_bar;
 @synthesize inFullscreenTransition=b_in_fullscreen_transition;
+ at synthesize windowShouldExitFullscreenWhenFinished=b_windowShouldExitFullscreenWhenFinished;
 
 #pragma mark -
 #pragma mark Init
@@ -713,6 +714,8 @@
     [NSApp setPresentationOptions:(NSApplicationPresentationFullScreen | NSApplicationPresentationAutoHideDock | NSApplicationPresentationAutoHideMenuBar)];
 
     i_originalLevel = [self level];
+    b_windowShouldExitFullscreenWhenFinished = [[VLCMain sharedInstance] activeVideoPlayback];
+
     // b_fullscreen and b_in_fullscreen_transition must not be true yet
     [[[VLCMain sharedInstance] voutController] updateWindowLevelForHelperWindows: NSNormalWindowLevel];
     [self setLevel:NSNormalWindowLevel];



More information about the vlc-commits mailing list