Commit c655f7ab authored by Pierre d'Herbemont's avatar Pierre d'Herbemont

Backport [19128]. (Close the embedded window only when playlist stops on Mac OS X).

parent c774cbda
......@@ -59,6 +59,8 @@
- (void)setSeekable:(BOOL)b_seekable;
- (void)setFullscreen:(BOOL)b_fullscreen;
- (NSView *)mainView;
- (BOOL)isFullscreen;
- (void)lockFullscreenAnimation;
......
......@@ -141,6 +141,14 @@
return YES;
}
- (NSView *)mainView
{
if (o_fullscreen_window)
return o_temp_view;
else
return o_view;
}
/*****************************************************************************
* Fullscreen support
*/
......
......@@ -43,6 +43,7 @@
#include "fspanel.h"
#include "vout.h"
#import "controls.h"
#include "embeddedwindow.h"
/*****************************************************************************
* DeviceCallback: Callback triggered when the video-device variable is changed
......@@ -238,6 +239,15 @@ int DeviceCallback( vlc_object_t *p_this, const char *psz_variable,
[o_view setFrameSize: [self frame].size];
}
- (void)drawRect:(NSRect)rect
{
/* When there is no subview we draw a black background */
[self lockFocus];
[[NSColor blackColor] set];
NSRectFill(rect);
[self unlockFocus];
}
- (void)closeVout
{
[o_view removeFromSuperview];
......@@ -314,6 +324,7 @@ int DeviceCallback( vlc_object_t *p_this, const char *psz_variable,
if ( !p_vout->b_fullscreen )
{
NSView *mainView;
NSRect new_frame;
topleftbase.x = 0;
topleftbase.y = [o_window frame].size.height;
......@@ -335,11 +346,18 @@ int DeviceCallback( vlc_object_t *p_this, const char *psz_variable,
newsize.height = (int) ( i_corrected_height * factor );
}
/* In fullscreen mode we need to use a view that is different from
* ourselves, with the VLCEmbeddedWindow */
if([o_window isKindOfClass:[VLCEmbeddedWindow class]])
mainView = [o_window mainView];
else
mainView = self;
/* Calculate the window's new size */
new_frame.size.width = [o_window frame].size.width -
[self frame].size.width + newsize.width;
[mainView frame].size.width + newsize.width;
new_frame.size.height = [o_window frame].size.height -
[self frame].size.height + newsize.height;
[mainView frame].size.height + newsize.height;
new_frame.origin.x = topleftscreen.x;
new_frame.origin.y = topleftscreen.y - new_frame.size.height;
......@@ -878,19 +896,42 @@ int DeviceCallback( vlc_object_t *p_this, const char *psz_variable,
{
BOOL b_return = [super setVout: p_arg_vout subView: view frame: s_arg_frame];
/* o_window needs to point to our o_embeddedwindow, super might have set it
* to the fullscreen window that o_embeddedwindow setups during fullscreen */
o_window = o_embeddedwindow;
if( b_return )
{
[o_window lockFullscreenAnimation];
[o_window setAlphaValue: var_GetFloat( p_vout, "macosx-opaqueness" )];
[self updateTitle];
[self scaleWindowWithFactor: 1.0 animate: NO];
[o_window makeKeyAndOrderFront: self];
/* Make the window the front and key window before animating */
if ([o_window isVisible] && (![o_window isFullscreen]))
[o_window makeKeyAndOrderFront: self];
[self scaleWindowWithFactor: 1.0 animate: [o_window isVisible] && (![o_window isFullscreen])];
/* Make sure our window is visible, if we are not in fullscreen */
if (![o_window isFullscreen])
[o_window makeKeyAndOrderFront: self];
[o_window unlockFullscreenAnimation];
}
return b_return;
}
- (void)closeVout
{
[o_window orderOut: self];
playlist_t * p_playlist = vlc_object_find( VLCIntf, VLC_OBJECT_PLAYLIST,
FIND_ANYWHERE );
if(!playlist_IsPlaying( p_playlist ))
[o_window performSelectorOnMainThread: @selector(orderOut:) withObject: self waitUntilDone: YES];
vlc_object_release( p_playlist );
[super closeVout];
}
......
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