macosx: Rename VLCVoutWindowController to VLCVideoOutputProvider
authorDavid Fuhrmann <dfuhrmann@videolan.org>
Sun, 10 Jun 2018 08:57:03 +0000 (10:57 +0200)
committerDavid Fuhrmann <dfuhrmann@videolan.org>
Sun, 10 Jun 2018 09:00:11 +0000 (11:00 +0200)
This better matches the naming scheme, as WindowController is typically
used to have one designated window which is controlled.

19 files changed:
extras/package/macosx/VLC.xcodeproj/project.pbxproj
modules/gui/macosx/Makefile.am
modules/gui/macosx/VLCAudioEffectsWindowController.m
modules/gui/macosx/VLCBookmarksWindowController.m
modules/gui/macosx/VLCCoreInteraction.m
modules/gui/macosx/VLCMain.h
modules/gui/macosx/VLCMain.m
modules/gui/macosx/VLCMainMenu.m
modules/gui/macosx/VLCMainWindow.m
modules/gui/macosx/VLCPlaylistInfo.m
modules/gui/macosx/VLCResumeDialogController.m
modules/gui/macosx/VLCTrackSynchronizationWindowController.m
modules/gui/macosx/VLCVideoEffectsWindowController.m
modules/gui/macosx/VLCVideoOutputProvider.h [new file with mode: 0644]
modules/gui/macosx/VLCVideoOutputProvider.m [new file with mode: 0644]
modules/gui/macosx/VLCVoutWindowController.h [deleted file]
modules/gui/macosx/VLCVoutWindowController.m [deleted file]
modules/gui/macosx/Windows.m
po/POTFILES.in

index c5738cf..fe0ee17 100644 (file)
@@ -63,6 +63,7 @@
                1C31140D1E508C8800D4DD76 /* SPMediaKeyTap.m in Sources */ = {isa = PBXBuildFile; fileRef = CCF0777C13659A8000AF19FD /* SPMediaKeyTap.m */; };
                1C5716AC1F5B142200678627 /* coreaudio_common.c in Sources */ = {isa = PBXBuildFile; fileRef = 1C5716AB1F5B142200678627 /* coreaudio_common.c */; };
                1C69FDF61EAB30C7007724ED /* Windows.m in Sources */ = {isa = PBXBuildFile; fileRef = E06CF7F516020F6200C698B7 /* Windows.m */; };
+               1CAC3EE820CD1B3B00613DB2 /* VLCVideoOutputProvider.m in Sources */ = {isa = PBXBuildFile; fileRef = 1CAC3EE620CD1B3B00613DB2 /* VLCVideoOutputProvider.m */; };
                1CCC88EC2078A3D500E5626F /* MainMenu.xib in Sources */ = {isa = PBXBuildFile; fileRef = 6B8224091E4D2A9000833BE1 /* MainMenu.xib */; };
                1CCC88ED2078A3D500E5626F /* MainWindow.xib in Sources */ = {isa = PBXBuildFile; fileRef = 6B82240A1E4D2A9000833BE1 /* MainWindow.xib */; };
                1CCC88EE2078A3D500E5626F /* VLCStatusBarIconMainMenu.xib in Sources */ = {isa = PBXBuildFile; fileRef = 6B82241A1E4D2A9000833BE1 /* VLCStatusBarIconMainMenu.xib */; };
                6B7F1FDF1F07DA920002BDD8 /* VLCHexNumberFormatter.m in Sources */ = {isa = PBXBuildFile; fileRef = 6B7F1FDE1F07DA920002BDD8 /* VLCHexNumberFormatter.m */; };
                6B8166291EBFC34300C26F1B /* VLCDefaultValueSlider.m in Sources */ = {isa = PBXBuildFile; fileRef = 6B6A499B1DFD9B23009128AC /* VLCDefaultValueSlider.m */; };
                6B81662A1EBFC34300C26F1B /* VLCDefaultValueSliderCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 6B6A499D1DFD9B23009128AC /* VLCDefaultValueSliderCell.m */; };
-               6B81662B1EBFC35D00C26F1B /* VLCVoutWindowController.m in Sources */ = {isa = PBXBuildFile; fileRef = E0C2583F161B593D00185AAD /* VLCVoutWindowController.m */; };
                6B81662C1EBFC38100C26F1B /* VLCUIWidgets.m in Sources */ = {isa = PBXBuildFile; fileRef = 5CCED71514C0D4A90057F8D1 /* VLCUIWidgets.m */; };
                6BBB05DA1EEFEA29003A1019 /* VLCHUDOutlineView.m in Sources */ = {isa = PBXBuildFile; fileRef = 6BBB05D91EEFEA29003A1019 /* VLCHUDOutlineView.m */; };
                6BBB05E01EEFF165003A1019 /* VLCHUDTableCornerView.m in Sources */ = {isa = PBXBuildFile; fileRef = 6BBB05DF1EEFF165003A1019 /* VLCHUDTableCornerView.m */; };
                1C67C8A71D58C0A40079E1C1 /* VLCAboutWindowController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = VLCAboutWindowController.m; sourceTree = "<group>"; };
                1C7CB91A1D787E7600388902 /* VLCPopupPanelController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = VLCPopupPanelController.h; sourceTree = "<group>"; };
                1C7CB91B1D787E7600388902 /* VLCPopupPanelController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = VLCPopupPanelController.m; sourceTree = "<group>"; };
+               1CAC3EE620CD1B3B00613DB2 /* VLCVideoOutputProvider.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = VLCVideoOutputProvider.m; sourceTree = "<group>"; };
+               1CAC3EE720CD1B3B00613DB2 /* VLCVideoOutputProvider.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = VLCVideoOutputProvider.h; sourceTree = "<group>"; };
                1CAEBBFF1E1EC0A400A99E49 /* VLCFSPanelDraggableView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = VLCFSPanelDraggableView.h; sourceTree = "<group>"; };
                1CAEBC001E1EC0A400A99E49 /* VLCFSPanelDraggableView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = VLCFSPanelDraggableView.m; sourceTree = "<group>"; };
                1CC25CA71B2C585D0003F994 /* darwinvlc.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = darwinvlc.m; path = ../../../bin/darwinvlc.m; sourceTree = "<group>"; };
                E0382C01160BA09E0031D7FF /* VLCControlsBarCommon.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = VLCControlsBarCommon.m; sourceTree = "<group>"; };
                E06CF7F416020F6200C698B7 /* Windows.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Windows.h; sourceTree = "<group>"; };
                E06CF7F516020F6200C698B7 /* Windows.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = Windows.m; sourceTree = "<group>"; };
-               E0C2583E161B593D00185AAD /* VLCVoutWindowController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = VLCVoutWindowController.h; sourceTree = "<group>"; };
-               E0C2583F161B593D00185AAD /* VLCVoutWindowController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = VLCVoutWindowController.m; sourceTree = "<group>"; };
 /* End PBXFileReference section */
 
 /* Begin PBXFrameworksBuildPhase section */
                        children = (
                                CCCCDCA01413E1C000FE3DE1 /* VLCVoutView.h */,
                                CCCCDCA11413E1C000FE3DE1 /* VLCVoutView.m */,
-                               E0C2583E161B593D00185AAD /* VLCVoutWindowController.h */,
-                               E0C2583F161B593D00185AAD /* VLCVoutWindowController.m */,
+                               1CAC3EE720CD1B3B00613DB2 /* VLCVideoOutputProvider.h */,
+                               1CAC3EE620CD1B3B00613DB2 /* VLCVideoOutputProvider.m */,
                        );
                        name = "Video Output";
                        sourceTree = "<group>";
                                1CCC89062078A3D500E5626F /* TimeSelectionPanel.xib in Sources */,
                                6B81662C1EBFC38100C26F1B /* VLCUIWidgets.m in Sources */,
                                6B0AB0F11F1AC8B3003A1B4E /* VLCSliderCell.m in Sources */,
-                               6B81662B1EBFC35D00C26F1B /* VLCVoutWindowController.m in Sources */,
                                6B8166291EBFC34300C26F1B /* VLCDefaultValueSlider.m in Sources */,
                                6B81662A1EBFC34300C26F1B /* VLCDefaultValueSliderCell.m in Sources */,
                                1C69FDF61EAB30C7007724ED /* Windows.m in Sources */,
                                1C3113B41E508C6900D4DD76 /* VLCInputManager.m in Sources */,
                                1C3113B61E508C6900D4DD76 /* VLCMain+OldPrefs.m in Sources */,
                                1C3113B81E508C6900D4DD76 /* VLCMain.m in Sources */,
+                               1CAC3EE820CD1B3B00613DB2 /* VLCVideoOutputProvider.m in Sources */,
                                1C3113BA1E508C6900D4DD76 /* VLCApplication.m in Sources */,
                                1C3113BC1E508C6900D4DD76 /* VLCKeyboardBacklightControl.m in Sources */,
                                1C3113BD1E508C6900D4DD76 /* macosx.m in Sources */,
index bba7d44..ace16e1 100644 (file)
@@ -65,7 +65,7 @@ libmacosx_plugin_la_SOURCES = \
        gui/macosx/VLCUIWidgets.h gui/macosx/VLCUIWidgets.m \
        gui/macosx/VLCScrollingClipView.h gui/macosx/VLCScrollingClipView.m \
        gui/macosx/VLCStatusBarIcon.h gui/macosx/VLCStatusBarIcon.m \
-       gui/macosx/VLCVoutWindowController.h gui/macosx/VLCVoutWindowController.m \
+       gui/macosx/VLCVideoOutputProvider.h gui/macosx/VLCVideoOutputProvider.m \
        gui/macosx/Windows.h gui/macosx/Windows.m \
        gui/macosx/VLCAudioEffectsWindowController.h gui/macosx/VLCAudioEffectsWindowController.m \
        gui/macosx/VLCBookmarksWindowController.h gui/macosx/VLCBookmarksWindowController.m \
index a1ad903..139dde5 100644 (file)
     if ([self.window isKeyWindow])
         [self.window orderOut:sender];
     else {
-        [self.window setLevel: [[[VLCMain sharedInstance] voutController] currentStatusWindowLevel]];
+        [self.window setLevel: [[[VLCMain sharedInstance] voutProvider] currentStatusWindowLevel]];
         [self.window makeKeyAndOrderFront:sender];
     }
 }
index ff22298..7f74aae 100644 (file)
     if ([self.window isVisible])
         [self.window orderOut:sender];
     else {
-        [self.window setLevel: [[[VLCMain sharedInstance] voutController] currentStatusWindowLevel]];
+        [self.window setLevel: [[[VLCMain sharedInstance] voutProvider] currentStatusWindowLevel]];
         [self.window makeKeyAndOrderFront:sender];
     }
 }
index 28484dc..a524738 100644 (file)
@@ -694,7 +694,7 @@ static int BossCallback(vlc_object_t *p_this, const char *psz_var,
         vlc_object_release(p_vout);
     } else { // e.g. lion fullscreen toggle
         BOOL b_fs = var_ToggleBool(pl_Get(p_intf), "fullscreen");
-        [[[VLCMain sharedInstance] voutController] setFullscreen:b_fs forWindow:nil withAnimation:YES];
+        [[[VLCMain sharedInstance] voutProvider] setFullscreen:b_fs forWindow:nil withAnimation:YES];
     }
 }
 
index ffe2b4c..9ece125 100644 (file)
@@ -40,7 +40,7 @@
 #import <Cocoa/Cocoa.h>
 #import "misc.h"
 #import "VLCMainWindow.h"
-#import "VLCVoutWindowController.h"
+#import "VLCVideoOutputProvider.h"
 #import "VLCStatusBarIcon.h"
 #import "VLCStringUtility.h"
 
@@ -79,7 +79,7 @@ static NSString * VLCMediaKeySupportSettingChangedNotification = @"VLCMediaKeySu
 
 @interface VLCMain : NSObject <NSWindowDelegate, NSApplicationDelegate>
 
-@property (readonly) VLCVoutWindowController* voutController;
+@property (readonly) VLCVideoOutputProvider* voutProvider;
 @property (readonly) BOOL nativeFullscreenMode;
 @property (nonatomic, readwrite) BOOL playlistUpdatedSelectorInQueue;
 
index 443076f..80eb6ac 100644 (file)
@@ -231,7 +231,7 @@ static VLCMain *sharedInstance = nil;
         _mainmenu = [[VLCMainMenu alloc] init];
         _statusBarIcon = [[VLCStatusBarIcon  alloc] init];
 
-        _voutController = [[VLCVoutWindowController alloc] init];
+        _voutProvider = [[VLCVideoOutputProvider alloc] init];
         _playlist = [[VLCPlaylist alloc] init];
 
         _mainWindowController = [[NSWindowController alloc] initWithWindowNibName:@"MainWindow"];
@@ -350,7 +350,7 @@ static VLCMain *sharedInstance = nil;
     [[NSNotificationCenter defaultCenter] removeObserver: self];
 
     // closes all open vouts
-    _voutController = nil;
+    _voutProvider = nil;
 
     /* write cached user defaults to disk */
     [[NSUserDefaults standardUserDefaults] synchronize];
index cc1f088..de286d2 100644 (file)
     config_PutInt("macosx-show-playback-buttons", b_value);
 
     [(VLCMainWindowControlsBar *)[[[VLCMain sharedInstance] mainWindow] controlsBar] toggleJumpButtons];
