BOOL b_podcastView_displayed;
- /* set to yes if we are fullscreen and all animations are over */
- BOOL b_fullscreen;
-
NSTimer *t_hide_mouse_timer;
VLCColorView * o_color_backdrop;
NSRect frameBeforePlayback;
}
+ (VLCMainWindow *)sharedInstance;
-@property (readwrite) BOOL fullscreen;
@property (readonly) BOOL nativeFullscreenMode;
@property (readwrite) BOOL nonembedded;
@implementation VLCMainWindow
-@synthesize fullscreen=b_fullscreen;
@synthesize nativeFullscreenMode=b_nativeFullscreenMode;
@synthesize nonembedded=b_nonembedded;
@synthesize fsPanel=o_fspanel;
- (void)showFullscreenController
{
- if (b_fullscreen && [[VLCMain sharedInstance] activeVideoPlayback])
- [o_fspanel fadeIn];
+
+ id currentWindow = [NSApp keyWindow];
+ if ([currentWindow respondsToSelector:@selector(hasActiveVideo)] && [currentWindow hasActiveVideo]) {
+ if ([currentWindow respondsToSelector:@selector(fullscreen)] && [currentWindow fullscreen]) {
+
+ if ([[VLCMain sharedInstance] activeVideoPlayback])
+ [o_fspanel fadeIn];
+ }
+
+ }
+
+
}
- (void)makeKeyAndOrderFront: (id)sender
return;
}
- if ([[VLCMainWindow sharedInstance] fullscreen] && ![[VLCMainWindow sharedInstance] nativeFullscreenMode])
+ if ([o_window fullscreen] && ![[VLCMainWindow sharedInstance] nativeFullscreenMode])
[o_window leaveFullscreen];
- if ([[VLCMainWindow sharedInstance] fullscreen] && [[VLCMainWindow sharedInstance] nativeFullscreenMode])
+ if (![NSStringFromClass([o_window class]) isEqualToString:@"VLCMainWindow"] &&
+ [o_window fullscreen] &&
+ [[VLCMainWindow sharedInstance] nativeFullscreenMode])
[o_window toggleFullScreen: self];
// This is the result of [NSEvent standardMagnificationThreshold].
// Unfortunately, this is a private API, currently.
CGFloat f_threshold = 0.3;
- BOOL b_fullscreen = [[VLCMainWindow sharedInstance] fullscreen];
+ BOOL b_fullscreen = [(VLCVideoWindowCommon *)[self window] fullscreen];
if ((f_cumulated_magnification > f_threshold && !b_fullscreen) || (f_cumulated_magnification < -f_threshold && b_fullscreen)) {
f_cumulated_magnification = 0.0;
BOOL b_canBecomeMainWindow;
BOOL b_isset_canBecomeMainWindow;
NSViewAnimation *o_current_animation;
+
+ BOOL b_has_active_video;
+
+ /*
+ * normal fullscreen: YES when all animations are over
+ * lion fullscreen: toggled when fs animation starts
+ * for fullscreen window: always YES
+ */
+ BOOL b_fullscreen;
}
@property (readwrite) BOOL canBecomeKeyWindow;
@property (readwrite) BOOL canBecomeMainWindow;
+@property (nonatomic, readwrite) BOOL hasActiveVideo;
+@property (nonatomic, readwrite) BOOL fullscreen;
+
/* animate mode is only supported in >=10.4 */
- (void)orderFront: (id)sender animate: (BOOL)animate;
NSRecursiveLock * o_animation_lock;
NSInteger i_originalLevel;
- BOOL b_has_active_video;
+ NSTimer *t_hide_mouse_timer;
}
@property (nonatomic, assign) VLCVoutView* videoView;
@property (readonly) VLCControlsBarCommon* controlsBar;
-@property (nonatomic, readwrite) BOOL hasActiveVideo;
- (void)setWindowLevel:(NSInteger)i_state;
*****************************************************************************/
@implementation VLCWindow
+
+@synthesize hasActiveVideo=b_has_active_video;
+@synthesize fullscreen=b_fullscreen;
+
- (id)initWithContentRect:(NSRect)contentRect styleMask:(NSUInteger)styleMask
backing:(NSBackingStoreType)backingType defer:(BOOL)flag
{
@synthesize videoView=o_video_view;
@synthesize controlsBar=o_controls_bar;
-@synthesize hasActiveVideo=b_has_active_video;
#pragma mark -
#pragma mark Init
- (void)resizeWindow
{
- if ([[VLCMainWindow sharedInstance] fullscreen])
+ if ([self fullscreen])
return;
NSRect window_rect = [self getWindowRectForProposedVideoViewSize:nativeVideoSize];
return proposedFrameSize;
// needed when entering lion fullscreen mode
- if ([[VLCMainWindow sharedInstance] fullscreen])
+ if ([self fullscreen])
return proposedFrameSize;
if ([[VLCCoreInteraction sharedInstance] aspectRatioIsLocked]) {
#pragma mark -
#pragma mark Lion native fullscreen handling
+
+- (void)becomeKeyWindow
+{
+ [super becomeKeyWindow];
+
+ // change fspanel state for the case when multiple windows are in fullscreen
+ if ([self hasActiveVideo] && [self fullscreen])
+ [[[VLCMainWindow sharedInstance] fsPanel] setActive:nil];
+ else
+ [[[VLCMainWindow sharedInstance] fsPanel] setNonActive:nil];
+}
+
- (void)windowWillEnterFullScreen:(NSNotification *)notification
{
// workaround, see #6668
[NSApp setPresentationOptions:(NSApplicationPresentationFullScreen | NSApplicationPresentationAutoHideDock | NSApplicationPresentationAutoHideMenuBar)];
+ [self setFullscreen: YES];
+
var_SetBool(pl_Get(VLCIntf), "fullscreen", true);
if ([self hasActiveVideo]) {
}
[o_video_view setFrame: [[self contentView] frame]];
- [[VLCMainWindow sharedInstance] setFullscreen: YES];
[[VLCMainWindow sharedInstance] recreateHideMouseTimer];
i_originalLevel = [self level];
- (void)windowWillExitFullScreen:(NSNotification *)notification
{
+ [self setFullscreen: NO];
+
var_SetBool(pl_Get(VLCIntf), "fullscreen", false);
if ([self hasActiveVideo]) {
[NSCursor setHiddenUntilMouseMoves: NO];
[[[VLCMainWindow sharedInstance] fsPanel] setNonActive: nil];
+
[[[VLCMain sharedInstance] voutController] updateWindowLevelForHelperWindows: i_originalLevel];
[self setLevel:i_originalLevel];
- [[VLCMainWindow sharedInstance] setFullscreen: NO];
-
if (b_dark_interface) {
NSRect winrect;
CGFloat f_titleBarHeight = [o_titlebar_view frame].size.height;
[o_fullscreen_window setBackgroundColor: [NSColor blackColor]];
[o_fullscreen_window setCanBecomeKeyWindow: YES];
[o_fullscreen_window setCanBecomeMainWindow: YES];
+ [o_fullscreen_window setHasActiveVideo: YES];
+ [o_fullscreen_window setFullscreen: YES];
if (![self isVisible] || [self alphaValue] == 0.0) {
/* We don't animate if we are not visible, instead we
}
/* We are in fullscreen (and no animation is running) */
- if ([[VLCMainWindow sharedInstance] fullscreen]) {
+ if ([self fullscreen]) {
/* Make sure we are hidden */
[self orderOut: self];
if ([self isVisible])
[self orderOut: self];
- [[VLCMainWindow sharedInstance] setFullscreen:YES];
+ [self setFullscreen:YES];
[self unlockFullscreenAnimation];
}
- (void)hasEndedFullscreen
{
- [[VLCMainWindow sharedInstance] setFullscreen:NO];
+ [self setFullscreen:NO];
/* This function is private and should be only triggered at the end of the fullscreen change animation */
/* Make sure we don't see the o_video_view disappearing of the screen during this operation */
{
b_nonActive = NO;
- id currentWindow = [NSApp keyWindow];
- if ([currentWindow respondsToSelector:@selector(hasActiveVideo)]) {
- if ([currentWindow hasActiveVideo]) {
- [[VLCMain sharedInstance] showFullscreenController];
- }
- }
+ [[VLCMain sharedInstance] showFullscreenController];
}
/* This routine is called repeatedly to fade in the window */
var_SetBool(p_playlist, "fullscreen", b_fullscreen);
if (b_nativeFullscreenMode) {
- // this is called twice in certain situations, so only toogle if we really need to
- if ((b_fullscreen && !([NSApp currentSystemPresentationOptions] & NSApplicationPresentationFullScreen)) ||
- (!b_fullscreen && ([NSApp currentSystemPresentationOptions] & NSApplicationPresentationFullScreen))) {
- if(p_wnd) {
- VLCVideoWindowCommon *window = [o_vout_controller getWindow: p_wnd];
- [window toggleFullScreen:self];
- } else
- [o_mainwindow toggleFullScreen: self]; // TODO
+ VLCVideoWindowCommon *o_active_window = nil;
+ if(p_wnd)
+ o_active_window = [o_vout_controller getWindow: p_wnd];
+ else
+ o_active_window = o_mainwindow;
+
+ // fullscreen might be triggered twice (vout event)
+ // so ignore duplicate events here
+ if((b_fullscreen && ![o_active_window fullscreen]) ||
+ (!b_fullscreen && [o_active_window fullscreen])) {
+
+ [o_active_window toggleFullScreen:self];
}
if (b_fullscreen)