Commit dac588bc authored by David Fuhrmann's avatar David Fuhrmann Committed by Felix Paul Kühne

macosx vout: move setter for window level to vout provider

(cherry picked from commit 9bd356e5608e5a13890f7f811bb7bd86f2328769)
Signed-off-by: default avatarFelix Paul Kühne <fkuehne@videolan.org>
parent 4bb0ca58
...@@ -41,6 +41,7 @@ ...@@ -41,6 +41,7 @@
#include <vlc_modules.h> #include <vlc_modules.h>
#include <vlc_aout_intf.h> #include <vlc_aout_intf.h>
#include <vlc_vout_window.h> #include <vlc_vout_window.h>
#include <vlc_vout_display.h>
#include <unistd.h> /* execl() */ #include <unistd.h> /* execl() */
#import "CompatibilityFixes.h" #import "CompatibilityFixes.h"
...@@ -156,25 +157,33 @@ int WindowOpen( vout_window_t *p_wnd, const vout_window_cfg_t *cfg ) ...@@ -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 ) static int WindowControl( vout_window_t *p_wnd, int i_query, va_list args )
{ {
/* TODO */ switch( i_query )
if( i_query == VOUT_WINDOW_SET_STATE )
msg_Dbg( p_wnd, "WindowControl:VOUT_WINDOW_SET_STATE" );
else if( i_query == VOUT_WINDOW_SET_SIZE )
{ {
unsigned int i_width = va_arg( args, unsigned int ); case VOUT_WINDOW_SET_STATE:
unsigned int i_height = va_arg( args, unsigned int ); {
[[VLCMain sharedInstance] setNativeVideoSize:NSMakeSize( i_width, i_height )]; unsigned i_state = va_arg( args, unsigned );
} [[VLCMain sharedInstance] performSelectorOnMainThread:@selector(setWindowLevel:) withObject:[NSNumber numberWithUnsignedInt:i_state] waitUntilDone:NO];
else if( i_query == VOUT_WINDOW_SET_FULLSCREEN ) return VLC_SUCCESS;
{ }
NSAutoreleasePool *o_pool = [[NSAutoreleasePool alloc] init]; case VOUT_WINDOW_SET_SIZE:
int i_full = va_arg( args, int ); {
[[VLCMain sharedInstance] performSelectorOnMainThread:@selector(checkFullscreenChange:) withObject:[NSNumber numberWithInt: i_full] waitUntilDone:NO]; unsigned int i_width = va_arg( args, unsigned int );
[o_pool release]; 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 ) void WindowClose( vout_window_t *p_wnd )
...@@ -1630,6 +1639,33 @@ unsigned int CocoaKeyToVLC( unichar i_key ) ...@@ -1630,6 +1639,33 @@ unsigned int CocoaKeyToVLC( unichar i_key )
[o_mainmenu setShuffle]; [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 -
#pragma mark Other objects getters #pragma mark Other objects getters
...@@ -1743,11 +1779,6 @@ unsigned int CocoaKeyToVLC( unichar i_key ) ...@@ -1743,11 +1779,6 @@ unsigned int CocoaKeyToVLC( unichar i_key )
return videoView; return videoView;
} }
- (void)setNativeVideoSize:(NSSize)size
{
[o_mainwindow setNativeVideoSize:size];
}
- (id)embeddedList - (id)embeddedList
{ {
if( o_embedded_list ) if( o_embedded_list )
...@@ -1777,16 +1808,6 @@ unsigned int CocoaKeyToVLC( unichar i_key ) ...@@ -1777,16 +1808,6 @@ unsigned int CocoaKeyToVLC( unichar i_key )
return o_remote; 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 - (BOOL)activeVideoPlayback
{ {
return b_active_videoplayback; return b_active_videoplayback;
......
...@@ -330,11 +330,8 @@ static int Control (vout_display_t *vd, int query, va_list ap) ...@@ -330,11 +330,8 @@ static int Control (vout_display_t *vd, int query, va_list ap)
} }
case VOUT_DISPLAY_CHANGE_WINDOW_STATE: case VOUT_DISPLAY_CHANGE_WINDOW_STATE:
{ {
NSAutoreleasePool * o_pool = [[NSAutoreleasePool alloc] init];
unsigned state = va_arg (ap, unsigned); unsigned state = va_arg (ap, unsigned);
[sys->glView performSelectorOnMainThread:@selector(setWindowLevel:) withObject:[NSNumber numberWithUnsignedInt:state] waitUntilDone:NO]; return vout_window_SetState (sys->embed, state);
[o_pool release];
return VLC_SUCCESS;
} }
case VOUT_DISPLAY_CHANGE_DISPLAY_FILLED: case VOUT_DISPLAY_CHANGE_DISPLAY_FILLED:
case VOUT_DISPLAY_CHANGE_ZOOM: case VOUT_DISPLAY_CHANGE_ZOOM:
...@@ -706,14 +703,6 @@ static void OpenglSwap (vlc_gl_t *gl) ...@@ -706,14 +703,6 @@ static void OpenglSwap (vlc_gl_t *gl)
return YES; 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 -
#pragma mark Mouse handling #pragma mark Mouse handling
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment