Commit 58d4ebc3 authored by David Fuhrmann's avatar David Fuhrmann

macosx: improve handling of playlist view state in case of multiple vouts

close #10761
parent 3c946362
......@@ -783,8 +783,9 @@ static VLCMainWindow *_o_sharedInstance = nil;
// only resize back to minimum view of this is still desired final state
float f_threshold_height = f_min_video_height + [o_controls_bar height];
if(frameBeforePlayback.size.height > f_threshold_height || b_minimized_view)
if(frameBeforePlayback.size.height > f_threshold_height || b_minimized_view) {
[[self animator] setFrame:frameBeforePlayback display:YES];
}
}
frameBeforePlayback = NSMakeRect(0, 0, 0, 0);
......@@ -810,8 +811,6 @@ static VLCMainWindow *_o_sharedInstance = nil;
[o_fspanel setNonActive: nil];
}
}
[self changePlaylistState: psVideoStartedOrStoppedEvent];
}
#pragma mark -
......
......@@ -68,7 +68,8 @@
VLCVideoWindowCommon *o_new_video_window;
// should be called before any window resizing occurs
[[VLCMainWindow sharedInstance] videoplayWillBeStarted];
if (!b_multiple_vout_windows)
[[VLCMainWindow sharedInstance] videoplayWillBeStarted];
if (b_multiple_vout_windows && b_video_wallpaper)
b_video_wallpaper = false;
......@@ -126,7 +127,6 @@
[o_new_video_window setContentMinSize: NSMakeSize(f_min_video_height, f_min_video_height)];
}
[[VLCMainWindow sharedInstance] setNonembedded:YES];
b_nonembedded = YES;
} else {
if ((var_InheritBool(VLCIntf, "embedded-video") && !b_mainwindow_has_video)) {
......@@ -221,13 +221,18 @@
[o_new_video_window setAlphaValue: config_GetFloat(VLCIntf, "macosx-opaqueness")];
if (!b_multiple_vout_windows)
[[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]];
[[VLCMainWindow sharedInstance] setNonembedded:!b_mainwindow_has_video];
// beware of order, setActiveVideoPlayback:, setHasActiveVideo: and setNonembedded: must be called before
if ([o_new_video_window class] == [VLCMainWindow class])
[[VLCMainWindow sharedInstance] changePlaylistState: psVideoStartedOrStoppedEvent];
if (b_nonembedded) {
// event occurs before window is created, so call again
[[VLCMain sharedInstance] playlistUpdated];
......@@ -244,9 +249,6 @@
return;
}
if ([o_window class] == [VLCMainWindow class])
b_mainwindow_has_video = NO;
if ([o_window fullscreen] && ![[VLCMainWindow sharedInstance] nativeFullscreenMode])
[o_window leaveFullscreen];
......@@ -255,17 +257,31 @@
// set active video to no BEFORE closing the window to avoid stopping playback
// due to NSWindowWillCloseNotification
[o_window setHasActiveVideo: NO];
if ([o_window class] != [VLCMainWindow class]) {
[o_window close];
[o_window orderOut:self]; // for dark interface
}
[o_window retain];
[o_vout_dict removeObjectForKey:o_key];
if ([o_vout_dict count] == 0) {
[[VLCMain sharedInstance] setActiveVideoPlayback:NO];
i_statusLevelWindowCounter = 0;
}
if ([o_window class] == [VLCMainWindow class]) {
b_mainwindow_has_video = NO;
// video in main window might get stopped while another vout is open
if ([o_vout_dict count] > 0)
[[VLCMainWindow sharedInstance] setNonembedded:YES];
// beware of order, setActiveVideoPlayback:, setHasActiveVideo: and setNonembedded: must be called before
[[VLCMainWindow sharedInstance] changePlaylistState: psVideoStartedOrStoppedEvent];
}
[o_window release];
}
......
......@@ -135,6 +135,8 @@ int WindowOpen(vout_window_t *p_wnd, const vout_window_cfg_t *cfg)
return VLC_EGENERIC;
}
[[VLCMain sharedInstance] setActiveVideoPlayback: YES];
SEL sel = @selector(setupVoutForWindow:withProposedVideoViewPosition:);
NSInvocation *inv = [NSInvocation invocationWithMethodSignature:[o_vout_controller methodSignatureForSelector:sel]];
[inv setTarget:o_vout_controller];
......@@ -148,19 +150,14 @@ int WindowOpen(vout_window_t *p_wnd, const vout_window_cfg_t *cfg)
VLCVoutView *videoView = nil;
[inv getReturnValue:&videoView];
if (!videoView) {
msg_Err(p_wnd, "got no video view from the interface");
[o_vout_provider_lock unlock];
[o_pool release];
return VLC_EGENERIC;
}
// this method is not supposed to fail
assert(videoView != nil);
msg_Dbg(VLCIntf, "returning videoview with proposed position x=%i, y=%i, width=%i, height=%i", cfg->x, cfg->y, cfg->width, cfg->height);
p_wnd->handle.nsobject = videoView;
[o_vout_provider_lock unlock];
[[VLCMain sharedInstance] setActiveVideoPlayback: YES];
p_wnd->control = WindowControl;
[o_pool release];
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment