Commit c500901b authored by David Fuhrmann's avatar David Fuhrmann

macosx: remove VLCMainWindow singleton

parent 1fb3dfd8
......@@ -241,7 +241,7 @@ static void addonsEventsCallback( const vlc_event_t *event, void *data )
{
[self _refactorDataModel];
if (_shouldRefreshSideBarOnAddonChange) {
[[VLCMainWindow sharedInstance] performSelector:@selector(reloadSidebar) withObject:nil afterDelay:0.5];
[[[VLCMain sharedInstance] mainWindow] performSelector:@selector(reloadSidebar) withObject:nil afterDelay:0.5];
_shouldRefreshSideBarOnAddonChange = NO;
}
}
......
......@@ -1308,12 +1308,12 @@
- (IBAction)showMainWindow:(id)sender
{
[[VLCMainWindow sharedInstance] makeKeyAndOrderFront:sender];
[[[VLCMain sharedInstance] mainWindow] makeKeyAndOrderFront:sender];
}
- (IBAction)showPlaylist:(id)sender
{
[[VLCMainWindow sharedInstance] changePlaylistState: psUserMenuEvent];
[[[VLCMain sharedInstance] mainWindow] changePlaylistState: psUserMenuEvent];
}
#pragma mark - Help and Docs
......
......@@ -83,7 +83,7 @@ typedef enum {
IBOutlet id o_podcast_unsubscribe_ok_btn;
IBOutlet id o_podcast_unsubscribe_cancel_btn;
}
+ (VLCMainWindow *)sharedInstance;
@property (readonly) BOOL nativeFullscreenMode;
@property (readwrite) BOOL nonembedded;
......
......@@ -80,29 +80,6 @@ static const float f_min_window_height = 307.;
#pragma mark -
#pragma mark Initialization
static VLCMainWindow *sharedInstance = nil;
+ (VLCMainWindow *)sharedInstance
{
return sharedInstance;
}
- (id)initWithContentRect:(NSRect)contentRect
styleMask:(NSUInteger)styleMask
backing:(NSBackingStoreType)backingType
defer:(BOOL)flag
{
static dispatch_once_t pred;
dispatch_once(&pred, ^{
sharedInstance = [super initWithContentRect:contentRect
styleMask:styleMask
backing:backingType
defer:flag];
});
return sharedInstance;
}
- (BOOL)isEvent:(NSEvent *)o_event forKey:(const char *)keyString
{
char *key;
......
......@@ -250,7 +250,7 @@ void WindowClose(vout_window_t *p_wnd)
// should be called before any window resizing occurs
if (!b_multiple_vout_windows)
[[VLCMainWindow sharedInstance] videoplayWillBeStarted];
[[[VLCMain sharedInstance] mainWindow] videoplayWillBeStarted];
if (b_multiple_vout_windows && b_video_wallpaper)
b_video_wallpaper = false;
......@@ -262,13 +262,13 @@ void WindowClose(vout_window_t *p_wnd)
msg_Dbg(VLCIntf, "Creating background / blank window");
NSScreen *screen = [NSScreen screenWithDisplayID:(CGDirectDisplayID)var_InheritInteger(VLCIntf, "macosx-vdev")];
if (!screen)
screen = [[VLCMainWindow sharedInstance] screen];
screen = [[[VLCMain sharedInstance] mainWindow] screen];
NSRect window_rect;
if (b_video_wallpaper)
window_rect = [screen frame];
else
window_rect = [[VLCMainWindow sharedInstance] frame];
window_rect = [[[VLCMain sharedInstance] mainWindow] frame];
NSUInteger mask = NSBorderlessWindowMask;
if (!b_video_deco)
......@@ -312,7 +312,7 @@ void WindowClose(vout_window_t *p_wnd)
} else {
if ((var_InheritBool(VLCIntf, "embedded-video") && !b_mainwindow_has_video)) {
// setup embedded video
o_new_video_window = [VLCMainWindow sharedInstance];
o_new_video_window = [[VLCMain sharedInstance] mainWindow] ;
o_vout_view = [o_new_video_window videoView];
b_mainwindow_has_video = YES;
b_nonembedded = NO;
......@@ -377,11 +377,11 @@ void WindowClose(vout_window_t *p_wnd)
[o_vout_dict setObject:o_new_video_window forKey:[NSValue valueWithPointer:p_wnd]];
[[VLCMain sharedInstance] setActiveVideoPlayback: YES];
[[VLCMainWindow sharedInstance] setNonembedded:!b_mainwindow_has_video];
[[[VLCMain sharedInstance] mainWindow] 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];
[[[VLCMain sharedInstance] mainWindow] changePlaylistState: psVideoStartedOrStoppedEvent];
if (b_nonembedded) {
// events might be posted before window is created, so call them again
......@@ -425,7 +425,7 @@ void WindowClose(vout_window_t *p_wnd)
// prevent visible extra window if in fullscreen
NSDisableScreenUpdates();
BOOL b_native = [[VLCMainWindow sharedInstance] nativeFullscreenMode];
BOOL b_native = [[[VLCMain sharedInstance] mainWindow] nativeFullscreenMode];
// close fullscreen, without changing fullscreen vars
if (!b_native && ([o_window fullscreen] || [o_window inFullscreenTransition]))
......@@ -453,10 +453,10 @@ void WindowClose(vout_window_t *p_wnd)
// video in main window might get stopped while another vout is open
if ([o_vout_dict count] > 0)
[[VLCMainWindow sharedInstance] setNonembedded:YES];
[[[VLCMain sharedInstance] mainWindow] setNonembedded:YES];
// beware of order, setActiveVideoPlayback:, setHasActiveVideo: and setNonembedded: must be called before
[[VLCMainWindow sharedInstance] changePlaylistState: psVideoStartedOrStoppedEvent];
[[[VLCMain sharedInstance] mainWindow] changePlaylistState: psVideoStartedOrStoppedEvent];
}
}
......@@ -521,7 +521,7 @@ void WindowClose(vout_window_t *p_wnd)
if (b_nativeFullscreenMode) {
if(!o_current_window)
o_current_window = [VLCMainWindow sharedInstance];
o_current_window = [[VLCMain sharedInstance] mainWindow] ;
assert(o_current_window);
// fullscreen might be triggered twice (vout event)
......@@ -588,7 +588,7 @@ void WindowClose(vout_window_t *p_wnd)
NSInteger currentStatusWindowLevel = self.currentStatusWindowLevel;
VLCMain *main = [VLCMain sharedInstance];
[[VLCMainWindow sharedInstance] setWindowLevel:i_level];
[[[VLCMain sharedInstance] mainWindow] setWindowLevel:i_level];
[[main videoEffectsPanel] updateCocoaWindowLevel:currentStatusWindowLevel];
[[main audioEffectsPanel] updateCocoaWindowLevel:currentStatusWindowLevel];
[[VLCInfo sharedInstance] updateCocoaWindowLevel:currentStatusWindowLevel];
......
......@@ -155,7 +155,7 @@
- (BOOL)performKeyEquivalent:(NSEvent *)o_event
{
return [[VLCMainWindow sharedInstance] performKeyEquivalent: o_event];
return [[[VLCMain sharedInstance] mainWindow] performKeyEquivalent: o_event];
}
- (void)mouseDown:(NSEvent *)o_event
......
......@@ -669,16 +669,16 @@
// change fspanel state for the case when multiple windows are in fullscreen
if ([self hasActiveVideo] && [self fullscreen])
[[[VLCMainWindow sharedInstance] fspanel] setActive:nil];
[[[[VLCMain sharedInstance] mainWindow] fspanel] setActive:nil];
else
[[[VLCMainWindow sharedInstance] fspanel] setNonActive:nil];
[[[[VLCMain sharedInstance] mainWindow] fspanel] setNonActive:nil];
}
- (void)resignKeyWindow
{
[super resignKeyWindow];
[[[VLCMainWindow sharedInstance] fspanel] setNonActive:nil];
[[[[VLCMain sharedInstance] mainWindow] fspanel] setNonActive:nil];
}
-(NSArray*)customWindowsToEnterFullScreenForWindow:(NSWindow *)window
......@@ -748,7 +748,7 @@
}
if ([self hasActiveVideo])
[[VLCMainWindow sharedInstance] recreateHideMouseTimer];
[[[VLCMain sharedInstance] mainWindow] recreateHideMouseTimer];
if (_darkInterface) {
[self.titlebarView removeFromSuperviewWithoutNeedingDisplay];
......@@ -779,9 +779,9 @@
_inFullscreenTransition = NO;
if ([self hasActiveVideo]) {
[[[VLCMainWindow sharedInstance] fspanel] setVoutWasUpdated: self];
[[[[VLCMain sharedInstance] mainWindow] fspanel] setVoutWasUpdated: self];
if (![_videoView isHidden])
[[[VLCMainWindow sharedInstance] fspanel] setActive: nil];
[[[[VLCMain sharedInstance] mainWindow] fspanel] setActive: nil];
}
NSArray *subviews = [[self videoView] subviews];
......@@ -809,7 +809,7 @@
}
[NSCursor setHiddenUntilMouseMoves: NO];
[[[VLCMainWindow sharedInstance] fspanel] setNonActive: nil];
[[[[VLCMain sharedInstance] mainWindow] fspanel] setNonActive: nil];
if (_darkInterface) {
......@@ -875,9 +875,9 @@
if (self.controlsBar)
[self.controlsBar setFullscreenState:YES];
[[[VLCMainWindow sharedInstance] controlsBar] setFullscreenState:YES];
[[[[VLCMain sharedInstance] mainWindow] controlsBar] setFullscreenState:YES];
[[VLCMainWindow sharedInstance] recreateHideMouseTimer];
[[[VLCMain sharedInstance] mainWindow] recreateHideMouseTimer];
if (blackout_other_displays)
[screen blackoutOtherScreens];
......@@ -1012,8 +1012,8 @@
[o_fullscreen_window setAcceptsMouseMovedEvents: YES];
/* tell the fspanel to move itself to front next time it's triggered */
[[[VLCMainWindow sharedInstance] fspanel] setVoutWasUpdated: o_fullscreen_window];
[[[VLCMainWindow sharedInstance] fspanel] setActive: nil];
[[[[VLCMain sharedInstance] mainWindow] fspanel] setVoutWasUpdated: o_fullscreen_window];
[[[[VLCMain sharedInstance] mainWindow] fspanel] setActive: nil];
if ([self isVisible])
[self orderOut: self];
......@@ -1030,7 +1030,7 @@
if (self.controlsBar)
[self.controlsBar setFullscreenState:NO];
[[[VLCMainWindow sharedInstance] controlsBar] setFullscreenState:NO];
[[[[VLCMain sharedInstance] mainWindow] controlsBar] setFullscreenState:NO];
/* We always try to do so */
[NSScreen unblackoutScreens];
......@@ -1042,7 +1042,7 @@
return;
}
[[[VLCMainWindow sharedInstance] fspanel] setNonActive: nil];
[[[[VLCMain sharedInstance] mainWindow] fspanel] setNonActive: nil];
[[o_fullscreen_window screen] setNonFullscreenPresentationOptions];
if (o_fullscreen_anim1) {
......
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