[vlc-commits] macosx: support multiple VLC windows in fullscreen, try to just display fspanel when sensible

David Fuhrmann git at videolan.org
Sat Feb 9 18:45:11 CET 2013


vlc | branch: master | David Fuhrmann <david.fuhrmann at googlemail.com> | Fri Feb  8 19:39:11 2013 +0100| [60eba2be7b2025be6ba78311083b9fbd7b195a1f] | committer: David Fuhrmann

macosx: support multiple VLC windows in fullscreen, try to just display fspanel when sensible

This allows main window and video window in fullscreen
Note that still the fspanel is displayed to often.

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

 modules/gui/macosx/VLCVoutWindowController.m |    6 +++++
 modules/gui/macosx/Windows.h                 |    3 ++-
 modules/gui/macosx/Windows.m                 |   31 ++++++++++++++++----------
 modules/gui/macosx/fspanel.m                 |    8 ++++++-
 4 files changed, 34 insertions(+), 14 deletions(-)

diff --git a/modules/gui/macosx/VLCVoutWindowController.m b/modules/gui/macosx/VLCVoutWindowController.m
index a23628f..9cb0cdd 100644
--- a/modules/gui/macosx/VLCVoutWindowController.m
+++ b/modules/gui/macosx/VLCVoutWindowController.m
@@ -179,6 +179,7 @@
         [[VLCMainWindow sharedInstance] setNonembedded:b_nonembedded];
 
     [o_vout_view setVoutThread:(vout_thread_t *)p_wnd->p_parent];
+    [o_new_video_window setHasActiveVideo: YES];
     [o_vout_dict setObject:[o_new_video_window autorelease] forKey:[NSValue valueWithPointer:p_wnd]];
 
     if (b_nonembedded) {
@@ -200,11 +201,16 @@
     if ([[VLCMainWindow sharedInstance] fullscreen] && ![[VLCMainWindow sharedInstance] nativeFullscreenMode])
         [o_window leaveFullscreen];
 
+    if ([[VLCMainWindow sharedInstance] fullscreen] && [[VLCMainWindow sharedInstance] nativeFullscreenMode])
+        [o_window toggleFullScreen: self];
+
+
     if (![NSStringFromClass([o_window class]) isEqualToString:@"VLCMainWindow"]) {
         [o_window orderOut:self];
     }
 
     [[o_window videoView] releaseVoutThread];
+    [o_window setHasActiveVideo: NO];
     [o_vout_dict removeObjectForKey:o_key];
 
     if ([o_vout_dict count] == 0)
diff --git a/modules/gui/macosx/Windows.h b/modules/gui/macosx/Windows.h
index 460b38f..f15ff80 100644
--- a/modules/gui/macosx/Windows.h
+++ b/modules/gui/macosx/Windows.h
@@ -95,11 +95,12 @@ static const float f_min_video_height = 70.0;
     NSRecursiveLock * o_animation_lock;
     NSInteger i_originalLevel;
 
-
+    BOOL              b_has_active_video;
 }
 
 @property (nonatomic, assign) VLCVoutView* videoView;
 @property (readonly) VLCControlsBarCommon* controlsBar;
+ at property (nonatomic, readwrite) BOOL hasActiveVideo;
 
 - (void)setWindowLevel:(NSInteger)i_state;
 
diff --git a/modules/gui/macosx/Windows.m b/modules/gui/macosx/Windows.m
index 0a6d64e..a441202 100644
--- a/modules/gui/macosx/Windows.m
+++ b/modules/gui/macosx/Windows.m
@@ -239,6 +239,7 @@
 
 @synthesize videoView=o_video_view;
 @synthesize controlsBar=o_controls_bar;
+ at synthesize hasActiveVideo=b_has_active_video;
 
 #pragma mark -
 #pragma mark Init
@@ -551,10 +552,12 @@
 
     var_SetBool(pl_Get(VLCIntf), "fullscreen", true);
 
-    vout_thread_t *p_vout = getVoutForActiveWindow();
-    if (p_vout) {
-        var_SetBool(p_vout, "fullscreen", true);
-        vlc_object_release(p_vout);
+    if ([self hasActiveVideo]) {
+        vout_thread_t *p_vout = getVoutForActiveWindow();
+        if (p_vout) {
+            var_SetBool(p_vout, "fullscreen", true);
+            vlc_object_release(p_vout);
+        }
     }
 
     [o_video_view setFrame: [[self contentView] frame]];
@@ -576,7 +579,8 @@
         [self setFrame: winrect display:NO animate:NO];
     }
 
-    if ([[VLCMain sharedInstance] activeVideoPlayback])
+    // TODO fix bottom bar status when vout just not visible, but there
+    if (![o_video_view isHidden])
         [[o_controls_bar bottomBarView] setHidden: YES];
 
     [self setMovableByWindowBackground: NO];
@@ -588,9 +592,10 @@
     // But this creates some problems when leaving fs over remote intfs, so activate app here.
     [NSApp activateIgnoringOtherApps:YES];
 
-    
-    [[[VLCMainWindow sharedInstance] fsPanel] setVoutWasUpdated: self];
-    [[[VLCMainWindow sharedInstance] fsPanel] setActive: nil];
+    if ([self hasActiveVideo]) {
+        [[[VLCMainWindow sharedInstance] fsPanel] setVoutWasUpdated: self];
+        [[[VLCMainWindow sharedInstance] fsPanel] setActive: nil];
+    }
 
     NSArray *subviews = [[self videoView] subviews];
     NSUInteger count = [subviews count];
@@ -606,10 +611,12 @@
 {
     var_SetBool(pl_Get(VLCIntf), "fullscreen", false);
 
-    vout_thread_t *p_vout = getVoutForActiveWindow();
-    if (p_vout) {
-        var_SetBool(p_vout, "fullscreen", false);
-        vlc_object_release(p_vout);
+    if ([self hasActiveVideo]) {
+        vout_thread_t *p_vout = getVoutForActiveWindow();
+        if (p_vout) {
+            var_SetBool(p_vout, "fullscreen", false);
+            vlc_object_release(p_vout);
+        }
     }
 
     [NSCursor setHiddenUntilMouseMoves: NO];
diff --git a/modules/gui/macosx/fspanel.m b/modules/gui/macosx/fspanel.m
index d941fc3..bc69fac 100644
--- a/modules/gui/macosx/fspanel.m
+++ b/modules/gui/macosx/fspanel.m
@@ -183,7 +183,13 @@
 - (void)setActive:(id)noData
 {
     b_nonActive = NO;
-    [[VLCMain sharedInstance] showFullscreenController];
+
+    id currentWindow = [NSApp keyWindow];
+    if ([currentWindow respondsToSelector:@selector(hasActiveVideo)]) {
+        if ([currentWindow hasActiveVideo]) {
+            [[VLCMain sharedInstance] showFullscreenController];
+        }
+    }
 }
 
 /* This routine is called repeatedly to fade in the window */



More information about the vlc-commits mailing list