]> git.sesse.net Git - vlc/commitdiff
macosx: implement vout actions handling for multiple vout windows
authorDavid Fuhrmann <david.fuhrmann@googlemail.com>
Sat, 20 Oct 2012 13:15:19 +0000 (15:15 +0200)
committerDavid Fuhrmann <david.fuhrmann@googlemail.com>
Sat, 20 Oct 2012 13:33:11 +0000 (15:33 +0200)
Now, everything from the video menu and the basic stuff like fullscreen
should work. If it does'nt (e.g. fullscreen and resize with video-splitter module enabled)
please blame the core first. ;-)

TODO: There might be some getVout()-calls left which should be investigated.

close #6814

12 files changed:
extras/package/macosx/Resources/English.lproj/MainMenu.xib
modules/gui/macosx/CoreInteraction.m
modules/gui/macosx/MainMenu.m
modules/gui/macosx/MainWindow.m
modules/gui/macosx/VLCVoutWindowController.m
modules/gui/macosx/VideoView.h
modules/gui/macosx/VideoView.m
modules/gui/macosx/Windows.h
modules/gui/macosx/Windows.m
modules/gui/macosx/applescript.m
modules/gui/macosx/intf.h
modules/gui/macosx/intf.m

index 4127f0dd77cdf02be7c7a9452029f1744041910a..8c1c49e181f44014a2f374cecbf01b80bfa5f974 100644 (file)
@@ -2,7 +2,7 @@
 <archive type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="7.10">
   <data>
     <int key="IBDocument.SystemTarget">1050</int>
-    <string key="IBDocument.SystemVersion">12C54</string>
+    <string key="IBDocument.SystemVersion">12C60</string>
     <string key="IBDocument.InterfaceBuilderVersion">851</string>
     <string key="IBDocument.AppKitVersion">1187.34</string>
     <string key="IBDocument.HIToolboxVersion">625.00</string>
@@ -21,7 +21,9 @@
     </object>
     <object class="NSMutableArray" key="IBDocument.EditedObjectIDs">
       <bool key="EncodedWithXMLCoder">YES</bool>
-      <integer value="2"/>
+      <integer value="2730"/>
+      <integer value="334"/>
+      <integer value="4756"/>
     </object>
     <object class="NSArray" key="IBDocument.PluginDependencies">
       <bool key="EncodedWithXMLCoder">YES</bool>
                   <int key="NSMnemonicLoc">2147483647</int>
                   <reference key="NSOnImage" ref="447396056"/>
                   <reference key="NSMixedImage" ref="100133332"/>
+                  <int key="NSTag">1</int>
                 </object>
                 <object class="NSMenuItem" id="633479871">
                   <reference key="NSMenu" ref="598695780"/>
                   <int key="NSMnemonicLoc">2147483647</int>
                   <reference key="NSOnImage" ref="447396056"/>
                   <reference key="NSMixedImage" ref="100133332"/>
+                  <int key="NSTag">2</int>
                 </object>
                 <object class="NSMenuItem" id="115305473">
                   <reference key="NSMenu" ref="598695780"/>
                   <int key="NSMnemonicLoc">2147483647</int>
                   <reference key="NSOnImage" ref="447396056"/>
                   <reference key="NSMixedImage" ref="100133332"/>
+                  <int key="NSTag">3</int>
                 </object>
                 <object class="NSMenuItem" id="137277528">
                   <reference key="NSMenu" ref="598695780"/>
@@ -6953,46 +6958,6 @@ LCAuLi4</string>
           </object>
           <int key="connectionID">4738</int>
         </object>
-        <object class="IBConnectionRecord">
-          <object class="IBActionConnection" key="connection">
-            <string key="label">resizeVideoWindow:</string>
-            <reference key="source" ref="651263286"/>
-            <reference key="destination" ref="306486441"/>
-          </object>
-          <int key="connectionID">4741</int>
-        </object>
-        <object class="IBConnectionRecord">
-          <object class="IBActionConnection" key="connection">
-            <string key="label">resizeVideoWindow:</string>
-            <reference key="source" ref="651263286"/>
-            <reference key="destination" ref="848898341"/>
-          </object>
-          <int key="connectionID">4742</int>
-        </object>
-        <object class="IBConnectionRecord">
-          <object class="IBActionConnection" key="connection">
-            <string key="label">resizeVideoWindow:</string>
-            <reference key="source" ref="651263286"/>
-            <reference key="destination" ref="633479871"/>
-          </object>
-          <int key="connectionID">4743</int>
-        </object>
-        <object class="IBConnectionRecord">
-          <object class="IBActionConnection" key="connection">
-            <string key="label">resizeVideoWindow:</string>
-            <reference key="source" ref="651263286"/>
-            <reference key="destination" ref="115305473"/>
-          </object>
-          <int key="connectionID">4744</int>
-        </object>
-        <object class="IBConnectionRecord">
-          <object class="IBActionConnection" key="connection">
-            <string key="label">toggleFullscreen:</string>
-            <reference key="source" ref="651263286"/>
-            <reference key="destination" ref="606474125"/>
-          </object>
-          <int key="connectionID">4745</int>
-        </object>
         <object class="IBConnectionRecord">
           <object class="IBActionConnection" key="connection">
             <string key="label">floatOnTop:</string>
@@ -7009,14 +6974,6 @@ LCAuLi4</string>
           </object>
           <int key="connectionID">4747</int>
         </object>
-        <object class="IBConnectionRecord">
-          <object class="IBActionConnection" key="connection">
-            <string key="label">toggleFullscreen:</string>
-            <reference key="source" ref="651263286"/>
-            <reference key="destination" ref="788765547"/>
-          </object>
-          <int key="connectionID">4748</int>
-        </object>
         <object class="IBConnectionRecord">
           <object class="IBActionConnection" key="connection">
             <string key="label">createVideoSnapshot:</string>
@@ -8009,6 +7966,54 @@ LCAuLi4</string>
           </object>
           <int key="connectionID">5395</int>
         </object>
+        <object class="IBConnectionRecord">
+          <object class="IBActionConnection" key="connection">
+            <string key="label">resizeVideoWindow:</string>
+            <reference key="source" ref="651263286"/>
+            <reference key="destination" ref="306486441"/>
+          </object>
+          <int key="connectionID">5403</int>
+        </object>
+        <object class="IBConnectionRecord">
+          <object class="IBActionConnection" key="connection">
+            <string key="label">resizeVideoWindow:</string>
+            <reference key="source" ref="651263286"/>
+            <reference key="destination" ref="848898341"/>
+          </object>
+          <int key="connectionID">5404</int>
+        </object>
+        <object class="IBConnectionRecord">
+          <object class="IBActionConnection" key="connection">
+            <string key="label">resizeVideoWindow:</string>
+            <reference key="source" ref="651263286"/>
+            <reference key="destination" ref="633479871"/>
+          </object>
+          <int key="connectionID">5405</int>
+        </object>
+        <object class="IBConnectionRecord">
+          <object class="IBActionConnection" key="connection">
+            <string key="label">resizeVideoWindow:</string>
+            <reference key="source" ref="651263286"/>
+            <reference key="destination" ref="115305473"/>
+          </object>
+          <int key="connectionID">5406</int>
+        </object>
+        <object class="IBConnectionRecord">
+          <object class="IBActionConnection" key="connection">
+            <string key="label">toggleFullscreen:</string>
+            <reference key="source" ref="651263286"/>
+            <reference key="destination" ref="606474125"/>
+          </object>
+          <int key="connectionID">5407</int>
+        </object>
+        <object class="IBConnectionRecord">
+          <object class="IBActionConnection" key="connection">
+            <string key="label">toggleFullscreen:</string>
+            <reference key="source" ref="651263286"/>
+            <reference key="destination" ref="788765547"/>
+          </object>
+          <int key="connectionID">5408</int>
+        </object>
       </object>
       <object class="IBMutableOrderedSet" key="objectRecords">
         <object class="NSArray" key="orderedObjects">
@@ -12118,9 +12123,9 @@ LCAuLi4</string>
           <string>{{600, 612}, {137, 103}}</string>
           <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
           <boolean value="YES"/>
-          <string>{{476, 681}, {604, 310}}</string>
+          <string>{{528, 635}, {604, 310}}</string>
           <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
-          <string>{{476, 681}, {604, 310}}</string>
+          <string>{{528, 635}, {604, 310}}</string>
           <boolean value="YES"/>
           <boolean value="YES"/>
           <boolean value="NO"/>
@@ -12206,12 +12211,12 @@ LCAuLi4</string>
           <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
           <boolean value="YES"/>
           <boolean value="YES"/>
-          <string>{{816, 570}, {64, 6}}</string>
+          <string>{{1009, 808}, {64, 6}}</string>
           <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
           <boolean value="YES"/>
           <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
           <boolean value="YES"/>
-          <string>{{816, 550}, {64, 6}}</string>
+          <string>{{1009, 788}, {64, 6}}</string>
           <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
           <boolean value="YES"/>
           <string>{{340, 613}, {488, 40}}</string>
@@ -12229,7 +12234,7 @@ LCAuLi4</string>
           <boolean value="YES"/>
           <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
           <boolean value="YES"/>
-          <string>{{390, 199}, {161, 223}}</string>
+          <string>{{838, 667}, {161, 223}}</string>
           <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
           <boolean value="YES"/>
           <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
@@ -12313,14 +12318,14 @@ LCAuLi4</string>
           <boolean value="YES"/>
           <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
           <boolean value="YES"/>
-          <string>{{450, 715}, {518, 20}}</string>
+          <string>{{472, 974}, {518, 20}}</string>
           <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
           <boolean value="YES"/>
           <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
           <boolean value="YES"/>
           <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
           <boolean value="YES"/>
-          <string>{{829, 352}, {208, 363}}</string>
+          <string>{{801, 611}, {208, 363}}</string>
           <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
           <boolean value="YES"/>
           <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
@@ -12947,7 +12952,7 @@ LCAuLi4</string>
         </object>
       </object>
       <nil key="sourceID"/>
-      <int key="maxID">5395</int>
+      <int key="maxID">5408</int>
     </object>
     <object class="IBClassDescriber" key="IBDocument.Classes">
       <object class="NSMutableArray" key="referencedPartialClassDescriptions">
@@ -15041,6 +15046,7 @@ LCAuLi4</string>
               <string>dropzoneButtonAction:</string>
               <string>removePodcast:</string>
               <string>removePodcastWindowAction:</string>
+              <string>toggleFullscreenForCurrentWindow:</string>
               <string>togglePlaylist:</string>
             </object>
             <object class="NSMutableArray" key="dict.values">
@@ -15051,6 +15057,7 @@ LCAuLi4</string>
               <string>id</string>
               <string>id</string>
               <string>id</string>
+              <string>id</string>
             </object>
           </object>
           <object class="NSMutableDictionary" key="actionInfosByName">
@@ -15062,6 +15069,7 @@ LCAuLi4</string>
               <string>dropzoneButtonAction:</string>
               <string>removePodcast:</string>
               <string>removePodcastWindowAction:</string>
+              <string>toggleFullscreenForCurrentWindow:</string>
               <string>togglePlaylist:</string>
             </object>
             <object class="NSMutableArray" key="dict.values">
@@ -15086,6 +15094,10 @@ LCAuLi4</string>
                 <string key="name">removePodcastWindowAction:</string>
                 <string key="candidateClassName">id</string>
               </object>
+              <object class="IBActionInfo">
+                <string key="name">toggleFullscreenForCurrentWindow:</string>
+                <string key="candidateClassName">id</string>
+              </object>
               <object class="IBActionInfo">
                 <string key="name">togglePlaylist:</string>
                 <string key="candidateClassName">id</string>
