[vlc-commits] macosx vout: move setter for window level to vout provider
David Fuhrmann
git at videolan.org
Mon Jul 23 14:18:03 CEST 2012
vlc | branch: master | David Fuhrmann <david.fuhrmann at googlemail.com> | Mon Jul 23 10:10:34 2012 +0200| [9bd356e5608e5a13890f7f811bb7bd86f2328769] | committer: David Fuhrmann
macosx vout: move setter for window level to vout provider
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=9bd356e5608e5a13890f7f811bb7bd86f2328769
---
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 69a883b..f8f5295 100644
--- a/modules/gui/macosx/intf.m
+++ b/modules/gui/macosx/intf.m
@@ -42,6 +42,7 @@
#include <vlc_plugin.h>
#include <vlc_aout_intf.h>
#include <vlc_vout_window.h>
+#include <vlc_vout_display.h>
#include <unistd.h> /* execl() */
#import "CompatibilityFixes.h"
@@ -158,25 +159,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 )
@@ -1640,6 +1649,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
@@ -1753,11 +1789,6 @@ unsigned int CocoaKeyToVLC( unichar i_key )
return videoView;
}
-- (void)setNativeVideoSize:(NSSize)size
-{
- [o_mainwindow setNativeVideoSize:size];
-}
-
- (id)embeddedList
{
if( o_embedded_list )
@@ -1787,16 +1818,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 10557a7..bf69bfa 100644
--- a/modules/video_output/macosx.m
+++ b/modules/video_output/macosx.m
@@ -341,11 +341,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:
@@ -717,14 +714,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