/*****************************************************************************
* vout.m: MacOS X video output module
*****************************************************************************
- * Copyright (C) 2001-2005 the VideoLAN team
+ * Copyright (C) 2001-2006 the VideoLAN team
* $Id$
*
* Authors: Colin Delacroix <colin@zoy.org>
* Derk-Jan Hartman <hartman at videolan dot org>
* Eric Petit <titer@m0k.org>
* Benjamin Pracht <bigben at videolan dot org>
+ * Felix K\9fhne <fkuehne at videolan dot org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
#include "intf.h"
#include "vout.h"
-
/*****************************************************************************
* DeviceCallback: Callback triggered when the video-device variable is changed
*****************************************************************************/
}
else
{
- msg_Warn( VLCIntf, "Cannot find Video Output");
+ msg_Warn( VLCIntf, "cannot find Video Output");
}
}
- (BOOL)windowContainsEmbedded: (id)o_window
{
- if( ![[o_window className] isEqualToString: @"VLCWindow"] )
+/* if( ![[o_window className] isEqualToString: @"VLCWindow"] )
{
NSLog( @"We were not given a VLCWindow" );
- }
+ }*/
return ([self getViewForWindow: o_window] == nil ? NO : YES );
}
{
vlc_value_t val;
+ if( !p_real_vout ) return;
if( var_Get( p_real_vout, "video-on-top", &val )>=0 && val.b_bool)
{
val.b_bool = VLC_FALSE;
- (void)toggleFullscreen
{
vlc_value_t val;
+ if( !p_real_vout ) return;
var_Get( p_real_vout, "fullscreen", &val );
val.b_bool = !val.b_bool;
var_Set( p_real_vout, "fullscreen", val );
/* Escape should always get you out of fullscreen */
if( key == (unichar) 0x1b )
{
- if( [self isFullscreen] )
+ if( p_real_vout && [self isFullscreen] )
{
[self toggleFullscreen];
}
if( p_vout )
{
- switch( [o_event type] )
+ if( ( [o_event type] == NSLeftMouseDown ) &&
+ ( ! ( [o_event modifierFlags] & NSControlKeyMask ) ) )
{
- case NSLeftMouseDown:
+ if( [o_event clickCount] <= 1 )
{
+ /* single clicking */
var_Get( p_vout, "mouse-button-down", &val );
val.i_int |= 1;
var_Set( p_vout, "mouse-button-down", val );
}
- break;
-
- default:
- [super mouseDown: o_event];
- break;
+ else
+ {
+ /* multiple clicking */
+ [self toggleFullscreen];
+ }
+ }
+ else if( ( [o_event type] == NSRightMouseDown ) ||
+ ( ( [o_event type] == NSLeftMouseDown ) &&
+ ( [o_event modifierFlags] & NSControlKeyMask ) ) )
+ {
+ msg_Dbg( p_vout, "received NSRightMouseDown (generic method) or Ctrl clic" );
+ [NSMenu popUpContextMenu: [[VLCMain sharedInstance] getVoutMenu] withEvent: o_event forView: [[[VLCMain sharedInstance] getControls] getVoutView]];
}
+
+ /* always forward to core as well */
+ [super mouseDown: o_event];
}
}
if( p_vout )
{
- switch( [o_event type] )
+ if( [o_event type] == NSOtherMouseDown )
{
- case NSOtherMouseDown:
- {
- var_Get( p_vout, "mouse-button-down", &val );
- val.i_int |= 2;
- var_Set( p_vout, "mouse-button-down", val );
- }
- break;
-
- default:
- [super mouseDown: o_event];
- break;
+ var_Get( p_vout, "mouse-button-down", &val );
+ val.i_int |= 2;
+ var_Set( p_vout, "mouse-button-down", val );
}
+
+ [super mouseDown: o_event];
}
}
- (void)rightMouseDown:(NSEvent *)o_event
{
- vlc_value_t val;
-
if( p_vout )
{
- switch( [o_event type] )
+ if( [o_event type] == NSRightMouseDown )
{
- case NSRightMouseDown:
- {
- var_Get( p_vout, "mouse-button-down", &val );
- val.i_int |= 4;
- var_Set( p_vout, "mouse-button-down", val );
- }
- break;
-
- default:
- [super mouseDown: o_event];
- break;
+ msg_Dbg( p_vout, "received NSRightMouseDown (specific method)" );
+ [NSMenu popUpContextMenu: [[VLCMain sharedInstance] getVoutMenu] withEvent: o_event forView: [[[VLCMain sharedInstance] getControls] getVoutView]];
}
+
+ [super mouseDown: o_event];
}
}
if( p_vout )
{
- switch( [o_event type] )
+ if( [o_event type] == NSLeftMouseUp )
{
- case NSLeftMouseUp:
- {
- vlc_value_t b_val;
- b_val.b_bool = VLC_TRUE;
- var_Set( p_vout, "mouse-clicked", b_val );
+ vlc_value_t b_val;
+ b_val.b_bool = VLC_TRUE;
+ var_Set( p_vout, "mouse-clicked", b_val );
- var_Get( p_vout, "mouse-button-down", &val );
- val.i_int &= ~1;
- var_Set( p_vout, "mouse-button-down", val );
- }
- break;
-
- default:
- [super mouseUp: o_event];
- break;
+ var_Get( p_vout, "mouse-button-down", &val );
+ val.i_int &= ~1;
+ var_Set( p_vout, "mouse-button-down", val );
}
+
+ [super mouseUp: o_event];
}
}
if( p_vout )
{
- switch( [o_event type] )
+ if( [o_event type] == NSOtherMouseUp )
{
- case NSOtherMouseUp:
- {
- var_Get( p_vout, "mouse-button-down", &val );
- val.i_int &= ~2;
- var_Set( p_vout, "mouse-button-down", val );
- }
- break;
-
- default:
- [super mouseUp: o_event];
- break;
+ var_Get( p_vout, "mouse-button-down", &val );
+ val.i_int &= ~2;
+ var_Set( p_vout, "mouse-button-down", val );
}
+
+ [super mouseUp: o_event];
}
}
- (void)rightMouseUp:(NSEvent *)o_event
{
- vlc_value_t val;
-
if( p_vout )
{
- switch( [o_event type] )
+ if( [o_event type] == NSRightMouseUp )
{
- case NSRightMouseUp:
- {
- var_Get( p_vout, "mouse-button-down", &val );
- val.i_int &= ~4;
- var_Set( p_vout, "mouse-button-down", val );
- }
- break;
-
- default:
- [super mouseUp: o_event];
- break;
+ /* FIXME: this isn't the appropriate place, but we can't receive
+ * NSRightMouseDown some how */
+ msg_Dbg( p_vout, "received NSRightMouseUp" );
+ [NSMenu popUpContextMenu: [[VLCMain sharedInstance] getVoutMenu] withEvent: o_event forView: [[[VLCMain sharedInstance] getControls] getVoutView]];
}
+ [super mouseUp: o_event];
}
}
frame: s_arg_frame];
[self updateTitle];
[view setFrame: [self frame]];
+
+ if( var_GetBool( p_real_vout, "video-on-top" ) )
+ {
+ [o_window setLevel: NSStatusWindowLevel];
+ }
+
+
[o_window setAcceptsMouseMovedEvents: TRUE];
return b_return;
}
o_window = [self window];
[o_window makeKeyAndOrderFront: self];
[o_window setAcceptsMouseMovedEvents: TRUE];
+
+ if( var_GetBool( p_real_vout, "video-on-top" ) )
+ {
+ [o_window setLevel: NSStatusWindowLevel];
+ }
+
[view setFrameSize: [self frame].size];
}
return b_return;
b_init_ok = VLC_FALSE;
- p_fullscreen_state = NULL;
- b_fullscreen = VLC_FALSE;
p_real_vout = [VLCVoutView getRealVout: p_vout];
i_device = var_GetInteger( p_real_vout->p_vlc, "video-device" );
+ b_black = var_GetBool( p_real_vout->p_vlc, "macosx-black" );
/* Find out on which screen to open the window */
if( i_device <= 0 || i_device > (int)[o_screens count] )
if( p_vout->b_fullscreen )
{
CGDisplayFadeReservationToken token;
- b_fullscreen = VLC_TRUE;
NSRect screen_rect = [o_screen frame];
screen_rect.origin.x = screen_rect.origin.y = 0;
backing: NSBackingStoreBuffered
defer: YES screen: o_screen];
- if( var_GetBool( p_vout, "macosx-black" ) )
+ if( var_GetBool( p_real_vout, "macosx-black" ) )
+ if( b_black == VLC_TRUE )
{
CGAcquireDisplayFadeReservation(kCGMaxDisplayReservationInterval, &token);
CGDisplayFade( token, 0.5, kCGDisplayBlendNormal, kCGDisplayBlendSolidColor, 0, 0, 0, true );
}
if( b_menubar_screen )
{
- BeginFullScreen( &p_fullscreen_state, NULL, 0, 0,
- NULL, NULL, fullScreenAllowEvents );
+ SetSystemUIMode( kUIModeAllHidden, kUIOptionAutoShowMenuBar);
}
- if( var_GetBool( p_vout, "macosx-black" ) )
+ if( b_black == VLC_TRUE )
{
CGAcquireDisplayFadeReservation(kCGMaxDisplayReservationInterval, &token);
- CGDisplayFade( token, 2, kCGDisplayBlendSolidColor, kCGDisplayBlendNormal, 0, 0, 0, false );
+ CGDisplayFade( token, 2 , kCGDisplayBlendSolidColor, kCGDisplayBlendNormal, 0, 0, 0, false );
CGReleaseDisplayFadeReservation( token);
}
}
[self setAlphaValue: var_GetFloat( p_vout, "macosx-opaqueness" )];
- if( var_GetBool( p_real_vout, "video-on-top" ) )
- {
- [self setLevel: NSStatusWindowLevel];
- }
-
if( !s_frame )
{
[self center];
- (id) closeReal: (id) sender
{
- if( b_fullscreen == VLC_TRUE )
+ if( b_black == VLC_TRUE )
{
- if( p_vout->b_fullscreen )
- EndFullScreen( p_fullscreen_state, 0 );
- if( var_GetBool( p_vout, "macosx-black" ) )
- {
- CGDisplayFadeReservationToken token;
- CGAcquireDisplayFadeReservation(kCGMaxDisplayReservationInterval, &token);
- CGDisplayFade( token, 2, kCGDisplayBlendSolidColor, kCGDisplayBlendNormal, 0, 0, 0, false );
- CGReleaseDisplayFadeReservation( token);
- CGDisplayRestoreColorSyncSettings();
- }
+ CGDisplayFadeReservationToken token;
+ CGAcquireDisplayFadeReservation(kCGMaxDisplayReservationInterval, &token);
+ CGDisplayFade( token, 2, kCGDisplayBlendSolidColor, kCGDisplayBlendNormal, 0, 0, 0, false );
+ CGReleaseDisplayFadeReservation( token);
+ CGDisplayRestoreColorSyncSettings();
}
+ SetSystemUIMode( kUIModeNormal, 0);
[super close];
return NULL;
}