]> git.sesse.net Git - vlc/commitdiff
macosx: exit the native fullscreen mode if video is finished
authorDavid Fuhrmann <dfuhrmann@videolan.org>
Sun, 30 Mar 2014 19:43:15 +0000 (21:43 +0200)
committerDavid Fuhrmann <dfuhrmann@videolan.org>
Sun, 30 Mar 2014 21:44:40 +0000 (23:44 +0200)
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.

modules/gui/macosx/VLCVoutWindowController.m
modules/gui/macosx/Windows.h
modules/gui/macosx/Windows.m

index ba08b18548c2503494ea27b34b06e51b35cda39a..828e42cb92586ea665661a57f4264e16206c2641 100644 (file)
 
     // 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];
 
index db4171e600415060718cf8349c57b66b9c4ad155..d3dec6b9b5090c5e99cc5988b3d147d750480d69 100644 (file)
@@ -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;
+@property (readonly) BOOL windowShouldExitFullscreenWhenFinished;
 
 - (void)setWindowLevel:(NSInteger)i_state;
 
index d45ee797a8a591d89bbc080a10fa4956a6bde34f..4ddf544836221b6affa2c5abf8aa0c569156ef6b 100644 (file)
 @synthesize videoView=o_video_view;
 @synthesize controlsBar=o_controls_bar;
 @synthesize inFullscreenTransition=b_in_fullscreen_transition;
+@synthesize windowShouldExitFullscreenWhenFinished=b_windowShouldExitFullscreenWhenFinished;
 
 #pragma mark -
 #pragma mark Init
     [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];