-    [[[VLCMain sharedInstance] voutController] updateWindowsUsingBlock:^(VLCVideoWindowCommon *window) {
+    [[[VLCMain sharedInstance] voutProvider] updateWindowsUsingBlock:^(VLCVideoWindowCommon *window) {
         [[window controlsBar] toggleForwardBackwardMode: b_value];
     }];
 
 
 - (IBAction)showPreferences:(id)sender
 {
-    NSInteger i_level = [[[VLCMain sharedInstance] voutController] currentStatusWindowLevel];
+    NSInteger i_level = [[[VLCMain sharedInstance] voutProvider] currentStatusWindowLevel];
     [[[VLCMain sharedInstance] simplePreferences] showSimplePrefsWithLevel:i_level];
 }
 
index 1cc9bcb..32f330c 100644 (file)
@@ -47,7 +47,7 @@
 
 #import "VLCMainWindowControlsBar.h"
 #import "VLCVoutView.h"
-#import "VLCVoutWindowController.h"
+#import "VLCVideoOutputProvider.h"
 
 
 @interface VLCMainWindow() <PXSourceListDataSource, PXSourceListDelegate, NSOutlineViewDataSource, NSOutlineViewDelegate, NSWindowDelegate, NSAnimationDelegate, NSSplitViewDelegate>
@@ -572,7 +572,7 @@ static const float f_min_window_height = 307.;
     [self.controlsBar updateTimeSlider];
     [self.fspanel updatePositionAndTime];
 
-    [[[VLCMain sharedInstance] voutController] updateControlsBarsUsingBlock:^(VLCControlsBarCommon *controlsBar) {
+    [[[VLCMain sharedInstance] voutProvider] updateControlsBarsUsingBlock:^(VLCControlsBarCommon *controlsBar) {
         [controlsBar updateTimeSlider];
     }];
 
@@ -602,12 +602,12 @@ static const float f_min_window_height = 307.;
         NSURL * o_url = [NSURL URLWithString:toNSStr(uri)];
         if ([o_url isFileURL]) {
             [self setRepresentedURL: o_url];
-            [[[VLCMain sharedInstance] voutController] updateWindowsUsingBlock:^(VLCVideoWindowCommon *o_window) {
+            [[[VLCMain sharedInstance] voutProvider] updateWindowsUsingBlock:^(VLCVideoWindowCommon *o_window) {
                 [o_window setRepresentedURL:o_url];
             }];
         } else {
             [self setRepresentedURL: nil];
-            [[[VLCMain sharedInstance] voutController] updateWindowsUsingBlock:^(VLCVideoWindowCommon *o_window) {
+            [[[VLCMain sharedInstance] voutProvider] updateWindowsUsingBlock:^(VLCVideoWindowCommon *o_window) {
                 [o_window setRepresentedURL:nil];
             }];
         }
@@ -622,7 +622,7 @@ static const float f_min_window_height = 307.;
 
         if ([aString length] > 0) {
             [self setTitle: aString];
-            [[[VLCMain sharedInstance] voutController] updateWindowsUsingBlock:^(VLCVideoWindowCommon *o_window) {
+            [[[VLCMain sharedInstance] voutProvider] updateWindowsUsingBlock:^(VLCVideoWindowCommon *o_window) {
                 [o_window setTitle:aString];
             }];
 
@@ -642,7 +642,7 @@ static const float f_min_window_height = 307.;
 - (void)updateWindow
 {
     [self.controlsBar updateControls];
-    [[[VLCMain sharedInstance] voutController] updateControlsBarsUsingBlock:^(VLCControlsBarCommon *controlsBar) {
+    [[[VLCMain sharedInstance] voutProvider] updateControlsBarsUsingBlock:^(VLCControlsBarCommon *controlsBar) {
         [controlsBar updateControls];
     }];
 
@@ -678,7 +678,7 @@ static const float f_min_window_height = 307.;
     [self.controlsBar setPause];
     [self.fspanel setPause];
 
-    [[[VLCMain sharedInstance] voutController] updateControlsBarsUsingBlock:^(VLCControlsBarCommon *controlsBar) {
+    [[[VLCMain sharedInstance] voutProvider] updateControlsBarsUsingBlock:^(VLCControlsBarCommon *controlsBar) {
         [controlsBar setPause];
     }];
 }
@@ -688,7 +688,7 @@ static const float f_min_window_height = 307.;
     [self.controlsBar setPlay];
     [self.fspanel setPlay];
 
-    [[[VLCMain sharedInstance] voutController] updateControlsBarsUsingBlock:^(VLCControlsBarCommon *controlsBar) {
+    [[[VLCMain sharedInstance] voutProvider] updateControlsBarsUsingBlock:^(VLCControlsBarCommon *controlsBar) {
         [controlsBar setPlay];
     }];
 }
@@ -735,7 +735,7 @@ static const float f_min_window_height = 307.;
         }
 
         [self makeFirstResponder: _playlistScrollView];
-        [[[VLCMain sharedInstance] voutController] updateWindowLevelForHelperWindows: NSNormalWindowLevel];
+        [[[VLCMain sharedInstance] voutProvider] updateWindowLevelForHelperWindows: NSNormalWindowLevel];
 
         // restore alpha value to 1 for the case that macosx-opaqueness is set to < 1
         [self setAlphaValue:1.0];
index 6467907..04fc4f7 100644 (file)
     if ([self.window isKeyWindow])
         [self.window orderOut:sender];
     else {
-        [self.window setLevel: [[[VLCMain sharedInstance] voutController] currentStatusWindowLevel]];
+        [self.window setLevel: [[[VLCMain sharedInstance] voutProvider] currentStatusWindowLevel]];
         [self.window makeKeyAndOrderFront:sender];
     }
 }
index 23882df..be4208e 100644 (file)
@@ -76,7 +76,7 @@
                                                        userInfo:nil
                                                         repeats:YES];
 
-    [w setLevel:[[[VLCMain sharedInstance] voutController] currentStatusWindowLevel]];
+    [w setLevel:[[[VLCMain sharedInstance] voutProvider] currentStatusWindowLevel]];
     [w center];
 
     [w makeKeyAndOrderFront:nil];
index 8c2ceaa..bf822fd 100644 (file)
@@ -97,7 +97,7 @@
     if ([self.window isVisible])
         [self.window orderOut:sender];
     else {
-        [self.window setLevel: [[[VLCMain sharedInstance] voutController] currentStatusWindowLevel]];
+        [self.window setLevel: [[[VLCMain sharedInstance] voutProvider] currentStatusWindowLevel]];
         [self.window makeKeyAndOrderFront:sender];
 
         [self updateValues];
index c7f7a36..bb1df42 100644 (file)
     if ([self.window isKeyWindow])
         [self.window orderOut:sender];
     else {
-        [self.window setLevel: [[[VLCMain sharedInstance] voutController] currentStatusWindowLevel]];
+        [self.window setLevel: [[[VLCMain sharedInstance] voutProvider] currentStatusWindowLevel]];
         [self.window makeKeyAndOrderFront:sender];
     }
 }
diff --git a/modules/gui/macosx/VLCVideoOutputProvider.h b/modules/gui/macosx/VLCVideoOutputProvider.h
new file mode 100644 (file)
index 0000000..63fa57e
--- /dev/null
@@ -0,0 +1,51 @@
+/*****************************************************************************
+ * VLCVideoOutputProvider.h: MacOS X interface module
+ *****************************************************************************
+ * Copyright (C) 2012-2014 VLC authors and VideoLAN
+ * $Id$
+ *
+ * Authors: Felix Paul Kühne <fkuehne -at- videolan -dot- org>
+ *          David Fuhrmann <david dot fuhrmann at googlemail dot com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
+ *****************************************************************************/
+
+#import <Cocoa/Cocoa.h>
+
+#import <vlc_vout_window.h>
+#import "VLCKeyboardBacklightControl.h"
+
+@class VLCControlsBarCommon;
+@class VLCVideoWindowCommon;
+@class VLCVoutView;
+
+@interface VLCVideoOutputProvider : NSObject
+
+@property (readonly, nonatomic) NSInteger currentStatusWindowLevel;
+
+- (VLCVoutView *)setupVoutForWindow:(vout_window_t *)p_wnd withProposedVideoViewPosition:(NSRect)videoViewPosition;
+- (void)removeVoutForDisplay:(NSValue *)o_key;
+- (void)setNativeVideoSize:(NSSize)size forWindow:(vout_window_t *)p_wnd;
+- (void)setWindowLevel:(NSInteger)i_level forWindow:(vout_window_t *)p_wnd;
+- (void)setFullscreen:(int)i_full forWindow:(vout_window_t *)p_wnd withAnimation:(BOOL)b_animation;
+
+- (void)updateControlsBarsUsingBlock:(void (^)(VLCControlsBarCommon *controlsBar))block;
+- (void)updateWindowsUsingBlock:(void (^)(VLCVideoWindowCommon *o_window))windowUpdater;
+
+- (void)updateWindowLevelForHelperWindows:(NSInteger)i_level;
+
+- (void)hideMouseForWindow:(vout_window_t *)p_wnd;
+
+@end
diff --git a/modules/gui/macosx/VLCVideoOutputProvider.m b/modules/gui/macosx/VLCVideoOutputProvider.m
new file mode 100644 (file)
index 0000000..8597559
--- /dev/null
@@ -0,0 +1,595 @@
+/*****************************************************************************
+ * VLCVideoOutputProvider.m: MacOS X interface module
+ *****************************************************************************
+ * Copyright (C) 2012-2014 VLC authors and VideoLAN
+ * $Id$
+ *
+ * Authors: Felix Paul Kühne <fkuehne -at- videolan -dot- org>
+ *          David Fuhrmann <david dot fuhrmann at googlemail dot com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
+ *****************************************************************************/
+
+#include <vlc_vout_display.h>
+
+#import "CompatibilityFixes.h"
+#import "VLCVideoOutputProvider.h"
+#import "VLCMain.h"
+#import "VLCMainWindow.h"
+#import "VLCVoutView.h"
+
+#import "VLCVideoEffectsWindowController.h"
+#import "VLCAudioEffectsWindowController.h"
+#import "VLCPlaylistInfo.h"
+#import "VLCBookmarksWindowController.h"
+#import "VLCTrackSynchronizationWindowController.h"
+#import "VLCResumeDialogController.h"
+#import "VLCPlaylist.h"
+#import "NSScreen+VLCAdditions.h"
+
+static atomic_bool b_intf_starting = ATOMIC_VAR_INIT(false);
+
+static int WindowControl(vout_window_t *, int i_query, va_list);
+
+int WindowOpen(vout_window_t *p_wnd, const vout_window_cfg_t *cfg)
+{
+    @autoreleasepool {
+        msg_Dbg(p_wnd, "Opening video window");
+
+        if (!atomic_load(&b_intf_starting)) {
+            msg_Err(p_wnd, "Cannot create vout as Mac OS X interface was not found");
+            return VLC_EGENERIC;
+        }
+
+        NSRect proposedVideoViewPosition = NSMakeRect(cfg->x, cfg->y, cfg->width, cfg->height);
+
+        VLCVideoOutputProvider *voutProvider = [[VLCMain sharedInstance] voutProvider];
+        if (!voutProvider) {
+            return VLC_EGENERIC;
+        }
+
+        __block VLCVoutView *videoView = nil;
+
+        dispatch_sync(dispatch_get_main_queue(), ^{
+            videoView = [voutProvider setupVoutForWindow:p_wnd
+                             withProposedVideoViewPosition:proposedVideoViewPosition];
+        });
+
+        // this method is not supposed to fail
+        assert(videoView != nil);
+
+        msg_Dbg(getIntf(), "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 = (void *)CFBridgingRetain(videoView);
+
+        p_wnd->type = VOUT_WINDOW_TYPE_NSOBJECT;
+        p_wnd->control = WindowControl;
+    }
+    if (cfg->is_fullscreen)
+        vout_window_SetFullScreen(p_wnd, NULL);
+    return VLC_SUCCESS;
+}
+
+static int WindowControl(vout_window_t *p_wnd, int i_query, va_list args)
+{
+    @autoreleasepool {
+        VLCVideoOutputProvider *voutProvider = [[VLCMain sharedInstance] voutProvider];
+        if (!voutProvider) {
+            return VLC_EGENERIC;
+        }
+
+        switch(i_query) {
+            case VOUT_WINDOW_SET_STATE:
+            {
+                unsigned i_state = va_arg(args, unsigned);
+
+                if (i_state & VOUT_WINDOW_STATE_BELOW)
+                {
+                    msg_Dbg(p_wnd, "Ignore change to VOUT_WINDOW_STATE_BELOW");
+                    goto out;
+                }
+
+                NSInteger i_cooca_level = NSNormalWindowLevel;
+                if (i_state & VOUT_WINDOW_STATE_ABOVE)
+                    i_cooca_level = NSStatusWindowLevel;
+
+                dispatch_async(dispatch_get_main_queue(), ^{
+                    [voutProvider setWindowLevel:i_cooca_level forWindow:p_wnd];
+                });
+
+                break;
+            }
+            case VOUT_WINDOW_SET_SIZE:
+            {
+                unsigned int i_width  = va_arg(args, unsigned int);
+                unsigned int i_height = va_arg(args, unsigned int);
+
+                dispatch_async(dispatch_get_main_queue(), ^{
+                    [voutProvider setNativeVideoSize:NSMakeSize(i_width, i_height)
+                                             forWindow:p_wnd];
+                });
+
+                break;
+            }
+            case VOUT_WINDOW_SET_FULLSCREEN:
+            case VOUT_WINDOW_UNSET_FULLSCREEN:
+            {
+                if (var_InheritBool(getIntf(), "video-wallpaper")) {
+                    msg_Dbg(p_wnd, "Ignore fullscreen event as video-wallpaper is on");
+                    goto out;
+                }
+
+                int i_full = i_query == VOUT_WINDOW_SET_FULLSCREEN;
+                BOOL b_animation = YES;
+
+                dispatch_async(dispatch_get_main_queue(), ^{
+                    [voutProvider setFullscreen:i_full
+                                        forWindow:p_wnd
+                                    withAnimation:b_animation];
+                });
+
+                break;
+            }
+            case VOUT_WINDOW_HIDE_MOUSE:
+            {
+                [voutProvider hideMouseForWindow:p_wnd];
+                break;
+            }
+            default:
+            {
+                msg_Warn(p_wnd, "unsupported control query: %i", i_query );
+                return VLC_EGENERIC;
+            }
+        }
+
+        out:
+        return VLC_SUCCESS;
+    }
+}
+
+void WindowClose(vout_window_t *p_wnd)
+{
+    @autoreleasepool {
+        VLCVideoOutputProvider *voutProvider = [[VLCMain sharedInstance] voutProvider];
+        if (!voutProvider) {
+            return;
+        }
+
+        dispatch_async(dispatch_get_main_queue(), ^{
+            [voutProvider removeVoutForDisplay:[NSValue valueWithPointer:p_wnd]];
+        });
+    }
+}
+
+@interface VLCVideoOutputProvider ()
+{
+    NSMutableDictionary *voutWindows;
+    VLCKeyboardBacklightControl *keyboardBacklight;
+
+    NSPoint topLeftPoint;
+
+    // save the status level if at least one video window is on status level
+    NSUInteger statusLevelWindowCounter;
+    NSInteger currentWindowLevel;
+
+    BOOL mainWindowHasVideo;
+}
+@end
+
+@implementation VLCVideoOutputProvider
+
+- (id)init
+{
+    self = [super init];
+    if (self) {
+        atomic_store(&b_intf_starting, true);
+        voutWindows = [[NSMutableDictionary alloc] init];
+        keyboardBacklight = [[VLCKeyboardBacklightControl alloc] init];
+        currentWindowLevel = NSNormalWindowLevel;
+        _currentStatusWindowLevel = NSFloatingWindowLevel;
+    }
+    return self;
+}
+
+- (void)dealloc
+{
+    NSArray *keys = [voutWindows allKeys];
+    for (NSValue *key in keys)
+        [self removeVoutForDisplay:key];
+
+    if (var_InheritBool(getIntf(), "macosx-dim-keyboard")) {
+        [keyboardBacklight switchLightsInstantly:YES];
+    }
+}
+
+#pragma mark -
+#pragma mark Mouse hiding
+
+- (void)hideMouseForWindow:(vout_window_t *)p_wnd
+{
+    VLCVideoWindowCommon *o_current_window = nil;
+    if (p_wnd)
+        o_current_window = [voutWindows objectForKey:[NSValue valueWithPointer:p_wnd]];
+    
+    if (o_current_window == nil)
+        return;
+    
+    if (NSPointInRect([o_current_window mouseLocationOutsideOfEventStream],
+                      [[o_current_window videoView] convertRect:[[o_current_window videoView] bounds]
+                                                         toView:nil])) {
+        [NSCursor setHiddenUntilMouseMoves:YES];
+    }
+}
+
+#pragma mark -
+#pragma mark Methods for vout provider
+
+- (VLCVoutView *)setupVoutForWindow:(vout_window_t *)p_wnd withProposedVideoViewPosition:(NSRect)videoViewPosition
+{
+    BOOL isEmbedded = YES;
+    BOOL isNativeFullscreen = [[VLCMain sharedInstance] nativeFullscreenMode];
+    BOOL windowDecorations = var_InheritBool(getIntf(), "video-deco");
+    BOOL videoWallpaper = var_InheritBool(getIntf(), "video-wallpaper");
+    BOOL multipleVoutWindows = [voutWindows count] > 0;
+    VLCVoutView *voutView;
+    VLCVideoWindowCommon *newVideoWindow;
+
+    // should be called before any window resizing occurs
+    if (!multipleVoutWindows)
+        [[[VLCMain sharedInstance] mainWindow] videoplayWillBeStarted];
+
+    if (multipleVoutWindows && videoWallpaper)
+        videoWallpaper = false;
+
+    // TODO: make lion fullscreen compatible with video-wallpaper
+    if ((videoWallpaper || !windowDecorations) && !isNativeFullscreen) {
+        // videoWallpaper is priorized over !windowDecorations
+
+        msg_Dbg(getIntf(), "Creating background / blank window");
+        NSScreen *screen = [NSScreen screenWithDisplayID:(CGDirectDisplayID)var_InheritInteger(getIntf(), "macosx-vdev")];
+        if (!screen)
+            screen = [[[VLCMain sharedInstance] mainWindow] screen];
+
+        NSRect window_rect;
+        if (videoWallpaper)
+            window_rect = [screen frame];
+        else
+            window_rect = [[[VLCMain sharedInstance] mainWindow] frame];
+
+        NSUInteger mask = NSBorderlessWindowMask;
+        if (!windowDecorations)
+            mask |= NSResizableWindowMask;
+
+        newVideoWindow = [[VLCVideoWindowCommon alloc] initWithContentRect:window_rect styleMask:mask backing:NSBackingStoreBuffered defer:YES];
+        [newVideoWindow setDelegate:newVideoWindow];
+        [newVideoWindow setReleasedWhenClosed: NO];
+
+        if (videoWallpaper)
+            [newVideoWindow setLevel:CGWindowLevelForKey(kCGDesktopWindowLevelKey) + 1];
+
+        [newVideoWindow setBackgroundColor: [NSColor blackColor]];
+        [newVideoWindow setCanBecomeKeyWindow: !videoWallpaper];
+        [newVideoWindow setCanBecomeMainWindow: !videoWallpaper];
+        [newVideoWindow setAcceptsMouseMovedEvents: !videoWallpaper];
+        [newVideoWindow setMovableByWindowBackground: !videoWallpaper];
+
+        voutView = [[VLCVoutView alloc] initWithFrame:[[newVideoWindow contentView] bounds]];
+        [voutView setAutoresizingMask:NSViewWidthSizable | NSViewHeightSizable];
+        [[newVideoWindow contentView] addSubview:voutView positioned:NSWindowAbove relativeTo:nil];
+        [newVideoWindow setVideoView:voutView];
+
+
+        if (videoWallpaper)
+            [newVideoWindow orderBack:nil];
+        else {
+            // no frame autosave for additional vout windows
+            if (!multipleVoutWindows) {
+                // initial window position
+                [newVideoWindow center];
+                [newVideoWindow setFrameAutosaveName:@"extra-videowindow"];
+            }
+
+            [newVideoWindow setContentMinSize: NSMakeSize(f_min_video_height, f_min_video_height)];
+        }
+
+        isEmbedded = NO;
+    } else {
+        if ((var_InheritBool(getIntf(), "embedded-video") && !mainWindowHasVideo)) {
+            // setup embedded video
+            newVideoWindow = [[VLCMain sharedInstance] mainWindow] ;
+            voutView = [newVideoWindow videoView];
+            mainWindowHasVideo = YES;
+            isEmbedded = YES;
+        } else {
+            // setup detached window with controls
+            NSWindowController *o_controller = [[NSWindowController alloc] initWithWindowNibName:@"DetachedVideoWindow"];
+            [o_controller loadWindow];
+            newVideoWindow = (VLCDetachedVideoWindow *)[o_controller window];
+
+            // no frame autosave for additional vout windows
+            if (multipleVoutWindows)
+                [newVideoWindow setFrameAutosaveName:@""];
+
+            [newVideoWindow setDelegate: newVideoWindow];
+            [newVideoWindow setLevel:NSNormalWindowLevel];
+            voutView = [newVideoWindow videoView];
+            isEmbedded = NO;
+        }
+    }
+
+    NSSize videoViewSize = NSMakeSize(videoViewPosition.size.width, videoViewPosition.size.height);
+
+    // Avoid flashes if video will directly start in fullscreen
+    NSDisableScreenUpdates();
+
+    if (!videoWallpaper) {
+        // set (only!) window origin if specified
+        if (!isEmbedded) {
+            NSRect window_rect = [newVideoWindow frame];
+            if (videoViewPosition.origin.x > 0.)
+                window_rect.origin.x = videoViewPosition.origin.x;
+            if (videoViewPosition.origin.y > 0.)
+                window_rect.origin.y = videoViewPosition.origin.y;
+
+            [newVideoWindow setFrame:window_rect display:YES];
+        }
+
+        // cascade windows if we have more than one vout
+        if (multipleVoutWindows) {
+            if ([voutWindows count] == 1) {
+                NSWindow * firstWindow = [voutWindows objectForKey: [[voutWindows allKeys] firstObject]];
+
+                NSRect topleftBaseRect = NSMakeRect(0, [firstWindow frame].size.height, 0, 0);
+                topLeftPoint = [firstWindow convertRectToScreen: topleftBaseRect].origin;
+            }
+
+            topLeftPoint = [newVideoWindow cascadeTopLeftFromPoint: topLeftPoint];
+            [newVideoWindow setFrameTopLeftPoint: topLeftPoint];
+        }
+
+        // resize window
+        [newVideoWindow setNativeVideoSize:videoViewSize];
+
+        [newVideoWindow makeKeyAndOrderFront: self];
+    }
+
+    [newVideoWindow setAlphaValue: config_GetFloat("macosx-opaqueness")];
+
+    [voutView setVoutThread:(vout_thread_t *)p_wnd->obj.parent];
+    [newVideoWindow setHasActiveVideo: YES];
+    [voutWindows setObject:newVideoWindow forKey:[NSValue valueWithPointer:p_wnd]];
+
+    [[VLCMain sharedInstance] setActiveVideoPlayback: YES];
+    [[[VLCMain sharedInstance] mainWindow] setNonembedded:!mainWindowHasVideo];
+
+    // beware of order, setActiveVideoPlayback:, setHasActiveVideo: and setNonembedded: must be called before
+    if ([newVideoWindow class] == [VLCMainWindow class])
+        [[[VLCMain sharedInstance] mainWindow] changePlaylistState: psVideoStartedOrStoppedEvent];
+
+    if (!isEmbedded) {
+        // events might be posted before window is created, so call them again
+        [[[VLCMain sharedInstance] mainWindow] updateName];
+        [[[VLCMain sharedInstance] mainWindow] updateWindow]; // update controls bar
+    }
+
+    // TODO: find a cleaner way for "start in fullscreen"
+    // Start in fs, because either prefs settings, or fullscreen button was pressed before
+    char *psz_splitter = var_GetString(pl_Get(getIntf()), "video-splitter");
+    BOOL b_have_splitter = psz_splitter != NULL && *psz_splitter != '\0';
+    free(psz_splitter);
+
+    if (!videoWallpaper && !b_have_splitter && (var_InheritBool(getIntf(), "fullscreen") || var_GetBool(pl_Get(getIntf()), "fullscreen"))) {
+
+        // this is not set when we start in fullscreen because of
+        // fullscreen settings in video prefs the second time
+        var_SetBool(p_wnd->obj.parent, "fullscreen", 1);
+
+        [self setFullscreen:1 forWindow:p_wnd withAnimation:NO];
+    }
+
+    NSEnableScreenUpdates();
+
+    return voutView;
+}
+
+- (void)removeVoutForDisplay:(NSValue *)o_key
+{
+    VLCVideoWindowCommon *o_window = [voutWindows objectForKey:o_key];
+    if (!o_window) {
+        msg_Err(getIntf(), "Cannot close nonexisting window");
+        return;
+    }
+
+    [[o_window videoView] releaseVoutThread];
+
+    // set active video to no BEFORE closing the window and exiting fullscreen
+    // (avoid stopping playback due to NSWindowWillCloseNotification, preserving fullscreen state)
+    [o_window setHasActiveVideo: NO];
+
+    // prevent visible extra window if in fullscreen
+    NSDisableScreenUpdates();
+    BOOL b_native = [[[VLCMain sharedInstance] mainWindow] nativeFullscreenMode];
+
+    // close fullscreen, without changing fullscreen vars
+    if (!b_native && ([o_window fullscreen] || [o_window inFullscreenTransition]))
+        [o_window leaveFullscreenWithAnimation:NO];
+
+    // native fullscreen window will not be closed if
+    // fullscreen was triggered without video
+    if ((b_native && [o_window class] == [VLCMainWindow class] && [o_window fullscreen] && [o_window windowShouldExitFullscreenWhenFinished])) {
+        [o_window toggleFullScreen:self];
+    }
+
+    if ([o_window class] != [VLCMainWindow class]) {
+        [o_window close];
+    }
+    NSEnableScreenUpdates();
+
+    [voutWindows removeObjectForKey:o_key];
+    if ([voutWindows count] == 0) {
+        [[VLCMain sharedInstance] setActiveVideoPlayback:NO];
+        statusLevelWindowCounter = 0;
+    }
+
+    if ([o_window class] == [VLCMainWindow class]) {
+        mainWindowHasVideo = NO;
+
+        // video in main window might get stopped while another vout is open
+        if ([voutWindows count] > 0)
+            [[[VLCMain sharedInstance] mainWindow] setNonembedded:YES];
+
+        // beware of order, setActiveVideoPlayback:, setHasActiveVideo: and setNonembedded: must be called before
+        [[[VLCMain sharedInstance] mainWindow] changePlaylistState: psVideoStartedOrStoppedEvent];
+    }
+}
+
+
+- (void)setNativeVideoSize:(NSSize)size forWindow:(vout_window_t *)p_wnd
+{
+    VLCVideoWindowCommon *o_window = [voutWindows objectForKey:[NSValue valueWithPointer:p_wnd]];
+    if (!o_window) {
+        msg_Err(getIntf(), "Cannot set size for nonexisting window");
+        return;
+    }
+
+    [o_window setNativeVideoSize:size];
+}
+
+- (void)setWindowLevel:(NSInteger)i_level forWindow:(vout_window_t *)p_wnd
+{
+    VLCVideoWindowCommon *o_window = [voutWindows objectForKey:[NSValue valueWithPointer:p_wnd]];
+    if (!o_window) {
+        msg_Err(getIntf(), "Cannot set level for nonexisting window");
+        return;
+    }
+
+    // only set level for helper windows to normal if no status vout window exist anymore
+    if(i_level == NSStatusWindowLevel) {
+        statusLevelWindowCounter++;
+        // window level need to stay on normal in fullscreen mode
+        if (![o_window fullscreen] && ![o_window inFullscreenTransition])
+            [self updateWindowLevelForHelperWindows:i_level];
+    } else {
+        if (statusLevelWindowCounter > 0)
+            statusLevelWindowCounter--;
+
+        if (statusLevelWindowCounter == 0) {
+            [self updateWindowLevelForHelperWindows:i_level];
+        }
+    }
+
+    [o_window setWindowLevel:i_level];
+}
+
+- (void)setFullscreen:(int)i_full forWindow:(vout_window_t *)p_wnd withAnimation:(BOOL)b_animation
+{
+    intf_thread_t *p_intf = getIntf();
+    BOOL b_nativeFullscreenMode = [[VLCMain sharedInstance] nativeFullscreenMode];
+
+    if (!p_intf || (!b_nativeFullscreenMode && !p_wnd))
+        return;
+    playlist_t *p_playlist = pl_Get(p_intf);
+    BOOL b_fullscreen = i_full != 0;
+
+    if (!var_GetBool(p_playlist, "fullscreen") != !b_fullscreen)
+        var_SetBool(p_playlist, "fullscreen", b_fullscreen);
+
+    VLCVideoWindowCommon *o_current_window = nil;
+    if(p_wnd)
+        o_current_window = [voutWindows objectForKey:[NSValue valueWithPointer:p_wnd]];
+
+    if (var_InheritBool(p_intf, "macosx-dim-keyboard")) {
+        [keyboardBacklight switchLightsAsync:!b_fullscreen];
+    }
+
+    if (b_nativeFullscreenMode) {
+        if(!o_current_window)
+            o_current_window = [[VLCMain sharedInstance] mainWindow] ;
+        assert(o_current_window);
+
+        // fullscreen might be triggered twice (vout event)
+        // so ignore duplicate events here
+        if((b_fullscreen && !([o_current_window fullscreen] || [o_current_window inFullscreenTransition])) ||
+           (!b_fullscreen && [o_current_window fullscreen])) {
+
+            [o_current_window toggleFullScreen:self];
+        }
+    } else {
+        assert(o_current_window);
+
+        if (b_fullscreen) {
+            input_thread_t * p_input = pl_CurrentInput(p_intf);
+            if (p_input != NULL && [[VLCMain sharedInstance] activeVideoPlayback]) {
+                // activate app, as method can also be triggered from outside the app (prevents nasty window layout)
+                [NSApp activateIgnoringOtherApps:YES];
+                [o_current_window enterFullscreenWithAnimation:b_animation];
+
+            }
+            if (p_input)
+                vlc_object_release(p_input);
+        } else {
+            // leaving fullscreen is always allowed
+            [o_current_window leaveFullscreenWithAnimation:YES];
+        }
+    }
+}
+
+#pragma mark -
+#pragma mark Misc methods
+
+- (void)updateControlsBarsUsingBlock:(void (^)(VLCControlsBarCommon *controlsBar))block
+{
+    [voutWindows enumerateKeysAndObjectsUsingBlock:^(id key, id obj, BOOL *stop) {
+
+        if ([obj respondsToSelector:@selector(controlsBar)]) {
+            VLCControlsBarCommon *o_controlsBar = [obj controlsBar];
+            if (o_controlsBar && block)
+                block(o_controlsBar);
+        }
+    }];
+}
+
+- (void)updateWindowsUsingBlock:(void (^)(VLCVideoWindowCommon *o_window))windowUpdater
+{
+    [voutWindows enumerateKeysAndObjectsUsingBlock:^(id key, id obj, BOOL *stop) {
+        if ([obj isKindOfClass: [NSWindow class]])
+            windowUpdater(obj);
+    }];
+}
+
+- (void)updateWindowLevelForHelperWindows:(NSInteger)i_level
+{
+    if (var_InheritBool(getIntf(), "video-wallpaper"))
+        return;
+
+    currentWindowLevel = i_level;
+    if (i_level == NSNormalWindowLevel) {
+        _currentStatusWindowLevel = NSFloatingWindowLevel;
+    } else {
+        _currentStatusWindowLevel = i_level + 1;
+    }
+
+    NSInteger currentStatusWindowLevel = self.currentStatusWindowLevel;
+
+    VLCMain *main = [VLCMain sharedInstance];
+    [[[VLCMain sharedInstance] mainWindow] setWindowLevel:i_level];
+    [[main videoEffectsPanel] updateCocoaWindowLevel:currentStatusWindowLevel];
+    [[main audioEffectsPanel] updateCocoaWindowLevel:currentStatusWindowLevel];
+    [[main currentMediaInfoPanel] updateCocoaWindowLevel:currentStatusWindowLevel];
+    [[main bookmarks] updateCocoaWindowLevel:currentStatusWindowLevel];
+    [[main trackSyncPanel] updateCocoaWindowLevel:currentStatusWindowLevel];
+    [[main resumeDialog] updateCocoaWindowLevel:currentStatusWindowLevel];
+}
+
+@end
diff --git a/modules/gui/macosx/VLCVoutWindowController.h b/modules/gui/macosx/VLCVoutWindowController.h
deleted file mode 100644 (file)
index d144708..0000000
+++ /dev/null
@@ -1,51 +0,0 @@
-/*****************************************************************************
- * VLCVoutWindowController.h: MacOS X interface module
- *****************************************************************************
- * Copyright (C) 2012-2014 VLC authors and VideoLAN
- * $Id$
- *
- * Authors: Felix Paul Kühne <fkuehne -at- videolan -dot- org>
- *          David Fuhrmann <david dot fuhrmann at googlemail dot com>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
- *****************************************************************************/
-
-#import <Cocoa/Cocoa.h>
-
-#import <vlc_vout_window.h>
-#import "VLCKeyboardBacklightControl.h"
-
-@class VLCControlsBarCommon;
-@class VLCVideoWindowCommon;
-@class VLCVoutView;
-
-@interface VLCVoutWindowController : NSObject
-
-@property (readonly, nonatomic) NSInteger currentStatusWindowLevel;
-
-- (VLCVoutView *)setupVoutForWindow:(vout_window_t *)p_wnd withProposedVideoViewPosition:(NSRect)videoViewPosition;
-- (void)removeVoutForDisplay:(NSValue *)o_key;
-- (void)setNativeVideoSize:(NSSize)size forWindow:(vout_window_t *)p_wnd;
-- (void)setWindowLevel:(NSInteger)i_level forWindow:(vout_window_t *)p_wnd;
-- (void)setFullscreen:(int)i_full forWindow:(vout_window_t *)p_wnd withAnimation:(BOOL)b_animation;
-
-- (void)updateControlsBarsUsingBlock:(void (^)(VLCControlsBarCommon *controlsBar))block;
-- (void)updateWindowsUsingBlock:(void (^)(VLCVideoWindowCommon *o_window))windowUpdater;
-
-- (void)updateWindowLevelForHelperWindows:(NSInteger)i_level;
-
-- (void)hideMouseForWindow:(vout_window_t *)p_wnd;
-
-@end
diff --git a/modules/gui/macosx/VLCVoutWindowController.m b/modules/gui/macosx/VLCVoutWindowController.m
deleted file mode 100644 (file)
index 4c84c9a..0000000
+++ /dev/null
@@ -1,595 +0,0 @@
-/*****************************************************************************
- * VLCVoutWindowController.m: MacOS X interface module
- *****************************************************************************
- * Copyright (C) 2012-2014 VLC authors and VideoLAN
- * $Id$
- *
- * Authors: Felix Paul Kühne <fkuehne -at- videolan -dot- org>
- *          David Fuhrmann <david dot fuhrmann at googlemail dot com>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
- *****************************************************************************/
-
-#include <vlc_vout_display.h>
-
-#import "CompatibilityFixes.h"
-#import "VLCVoutWindowController.h"
-#import "VLCMain.h"
-#import "VLCMainWindow.h"
-#import "VLCVoutView.h"
-
-#import "VLCVideoEffectsWindowController.h"
-#import "VLCAudioEffectsWindowController.h"
-#import "VLCPlaylistInfo.h"
-#import "VLCBookmarksWindowController.h"
-#import "VLCTrackSynchronizationWindowController.h"
-#import "VLCResumeDialogController.h"
-#import "VLCPlaylist.h"
-#import "NSScreen+VLCAdditions.h"
-
-static atomic_bool b_intf_starting = ATOMIC_VAR_INIT(false);
-
-static int WindowControl(vout_window_t *, int i_query, va_list);
-
-int WindowOpen(vout_window_t *p_wnd, const vout_window_cfg_t *cfg)
-{
-    @autoreleasepool {
-        msg_Dbg(p_wnd, "Opening video window");
-
-        if (!atomic_load(&b_intf_starting)) {
-            msg_Err(p_wnd, "Cannot create vout as Mac OS X interface was not found");
-            return VLC_EGENERIC;
-        }
-
-        NSRect proposedVideoViewPosition = NSMakeRect(cfg->x, cfg->y, cfg->width, cfg->height);
-
-        VLCVoutWindowController *voutController = [[VLCMain sharedInstance] voutController];
-        if (!voutController) {
-            return VLC_EGENERIC;
-        }
-
-        __block VLCVoutView *videoView = nil;
-
-        dispatch_sync(dispatch_get_main_queue(), ^{
-            videoView = [voutController setupVoutForWindow:p_wnd
-                             withProposedVideoViewPosition:proposedVideoViewPosition];
-        });
-
-        // this method is not supposed to fail
-        assert(videoView != nil);
-
-        msg_Dbg(getIntf(), "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 = (void *)CFBridgingRetain(videoView);
-
-        p_wnd->type = VOUT_WINDOW_TYPE_NSOBJECT;
-        p_wnd->control = WindowControl;
-    }
-    if (cfg->is_fullscreen)
-        vout_window_SetFullScreen(p_wnd, NULL);
-    return VLC_SUCCESS;
-}
-
-static int WindowControl(vout_window_t *p_wnd, int i_query, va_list args)
-{
-    @autoreleasepool {
-        VLCVoutWindowController *voutController = [[VLCMain sharedInstance] voutController];
-        if (!voutController) {
-            return VLC_EGENERIC;
-        }
-
-        switch(i_query) {
-            case VOUT_WINDOW_SET_STATE:
-            {
-                unsigned i_state = va_arg(args, unsigned);
-
-                if (i_state & VOUT_WINDOW_STATE_BELOW)
-                {
-                    msg_Dbg(p_wnd, "Ignore change to VOUT_WINDOW_STATE_BELOW");
-                    goto out;
-                }
-
-                NSInteger i_cooca_level = NSNormalWindowLevel;
-                if (i_state & VOUT_WINDOW_STATE_ABOVE)
-                    i_cooca_level = NSStatusWindowLevel;
-
-                dispatch_async(dispatch_get_main_queue(), ^{
-                    [voutController setWindowLevel:i_cooca_level forWindow:p_wnd];
-                });
-
-                break;
-            }
-            case VOUT_WINDOW_SET_SIZE:
-            {
-                unsigned int i_width  = va_arg(args, unsigned int);
-                unsigned int i_height = va_arg(args, unsigned int);
-
-                dispatch_async(dispatch_get_main_queue(), ^{
-                    [voutController setNativeVideoSize:NSMakeSize(i_width, i_height)
-                                             forWindow:p_wnd];
-                });
-
-                break;
-            }
-            case VOUT_WINDOW_SET_FULLSCREEN:
-            case VOUT_WINDOW_UNSET_FULLSCREEN:
-            {
-                if (var_InheritBool(getIntf(), "video-wallpaper")) {
-                    msg_Dbg(p_wnd, "Ignore fullscreen event as video-wallpaper is on");
-                    goto out;
-                }
-
-                int i_full = i_query == VOUT_WINDOW_SET_FULLSCREEN;
-                BOOL b_animation = YES;
-
-                dispatch_async(dispatch_get_main_queue(), ^{
-                    [voutController setFullscreen:i_full
-                                        forWindow:p_wnd
-                                    withAnimation:b_animation];
-                });
-
-                break;
-            }
-            case VOUT_WINDOW_HIDE_MOUSE:
-            {
-                [voutController hideMouseForWindow:p_wnd];
-                break;
-            }
-            default:
-            {
-                msg_Warn(p_wnd, "unsupported control query: %i", i_query );
-                return VLC_EGENERIC;
-            }
-        }
-
-        out:
-        return VLC_SUCCESS;
-    }
-}
-
-void WindowClose(vout_window_t *p_wnd)
-{
-    @autoreleasepool {
-        VLCVoutWindowController *voutController = [[VLCMain sharedInstance] voutController];
-        if (!voutController) {
-            return;
-        }
-
-        dispatch_async(dispatch_get_main_queue(), ^{
-            [voutController removeVoutForDisplay:[NSValue valueWithPointer:p_wnd]];
-        });
-    }
-}
-
-@interface VLCVoutWindowController ()
-{
-    NSMutableDictionary *voutWindows;
-    VLCKeyboardBacklightControl *keyboardBacklight;
-
-    NSPoint topLeftPoint;
-
-    // save the status level if at least one video window is on status level
-    NSUInteger statusLevelWindowCounter;
-    NSInteger currentWindowLevel;
-
-    BOOL mainWindowHasVideo;
-}
-@end
-
-@implementation VLCVoutWindowController
-
-- (id)init
-{
-    self = [super init];
-    if (self) {
-        atomic_store(&b_intf_starting, true);
-        voutWindows = [[NSMutableDictionary alloc] init];
-        keyboardBacklight = [[VLCKeyboardBacklightControl alloc] init];
-        currentWindowLevel = NSNormalWindowLevel;
-        _currentStatusWindowLevel = NSFloatingWindowLevel;
-    }
-    return self;
-}
-
-- (void)dealloc
-{
-    NSArray *keys = [voutWindows allKeys];
-    for (NSValue *key in keys)
-        [self removeVoutForDisplay:key];
-
-    if (var_InheritBool(getIntf(), "macosx-dim-keyboard")) {
-        [keyboardBacklight switchLightsInstantly:YES];
-    }
-}
-
-#pragma mark -
-#pragma mark Mouse hiding
-
-- (void)hideMouseForWindow:(vout_window_t *)p_wnd
-{
-    VLCVideoWindowCommon *o_current_window = nil;
-    if (p_wnd)
-        o_current_window = [voutWindows objectForKey:[NSValue valueWithPointer:p_wnd]];
-    
-    if (o_current_window == nil)
-        return;
-    
-    if (NSPointInRect([o_current_window mouseLocationOutsideOfEventStream],
-                      [[o_current_window videoView] convertRect:[[o_current_window videoView] bounds]
-                                                         toView:nil])) {
-        [NSCursor setHiddenUntilMouseMoves:YES];
-    }
-}
-
-#pragma mark -
-#pragma mark Methods for vout provider
-
-- (VLCVoutView *)setupVoutForWindow:(vout_window_t *)p_wnd withProposedVideoViewPosition:(NSRect)videoViewPosition
-{
-    BOOL isEmbedded = YES;
-    BOOL isNativeFullscreen = [[VLCMain sharedInstance] nativeFullscreenMode];
-    BOOL windowDecorations = var_InheritBool(getIntf(), "video-deco");
-    BOOL videoWallpaper = var_InheritBool(getIntf(), "video-wallpaper");
-    BOOL multipleVoutWindows = [voutWindows count] > 0;
-    VLCVoutView *voutView;
-    VLCVideoWindowCommon *newVideoWindow;
-
-    // should be called before any window resizing occurs
-    if (!multipleVoutWindows)
-        [[[VLCMain sharedInstance] mainWindow] videoplayWillBeStarted];
-
-    if (multipleVoutWindows && videoWallpaper)
-        videoWallpaper = false;
-
-    // TODO: make lion fullscreen compatible with video-wallpaper
-    if ((videoWallpaper || !windowDecorations) && !isNativeFullscreen) {
-        // videoWallpaper is priorized over !windowDecorations
-
-        msg_Dbg(getIntf(), "Creating background / blank window");
-        NSScreen *screen = [NSScreen screenWithDisplayID:(CGDirectDisplayID)var_InheritInteger(getIntf(), "macosx-vdev")];
-        if (!screen)
-            screen = [[[VLCMain sharedInstance] mainWindow] screen];
-
-        NSRect window_rect;
-        if (videoWallpaper)
-            window_rect = [screen frame];
-        else
-            window_rect = [[[VLCMain sharedInstance] mainWindow] frame];
-
-        NSUInteger mask = NSBorderlessWindowMask;
-        if (!windowDecorations)
-            mask |= NSResizableWindowMask;
-
-        newVideoWindow = [[VLCVideoWindowCommon alloc] initWithContentRect:window_rect styleMask:mask backing:NSBackingStoreBuffered defer:YES];
-        [newVideoWindow setDelegate:newVideoWindow];
-        [newVideoWindow setReleasedWhenClosed: NO];
-
-        if (videoWallpaper)
-            [newVideoWindow setLevel:CGWindowLevelForKey(kCGDesktopWindowLevelKey) + 1];
-
-        [newVideoWindow setBackgroundColor: [NSColor blackColor]];
-        [newVideoWindow setCanBecomeKeyWindow: !videoWallpaper];
-        [newVideoWindow setCanBecomeMainWindow: !videoWallpaper];
-        [newVideoWindow setAcceptsMouseMovedEvents: !videoWallpaper];
-        [newVideoWindow setMovableByWindowBackground: !videoWallpaper];
-
-        voutView = [[VLCVoutView alloc] initWithFrame:[[newVideoWindow contentView] bounds]];
-        [voutView setAutoresizingMask:NSViewWidthSizable | NSViewHeightSizable];
-        [[newVideoWindow contentView] addSubview:voutView positioned:NSWindowAbove relativeTo:nil];
-        [newVideoWindow setVideoView:voutView];
-
-
-        if (videoWallpaper)
-            [newVideoWindow orderBack:nil];
-        else {
-            // no frame autosave for additional vout windows
-            if (!multipleVoutWindows) {
-                // initial window position
-                [newVideoWindow center];
-                [newVideoWindow setFrameAutosaveName:@"extra-videowindow"];
-            }
-
-            [newVideoWindow setContentMinSize: NSMakeSize(f_min_video_height, f_min_video_height)];
-        }
-
-        isEmbedded = NO;
-    } else {
-        if ((var_InheritBool(getIntf(), "embedded-video") && !mainWindowHasVideo)) {
-            // setup embedded video
-            newVideoWindow = [[VLCMain sharedInstance] mainWindow] ;
-            voutView = [newVideoWindow videoView];
-            mainWindowHasVideo = YES;
-            isEmbedded = YES;
-        } else {
-            // setup detached window with controls
-            NSWindowController *o_controller = [[NSWindowController alloc] initWithWindowNibName:@"DetachedVideoWindow"];
-            [o_controller loadWindow];
-            newVideoWindow = (VLCDetachedVideoWindow *)[o_controller window];
-
-            // no frame autosave for additional vout windows
-            if (multipleVoutWindows)
-                [newVideoWindow setFrameAutosaveName:@""];
-
-            [newVideoWindow setDelegate: newVideoWindow];
-            [newVideoWindow setLevel:NSNormalWindowLevel];
-            voutView = [newVideoWindow videoView];
-            isEmbedded = NO;
-        }
-    }
-
-    NSSize videoViewSize = NSMakeSize(videoViewPosition.size.width, videoViewPosition.size.height);
-
-    // Avoid flashes if video will directly start in fullscreen
-    NSDisableScreenUpdates();
-
-    if (!videoWallpaper) {
-        // set (only!) window origin if specified
-        if (!isEmbedded) {
-            NSRect window_rect = [newVideoWindow frame];
-            if (videoViewPosition.origin.x > 0.)
-                window_rect.origin.x = videoViewPosition.origin.x;
-            if (videoViewPosition.origin.y > 0.)
-                window_rect.origin.y = videoViewPosition.origin.y;
-
-            [newVideoWindow setFrame:window_rect display:YES];
-        }
-
-        // cascade windows if we have more than one vout
-        if (multipleVoutWindows) {
-            if ([voutWindows count] == 1) {
-                NSWindow * firstWindow = [voutWindows objectForKey: [[voutWindows allKeys] firstObject]];
-
-                NSRect topleftBaseRect = NSMakeRect(0, [firstWindow frame].size.height, 0, 0);
-                topLeftPoint = [firstWindow convertRectToScreen: topleftBaseRect].origin;
-            }
-
-            topLeftPoint = [newVideoWindow cascadeTopLeftFromPoint: topLeftPoint];
-            [newVideoWindow setFrameTopLeftPoint: topLeftPoint];
-        }
-
-        // resize window
-        [newVideoWindow setNativeVideoSize:videoViewSize];
-
-        [newVideoWindow makeKeyAndOrderFront: self];
-    }
-
-    [newVideoWindow setAlphaValue: config_GetFloat("macosx-opaqueness")];
-
-    [voutView setVoutThread:(vout_thread_t *)p_wnd->obj.parent];
-    [newVideoWindow setHasActiveVideo: YES];
-    [voutWindows setObject:newVideoWindow forKey:[NSValue valueWithPointer:p_wnd]];
-
-    [[VLCMain sharedInstance] setActiveVideoPlayback: YES];
-    [[[VLCMain sharedInstance] mainWindow] setNonembedded:!mainWindowHasVideo];
-
-    // beware of order, setActiveVideoPlayback:, setHasActiveVideo: and setNonembedded: must be called before
-    if ([newVideoWindow class] == [VLCMainWindow class])
-        [[[VLCMain sharedInstance] mainWindow] changePlaylistState: psVideoStartedOrStoppedEvent];
-
-    if (!isEmbedded) {
-        // events might be posted before window is created, so call them again
-        [[[VLCMain sharedInstance] mainWindow] updateName];
-        [[[VLCMain sharedInstance] mainWindow] updateWindow]; // update controls bar
-    }
-
-    // TODO: find a cleaner way for "start in fullscreen"
-    // Start in fs, because either prefs settings, or fullscreen button was pressed before
-    char *psz_splitter = var_GetString(pl_Get(getIntf()), "video-splitter");
-    BOOL b_have_splitter = psz_splitter != NULL && *psz_splitter != '\0';
-    free(psz_splitter);
-
-    if (!videoWallpaper && !b_have_splitter && (var_InheritBool(getIntf(), "fullscreen") || var_GetBool(pl_Get(getIntf()), "fullscreen"))) {
-
-        // this is not set when we start in fullscreen because of
-        // fullscreen settings in video prefs the second time
-        var_SetBool(p_wnd->obj.parent, "fullscreen", 1);
-
-        [self setFullscreen:1 forWindow:p_wnd withAnimation:NO];
-    }
-
-    NSEnableScreenUpdates();
-
-    return voutView;
-}
-
-- (void)removeVoutForDisplay:(NSValue *)o_key
-{
-    VLCVideoWindowCommon *o_window = [voutWindows objectForKey:o_key];
-    if (!o_window) {
-        msg_Err(getIntf(), "Cannot close nonexisting window");
-        return;
-    }
-
-    [[o_window videoView] releaseVoutThread];
-
-    // set active video to no BEFORE closing the window and exiting fullscreen
-    // (avoid stopping playback due to NSWindowWillCloseNotification, preserving fullscreen state)
-    [o_window setHasActiveVideo: NO];
-
-    // prevent visible extra window if in fullscreen
-    NSDisableScreenUpdates();
-    BOOL b_native = [[[VLCMain sharedInstance] mainWindow] nativeFullscreenMode];
-
-    // close fullscreen, without changing fullscreen vars
-    if (!b_native && ([o_window fullscreen] || [o_window inFullscreenTransition]))
-        [o_window leaveFullscreenWithAnimation:NO];
-
-    // native fullscreen window will not be closed if
-    // fullscreen was triggered without video
-    if ((b_native && [o_window class] == [VLCMainWindow class] && [o_window fullscreen] && [o_window windowShouldExitFullscreenWhenFinished])) {
-        [o_window toggleFullScreen:self];
-    }
-
-    if ([o_window class] != [VLCMainWindow class]) {
-        [o_window close];
-    }
-    NSEnableScreenUpdates();
-
-    [voutWindows removeObjectForKey:o_key];
-    if ([voutWindows count] == 0) {
-        [[VLCMain sharedInstance] setActiveVideoPlayback:NO];
-        statusLevelWindowCounter = 0;
-    }
-
-    if ([o_window class] == [VLCMainWindow class]) {
-        mainWindowHasVideo = NO;
-
-        // video in main window might get stopped while another vout is open
-        if ([voutWindows count] > 0)
-            [[[VLCMain sharedInstance] mainWindow] setNonembedded:YES];
-
-        // beware of order, setActiveVideoPlayback:, setHasActiveVideo: and setNonembedded: must be called before
-        [[[VLCMain sharedInstance] mainWindow] changePlaylistState: psVideoStartedOrStoppedEvent];
-    }
-}
-
-
-- (void)setNativeVideoSize:(NSSize)size forWindow:(vout_window_t *)p_wnd
-{
-    VLCVideoWindowCommon *o_window = [voutWindows objectForKey:[NSValue valueWithPointer:p_wnd]];
-    if (!o_window) {
-        msg_Err(getIntf(), "Cannot set size for nonexisting window");
-        return;
-    }
-
-    [o_window setNativeVideoSize:size];
-}
-
-- (void)setWindowLevel:(NSInteger)i_level forWindow:(vout_window_t *)p_wnd
-{
-    VLCVideoWindowCommon *o_window = [voutWindows objectForKey:[NSValue valueWithPointer:p_wnd]];
-    if (!o_window) {
-        msg_Err(getIntf(), "Cannot set level for nonexisting window");
-        return;
-    }
-
-    // only set level for helper windows to normal if no status vout window exist anymore
-    if(i_level == NSStatusWindowLevel) {
-        statusLevelWindowCounter++;
-        // window level need to stay on normal in fullscreen mode
-        if (![o_window fullscreen] && ![o_window inFullscreenTransition])
-            [self updateWindowLevelForHelperWindows:i_level];
-    } else {
-        if (statusLevelWindowCounter > 0)
-            statusLevelWindowCounter--;
-
-        if (statusLevelWindowCounter == 0) {
-            [self updateWindowLevelForHelperWindows:i_level];
-        }
-    }
-
-    [o_window setWindowLevel:i_level];
-}
-
-- (void)setFullscreen:(int)i_full forWindow:(vout_window_t *)p_wnd withAnimation:(BOOL)b_animation
-{
-    intf_thread_t *p_intf = getIntf();
-    BOOL b_nativeFullscreenMode = [[VLCMain sharedInstance] nativeFullscreenMode];
-
-    if (!p_intf || (!b_nativeFullscreenMode && !p_wnd))
-        return;
-    playlist_t *p_playlist = pl_Get(p_intf);
-    BOOL b_fullscreen = i_full != 0;
-
-    if (!var_GetBool(p_playlist, "fullscreen") != !b_fullscreen)
-        var_SetBool(p_playlist, "fullscreen", b_fullscreen);
-
-    VLCVideoWindowCommon *o_current_window = nil;
-    if(p_wnd)
-        o_current_window = [voutWindows objectForKey:[NSValue valueWithPointer:p_wnd]];
-
-    if (var_InheritBool(p_intf, "macosx-dim-keyboard")) {
-        [keyboardBacklight switchLightsAsync:!b_fullscreen];
-    }
-
-    if (b_nativeFullscreenMode) {
-        if(!o_current_window)
-            o_current_window = [[VLCMain sharedInstance] mainWindow] ;
-        assert(o_current_window);
-
-        // fullscreen might be triggered twice (vout event)
-        // so ignore duplicate events here
-        if((b_fullscreen && !([o_current_window fullscreen] || [o_current_window inFullscreenTransition])) ||
-           (!b_fullscreen && [o_current_window fullscreen])) {
-
-            [o_current_window toggleFullScreen:self];
-        }
-    } else {
-        assert(o_current_window);
-
-        if (b_fullscreen) {
-            input_thread_t * p_input = pl_CurrentInput(p_intf);
-            if (p_input != NULL && [[VLCMain sharedInstance] activeVideoPlayback]) {
-                // activate app, as method can also be triggered from outside the app (prevents nasty window layout)
-                [NSApp activateIgnoringOtherApps:YES];
-                [o_current_window enterFullscreenWithAnimation:b_animation];
-
-            }
-            if (p_input)
-                vlc_object_release(p_input);
-        } else {
-            // leaving fullscreen is always allowed
-            [o_current_window leaveFullscreenWithAnimation:YES];
-        }
-    }
-}
-
-#pragma mark -
-#pragma mark Misc methods
-
-- (void)updateControlsBarsUsingBlock:(void (^)(VLCControlsBarCommon *controlsBar))block
-{
-    [voutWindows enumerateKeysAndObjectsUsingBlock:^(id key, id obj, BOOL *stop) {
-
-        if ([obj respondsToSelector:@selector(controlsBar)]) {
-            VLCControlsBarCommon *o_controlsBar = [obj controlsBar];
-            if (o_controlsBar && block)
-                block(o_controlsBar);
-        }
-    }];
-}
-
-- (void)updateWindowsUsingBlock:(void (^)(VLCVideoWindowCommon *o_window))windowUpdater
-{
-    [voutWindows enumerateKeysAndObjectsUsingBlock:^(id key, id obj, BOOL *stop) {
-        if ([obj isKindOfClass: [NSWindow class]])
-            windowUpdater(obj);
-    }];
-}
-
-- (void)updateWindowLevelForHelperWindows:(NSInteger)i_level
-{
-    if (var_InheritBool(getIntf(), "video-wallpaper"))
-        return;
-
-    currentWindowLevel = i_level;
-    if (i_level == NSNormalWindowLevel) {
-        _currentStatusWindowLevel = NSFloatingWindowLevel;
-    } else {
-        _currentStatusWindowLevel = i_level + 1;
-    }
-
-    NSInteger currentStatusWindowLevel = self.currentStatusWindowLevel;
-
-    VLCMain *main = [VLCMain sharedInstance];
-    [[[VLCMain sharedInstance] mainWindow] setWindowLevel:i_level];
-    [[main videoEffectsPanel] updateCocoaWindowLevel:currentStatusWindowLevel];
-    [[main audioEffectsPanel] updateCocoaWindowLevel:currentStatusWindowLevel];
-    [[main currentMediaInfoPanel] updateCocoaWindowLevel:currentStatusWindowLevel];
-    [[main bookmarks] updateCocoaWindowLevel:currentStatusWindowLevel];
-    [[main trackSyncPanel] updateCocoaWindowLevel:currentStatusWindowLevel];
-    [[main resumeDialog] updateCocoaWindowLevel:currentStatusWindowLevel];
-}
-
-@end
index 194b5de..dd15cf2 100644 (file)
 
     NSInteger i_currLevel = [self level];
     // self.fullscreen and _inFullscreenTransition must not be true yet
-    [[[VLCMain sharedInstance] voutController] updateWindowLevelForHelperWindows: NSNormalWindowLevel];
+    [[[VLCMain sharedInstance] voutProvider] updateWindowLevelForHelperWindows: NSNormalWindowLevel];
     [self setLevel:NSNormalWindowLevel];
     i_originalLevel = i_currLevel;
 
 {
     _inFullscreenTransition = NO;
 
-    [[[VLCMain sharedInstance] voutController] updateWindowLevelForHelperWindows: i_originalLevel];
+    [[[VLCMain sharedInstance] voutProvider] updateWindowLevelForHelperWindows: i_originalLevel];
     [self setLevel:i_originalLevel];
 }
 
     /* Make sure we don't see the window flashes in float-on-top mode */
     NSInteger i_currLevel = [self level];
     // self.fullscreen must not be true yet
-    [[[VLCMain sharedInstance] voutController] updateWindowLevelForHelperWindows: NSNormalWindowLevel];
+    [[[VLCMain sharedInstance] voutProvider] updateWindowLevelForHelperWindows: NSNormalWindowLevel];
     [self setLevel:NSNormalWindowLevel];
     i_originalLevel = i_currLevel; // would be overwritten by previous call
 
 
     o_fullscreen_window = nil;
 
-    [[[VLCMain sharedInstance] voutController] updateWindowLevelForHelperWindows: i_originalLevel];
+    [[[VLCMain sharedInstance] voutProvider] updateWindowLevelForHelperWindows: i_originalLevel];
     [self setLevel:i_originalLevel];
 
     [self setAlphaValue: config_GetFloat("macosx-opaqueness")];
index 3764dbf..96b9f67 100644 (file)
@@ -558,8 +558,8 @@ modules/gui/macosx/VLCVolumeSliderCell.h
 modules/gui/macosx/VLCVolumeSliderCell.m
 modules/gui/macosx/VLCVoutView.h
 modules/gui/macosx/VLCVoutView.m
-modules/gui/macosx/VLCVoutWindowController.h
-modules/gui/macosx/VLCVoutWindowController.m
+modules/gui/macosx/VLCVideoOutputProvider.h
+modules/gui/macosx/VLCVideoOutputProvider.m
 modules/gui/macosx/VLCWrappableTextField.h
 modules/gui/macosx/VLCWrappableTextField.m
 modules/gui/macosx/Windows.h