@@ -15097,7 +15109,6 @@ LCAuLi4</string>
             <object class="NSArray" key="dict.sortedKeys">
               <bool key="EncodedWithXMLCoder">YES</bool>
               <string>o_chosen_category_lbl</string>
-              <string>o_current_video_window</string>
               <string>o_dropzone_box</string>
               <string>o_dropzone_btn</string>
               <string>o_dropzone_lbl</string>
@@ -15133,7 +15144,6 @@ LCAuLi4</string>
               <string>id</string>
               <string>id</string>
               <string>id</string>
-              <string>id</string>
               <string>VLCFSPanel</string>
               <string>id</string>
               <string>id</string>
@@ -15164,7 +15174,6 @@ LCAuLi4</string>
             <object class="NSArray" key="dict.sortedKeys">
               <bool key="EncodedWithXMLCoder">YES</bool>
               <string>o_chosen_category_lbl</string>
-              <string>o_current_video_window</string>
               <string>o_dropzone_box</string>
               <string>o_dropzone_btn</string>
               <string>o_dropzone_lbl</string>
@@ -15199,10 +15208,6 @@ LCAuLi4</string>
                 <string key="name">o_chosen_category_lbl</string>
                 <string key="candidateClassName">id</string>
               </object>
-              <object class="IBToOneOutletInfo">
-                <string key="name">o_current_video_window</string>
-                <string key="candidateClassName">id</string>
-              </object>
               <object class="IBToOneOutletInfo">
                 <string key="name">o_dropzone_box</string>
                 <string key="candidateClassName">id</string>
@@ -15963,6 +15968,17 @@ LCAuLi4</string>
         <object class="IBPartialClassDescription">
           <string key="className">VLCVoutView</string>
           <string key="superclassName">NSView</string>
+          <object class="NSMutableDictionary" key="actions">
+            <string key="NS.key.0">toggleFullscreenForCurrentWindow:</string>
+            <string key="NS.object.0">id</string>
+          </object>
+          <object class="NSMutableDictionary" key="actionInfosByName">
+            <string key="NS.key.0">toggleFullscreenForCurrentWindow:</string>
+            <object class="IBActionInfo" key="NS.object.0">
+              <string key="name">toggleFullscreenForCurrentWindow:</string>
+              <string key="candidateClassName">id</string>
+            </object>
+          </object>
           <object class="IBClassDescriptionSource" key="sourceIdentifier">
             <string key="majorKey">IBProjectSource</string>
             <string key="minorKey">../../../modules/gui/macosx/VideoView.h</string>
index b5f496d1eb5c1232432bc44e1bdc9e6117b6d45b..aff14a4a13259ef540d6ef62c6b39543197ab198 100644 (file)
@@ -557,7 +557,7 @@ static VLCCoreInteraction *_o_sharedInstance = nil;
 
     BOOL b_fs = var_ToggleBool(pl_Get(p_intf), "fullscreen");
 
-    vout_thread_t *p_vout = getVout();
+    vout_thread_t *p_vout = getVoutForActiveWindow();
     if (p_vout) {
         var_SetBool(p_vout, "fullscreen", b_fs);
         vlc_object_release(p_vout);
index 2e1c4a15a7ac16ef2e7cd64bd807b1b3a5b1f9be..c4897021bf65771e742ba3be4e173ea79cc5537c 100644 (file)
@@ -508,7 +508,7 @@ static VLCMainMenu *_o_sharedInstance = nil;
             vlc_object_release(p_aout);
         }
 
-        vout_thread_t * p_vout = input_GetVout(p_input);
+        vout_thread_t * p_vout = getVoutForActiveWindow();
 
         if (p_vout != NULL) {
             [self setupVarMenuItem: o_mi_aspect_ratio target: (vlc_object_t *)p_vout
@@ -695,6 +695,7 @@ static VLCMainMenu *_o_sharedInstance = nil;
 
 #pragma mark -
 #pragma mark video menu
+
 - (IBAction)toggleFullscreen:(id)sender
 {
     [[VLCCoreInteraction sharedInstance] toggleFullscreen];
@@ -704,7 +705,7 @@ static VLCMainMenu *_o_sharedInstance = nil;
 {
     input_thread_t *p_input = pl_CurrentInput(VLCIntf);
     if (p_input) {
-        vout_thread_t *p_vout = getVout();
+        vout_thread_t *p_vout = getVoutForActiveWindow();
         if (p_vout) {
             if (sender == o_mi_half_window)
                 var_SetFloat(p_vout, "zoom", 0.5);
@@ -714,7 +715,7 @@ static VLCMainMenu *_o_sharedInstance = nil;
                 var_SetFloat(p_vout, "zoom", 2.0);
             else
             {
-                [[[[[VLCMain sharedInstance] mainWindow] videoView] window] performZoom:sender];
+                [[NSApp keyWindow] performZoom:sender];
             }
             vlc_object_release(p_vout);
         }
@@ -726,7 +727,7 @@ static VLCMainMenu *_o_sharedInstance = nil;
 {
     input_thread_t *p_input = pl_CurrentInput(VLCIntf);
     if (p_input) {
-        vout_thread_t *p_vout = getVout();
+        vout_thread_t *p_vout = getVoutForActiveWindow();
         if (p_vout) {
             var_ToggleBool(p_vout, "video-on-top");
             vlc_object_release(p_vout);
@@ -739,7 +740,7 @@ static VLCMainMenu *_o_sharedInstance = nil;
 {
     input_thread_t *p_input = pl_CurrentInput(VLCIntf);
     if (p_input) {
-        vout_thread_t *p_vout = getVout();
+        vout_thread_t *p_vout = getVoutForActiveWindow();
         if (p_vout) {
             var_TriggerCallback(p_vout, "video-snapshot");
             vlc_object_release(p_vout);
@@ -1270,7 +1271,7 @@ static VLCMainMenu *_o_sharedInstance = nil;
         bEnabled = FALSE;
 
         if (p_input != NULL) {
-            vout_thread_t *p_vout = input_GetVout(p_input);
+            vout_thread_t *p_vout = getVoutForActiveWindow();
             if (p_vout != NULL) {
                 if ([o_title isEqualToString: _NS("Float on Top")])
                     [o_mi setState: var_GetBool(p_vout, "video-on-top")];
index 736f965e7c3a2c9f24424a96eccc45bc84a9c2f9..6075f0a6147b365d57b08ab1ce573ff38d11120b 100644 (file)
@@ -766,7 +766,7 @@ static VLCMainWindow *_o_sharedInstance = nil;
     } else {
         if (var_InheritBool(VLCIntf, "embedded-video") || b_nativeFullscreenMode) {
             o_vout_view = [o_video_view retain];
-            o_new_video_window = self;
+            o_new_video_window = [self retain];
             b_nonembedded = NO;
         } else {
             NSWindowController *o_controller = [[NSWindowController alloc] initWithWindowNibName:@"DetachedVideoWindow"];
@@ -796,7 +796,7 @@ static VLCMainWindow *_o_sharedInstance = nil;
     }
 
     [o_new_video_window setAlphaValue: config_GetFloat(VLCIntf, "macosx-opaqueness")];
-    [[[VLCMain sharedInstance] voutController] addVout:o_new_video_window forDisplay:p_wnd];
+    [[[VLCMain sharedInstance] voutController] addVout:[o_new_video_window autorelease] forDisplay:p_wnd];
 
     if(b_nonembedded) {
         // event occurs before window is created, so call again
@@ -868,8 +868,10 @@ static VLCMainWindow *_o_sharedInstance = nil;
     [NSCursor setHiddenUntilMouseMoves: YES];
 }
 
+
 #pragma mark -
 #pragma mark Fullscreen support
+
 - (void)showFullscreenController
 {
      if (b_fullscreen && [[VLCMain sharedInstance] activeVideoPlayback])
index 30f062b1927db346946703a55b94ef56a4c8f864..93a064bfe6ddd9294ec90c850ca0adcc92e89fbe 100644 (file)
@@ -25,6 +25,7 @@
 #import "VLCVoutWindowController.h"
 #import "intf.h"
 #import "Windows.h"
+#import "VideoView.h"
 
 @implementation VLCVoutWindowController
 
 
 - (void)dealloc
 {
+    NSArray *keys = [o_vout_dict allKeys];
+    for (NSValue *key in keys)
+        [self removeVoutforDisplay:key];
+
     [o_vout_dict release];
     [super dealloc];
 }
 
 - (void)addVout:(VLCVideoWindowCommon *)o_window forDisplay:(vout_window_t *)p_wnd
 {
+    [[o_window videoView] setVoutThread:(vout_thread_t *)p_wnd->p_parent];
+
     [o_vout_dict setObject:o_window forKey:[NSValue valueWithPointer:p_wnd]];
 }
 
@@ -60,7 +67,8 @@
     if (![NSStringFromClass([o_window class]) isEqualToString:@"VLCMainWindow"]) {
         [o_window orderOut:self];
     }
-    
+
+    [[o_window videoView] releaseVoutThread];
     [o_vout_dict removeObjectForKey:o_key];
 }
 
index 51c599d3080cb55893eb9cc2241cbcdcf77dd130..339b597bd79703b1b4644bcda4a422d8a77a5a19 100644 (file)
@@ -25,6 +25,9 @@
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
  *****************************************************************************/
 
+#import <vlc_vout.h>
+
+
 /*****************************************************************************
  * VLCVoutView interface
  *****************************************************************************/
     NSTimeInterval t_lastScrollEvent;
 
     CGFloat f_cumulated_magnification;
+
+    vout_thread_t *p_vout;
 }
+
+- (void)setVoutThread:(vout_thread_t *)p_vout_thread;
+- (vout_thread_t *)voutThread;
+- (void)releaseVoutThread;
+
 @end
index ac66812bdc5100869864fbe0505f4cb52eb42e28..c454c499b6923fc368baf7a294f1ada66ef8784d 100644 (file)
@@ -51,6 +51,9 @@
 
 - (void)dealloc
 {
+    if (p_vout)
+        vlc_object_release(p_vout);
+
     [self unregisterDraggedTypes];
     [super dealloc];
 }
         key = [[characters lowercaseString] characterAtIndex: 0];
 
         if (key) {
-            vout_thread_t * p_vout = getVout();
             /* Escape should always get you out of fullscreen */
             if (key == (unichar) 0x1b) {
                 playlist_t * p_playlist = pl_Get(VLCIntf);
             else
                 msg_Dbg(VLCIntf, "could not send keyevent to VLC core");
 
-            if (p_vout)
-                vlc_object_release(p_vout);
-
             return;
         }
     }
     }
 }
 
+#pragma mark -
+#pragma mark Handling of vout related actions
+
+- (void)setVoutThread:(vout_thread_t *)p_vout_thread
+{
+    assert(p_vout == NULL);
+    p_vout = p_vout_thread;
+    vlc_object_hold(p_vout);
+}
+
+- (vout_thread_t *)voutThread
+{
+    if (p_vout) {
+        vlc_object_hold(p_vout);
+        return p_vout;
+    }
+
+    return NULL;
+}
+
+- (void)releaseVoutThread
+{
+    if (p_vout) {
+        vlc_object_release(p_vout);
+        p_vout = NULL;
+    }
+}
+
+#pragma mark -
+#pragma mark Basic view behaviour and touch events handling
+
 - (BOOL)mouseDownCanMoveWindow
 {
     return YES;
index 00e5d88bd2722c6be2dbe6411e409049f4ad0722..bdc2de7d0c4ab4a1800ad585c4f6c5d04444d15c 100644 (file)
@@ -32,6 +32,8 @@
  *  Missing extension to NSWindow
  *****************************************************************************/
 
+@class VLCVoutView;
+
 @interface VLCWindow : NSWindow
 {
     BOOL b_canBecomeKeyWindow;
 /* animate mode is only supported in >=10.4 */
 - (void)closeAndAnimate: (BOOL)animate;
 
+- (VLCVoutView *)videoView;
+
 @end
 
 
 static const float f_min_video_height = 70.0;
 
-@class VLCVoutView;
 @class VLCControlsBarCommon;
 
 /*****************************************************************************
index e849c0ecb3e008ed63e2aadf0b49c2881b635ca4..d710a3a13ef3fb35bbaabfe38a5ee03e6e750a30 100644 (file)
     }
 }
 
+- (VLCVoutView *)videoView
+{
+    if ([[self contentView] class] == [VLCVoutView class])
+        return (VLCVoutView *)[self contentView];
+
+    return nil;
+}
+
+
 @end
 
 
     /* We always try to do so */
     [NSScreen unblackoutScreens];
 
-    vout_thread_t *p_vout = getVout();
+    vout_thread_t *p_vout = getVoutForActiveWindow();
     if (p_vout) {
         if (var_GetBool(p_vout, "video-on-top"))
             [[o_video_view window] setLevel: NSStatusWindowLevel];
index 703bc12985389113c5d8195878c98e29b43c3ec6..fd67c3aea24b4b6cdd12286026cca7d765350e67 100644 (file)
 @implementation NSApplication(ScriptSupport)
 
 - (BOOL)scriptFullscreenMode {
-    vout_thread_t * p_vout = getVout();
+    vout_thread_t * p_vout = getVoutForActiveWindow();
     if (!p_vout)
         return NO;
     BOOL b_value = var_GetBool(p_vout, "fullscreen");
 }
 
 - (void)setScriptFullscreenMode:(BOOL)mode {
-    vout_thread_t * p_vout = getVout();
+    vout_thread_t * p_vout = getVoutForActiveWindow();
     if (!p_vout)
         return;
     if (var_GetBool(p_vout, "fullscreen") == mode) {
index e6888ca93d3a3983e937d6b6b960ff1c71d5f191..d8d80d24e6026a93b8df48d49dd217794c582daa 100644 (file)
@@ -53,6 +53,7 @@
 // You need to release those objects after use
 input_thread_t *getInput(void);
 vout_thread_t *getVout(void);
+vout_thread_t *getVoutForActiveWindow(void);
 audio_output_t *getAout(void);
 
 /*****************************************************************************
index 0a9f488f2c24a2122aeb7d0d2848e28179e5e249..52e230ffb2fcbadf2d0e39664c7c933fe25ebd03 100644 (file)
@@ -512,6 +512,24 @@ vout_thread_t *getVout(void)
     return p_vout;
 }
 
+vout_thread_t *getVoutForActiveWindow(void)
+{
+    vout_thread_t *p_vout = nil;
+
+    id currentWindow = [NSApp keyWindow];
+    if ([currentWindow respondsToSelector:@selector(videoView)]) {
+        VLCVoutView *videoView = [currentWindow videoView];
+        if (videoView) {
+            p_vout = [videoView voutThread];
+        }
+    }
+
+    if (!p_vout)
+        p_vout = getVout();
+
+    return p_vout;
+}
+
 audio_output_t *getAout(void)
 {
     input_thread_t *p_input = getInput();
@@ -583,12 +601,6 @@ static VLCMain *_o_sharedMainInstance = nil;
     return _o_sharedMainInstance;
 }
 
-- (void)dealloc
-{
-    [o_vout_controller release];
-    [super dealloc];
-}
-
 - (void)setIntf: (intf_thread_t *)p_mainintf
 {
     p_intf = p_mainintf;
@@ -854,6 +866,9 @@ static VLCMain *_o_sharedMainInstance = nil;
 
     [o_mainmenu release];
 
+    [o_vout_controller release];
+    o_vout_controller = nil;
+
     libvlc_Quit(p_intf->p_libvlc);
 
     [o_mainwindow release];