Commit 9bd356e5 authored by David Fuhrmann's avatar David Fuhrmann

macosx vout: move setter for window level to vout provider

parent 304a1c0a
......@@ -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;
......
......@@ -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
......
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