[vlc-commits] macosx vout: move setter for window level to vout provider

David Fuhrmann git at videolan.org
Sat Jul 28 16:47:08 CEST 2012


vlc/vlc-2.0 | branch: master | David Fuhrmann <david.fuhrmann at googlemail.com> | Mon Jul 23 10:10:34 2012 +0200| [dac588bc95b93613be30615df73591dfe43a3a04] | committer: Felix Paul Kühne

macosx vout: move setter for window level to vout provider
(cherry picked from commit 9bd356e5608e5a13890f7f811bb7bd86f2328769)

Signed-off-by: Felix Paul Kühne <fkuehne at videolan.org>

> http://git.videolan.org/gitweb.cgi/vlc/vlc-2.0.git/?a=commit;h=dac588bc95b93613be30615df73591dfe43a3a04
---

 modules/gui/macosx/intf.m     |   85 +++++++++++++++++++++++++----------------
 modules/video_output/macosx.m |   13 +------
 2 files changed, 54 insertions(+), 44 deletions(-)

diff --git a/modules/gui/macosx/intf.m b/modules/gui/macosx/intf.m
index cfadf2d..8f2f19b 100644
--- a/modules/gui/macosx/intf.m
+++ b/modules/gui/macosx/intf.m
@@ -41,6 +41,7 @@
 #include <vlc_modules.h>
 #include <vlc_aout_intf.h>
 #include <vlc_vout_window.h>
+#include <vlc_vout_display.h>
 #include <unistd.h> /* execl() */
 
 #import "CompatibilityFixes.h"
@@ -156,25 +157,33 @@ int WindowOpen( vout_window_t *p_wnd, const vout_window_cfg_t *cfg )
 
 static int WindowControl( vout_window_t *p_wnd, int i_query, va_list args )
 {
-    /* TODO */
-    if( i_query == VOUT_WINDOW_SET_STATE )
-        msg_Dbg( p_wnd, "WindowControl:VOUT_WINDOW_SET_STATE" );
-    else if( i_query == VOUT_WINDOW_SET_SIZE )
+    switch( i_query )
     {
-        unsigned int i_width  = va_arg( args, unsigned int );
-        unsigned int i_height = va_arg( args, unsigned int );
-        [[VLCMain sharedInstance] setNativeVideoSize:NSMakeSize( i_width, i_height )];
-    }
-    else if( i_query == VOUT_WINDOW_SET_FULLSCREEN )
-    {
-        NSAutoreleasePool *o_pool = [[NSAutoreleasePool alloc] init];
-        int i_full = va_arg( args, int );
-        [[VLCMain sharedInstance] performSelectorOnMainThread:@selector(checkFullscreenChange:) withObject:[NSNumber numberWithInt: i_full] waitUntilDone:NO];
-        [o_pool release];
+        case VOUT_WINDOW_SET_STATE:
+        {
+            unsigned i_state = va_arg( args, unsigned );
+            [[VLCMain sharedInstance] performSelectorOnMainThread:@selector(setWindowLevel:) withObject:[NSNumber numberWithUnsignedInt:i_state] waitUntilDone:NO];
+            return VLC_SUCCESS;
+        }
+        case VOUT_WINDOW_SET_SIZE:
+        {
+            unsigned int i_width  = va_arg( args, unsigned int );
+            unsigned int i_height = va_arg( args, unsigned int );
+            [[VLCMain sharedInstance] setNativeVideoSize:NSMakeSize( i_width, i_height )];
+            return VLC_SUCCESS;
+        }
+        case VOUT_WINDOW_SET_FULLSCREEN:
+        {
+            NSAutoreleasePool *o_pool = [[NSAutoreleasePool alloc] init];
+            int i_full = va_arg( args, int );
+            [[VLCMain sharedInstance] performSelectorOnMainThread:@selector(checkFullscreenChange:) withObject:[NSNumber numberWithInt: i_full] waitUntilDone:NO];
+            [o_pool release];
+            return VLC_SUCCESS;
+        }
+        default:
+            msg_Warn( p_wnd, "unsupported control query" );
+            return VLC_EGENERIC;
     }
-    else
-        msg_Dbg( p_wnd, "WindowControl: unknown query" );
-    return VLC_SUCCESS;
 }
 
 void WindowClose( vout_window_t *p_wnd )
@@ -1630,6 +1639,33 @@ unsigned int CocoaKeyToVLC( unichar i_key )
     [o_mainmenu setShuffle];
 }
 
+
+#pragma mark -
+#pragma mark Window updater
+
+- (void)setWindowLevel:(NSNumber*)state
+{
+    if ([state unsignedIntValue] & VOUT_WINDOW_STATE_ABOVE)
+        [[[[VLCMainWindow sharedInstance] videoView] window] setLevel: NSStatusWindowLevel];
+    else
+        [[[[VLCMainWindow sharedInstance] videoView] window] setLevel: NSNormalWindowLevel];
+}
+
+- (void)setActiveVideoPlayback:(BOOL)b_value
+{
+    b_active_videoplayback = b_value;
+    if( o_mainwindow )
+    {
+        [o_mainwindow performSelectorOnMainThread:@selector(setVideoplayEnabled) withObject:nil waitUntilDone:YES];
+        [o_mainwindow performSelectorOnMainThread:@selector(togglePlaylist:) withObject:nil waitUntilDone:NO];
+    }
+}
+
+- (void)setNativeVideoSize:(NSSize)size
+{
+    [o_mainwindow setNativeVideoSize:size];
+}
+
 #pragma mark -
 #pragma mark Other objects getters
 
@@ -1743,11 +1779,6 @@ unsigned int CocoaKeyToVLC( unichar i_key )
     return videoView;
 }
 
-- (void)setNativeVideoSize:(NSSize)size
-{
-    [o_mainwindow setNativeVideoSize:size];
-}
-
 - (id)embeddedList
 {
     if( o_embedded_list )
@@ -1777,16 +1808,6 @@ unsigned int CocoaKeyToVLC( unichar i_key )
     return o_remote;
 }
 
-- (void)setActiveVideoPlayback:(BOOL)b_value
-{
-    b_active_videoplayback = b_value;
-    if( o_mainwindow )
-    {
-        [o_mainwindow performSelectorOnMainThread:@selector(setVideoplayEnabled) withObject:nil waitUntilDone:YES];
-        [o_mainwindow performSelectorOnMainThread:@selector(togglePlaylist:) withObject:nil waitUntilDone:NO];
-    }
-}
-
 - (BOOL)activeVideoPlayback
 {
     return b_active_videoplayback;
diff --git a/modules/video_output/macosx.m b/modules/video_output/macosx.m
index c2af136..2cc5c11 100644
--- a/modules/video_output/macosx.m
+++ b/modules/video_output/macosx.m
@@ -330,11 +330,8 @@ static int Control (vout_display_t *vd, int query, va_list ap)
         }
         case VOUT_DISPLAY_CHANGE_WINDOW_STATE:
         {
-            NSAutoreleasePool * o_pool = [[NSAutoreleasePool alloc] init];
             unsigned state = va_arg (ap, unsigned);
-            [sys->glView performSelectorOnMainThread:@selector(setWindowLevel:) withObject:[NSNumber numberWithUnsignedInt:state] waitUntilDone:NO];
-            [o_pool release];
-            return VLC_SUCCESS;
+            return vout_window_SetState (sys->embed, state);            
         }
         case VOUT_DISPLAY_CHANGE_DISPLAY_FILLED:
         case VOUT_DISPLAY_CHANGE_ZOOM:
@@ -706,14 +703,6 @@ static void OpenglSwap (vlc_gl_t *gl)
     return YES;
 }
 
-- (void)setWindowLevel:(NSNumber*)state
-{
-    if ([state unsignedIntValue] & VOUT_WINDOW_STATE_ABOVE)
-        [[self window] setLevel: NSStatusWindowLevel];
-    else
-        [[self window] setLevel: NSNormalWindowLevel];
-}
-
 #pragma mark -
 #pragma mark Mouse handling
 



More information about the vlc-commits mailing list