Commit df538303 authored by Felix Paul Kühne's avatar Felix Paul Kühne

macosx: clean Dudiak's code a bit

parent 654504d1
...@@ -423,12 +423,10 @@ ...@@ -423,12 +423,10 @@
- (IBAction)showPosition: (id)sender - (IBAction)showPosition: (id)sender
{ {
vout_thread_t *p_vout = vlc_object_find( VLCIntf, VLC_OBJECT_VOUT, vout_thread_t *p_vout = input_GetVout( pl_CurrentInput( VLCIntf ));
FIND_ANYWHERE );
if( p_vout != NULL ) if( p_vout != NULL )
{ {
intf_thread_t * p_intf = VLCIntf; var_SetInteger( VLCIntf->p_libvlc, "key-action", ACTIONID_POSITION );
var_SetInteger( p_intf->p_libvlc, "key-action", ACTIONID_POSITION );
vlc_object_release( (vlc_object_t *)p_vout ); vlc_object_release( (vlc_object_t *)p_vout );
} }
} }
...@@ -451,8 +449,7 @@ ...@@ -451,8 +449,7 @@
{ {
NSString *o_title = [sender title]; NSString *o_title = [sender title];
vout_thread_t *p_vout = vlc_object_find( VLCIntf, VLC_OBJECT_VOUT, vout_thread_t *p_vout = input_GetVout( pl_CurrentInput( VLCIntf ));
FIND_ANYWHERE );
if( p_vout != NULL ) if( p_vout != NULL )
{ {
id o_vout_view = [self voutView]; id o_vout_view = [self voutView];
...@@ -615,8 +612,8 @@ ...@@ -615,8 +612,8 @@
if( key ) if( key )
{ {
vout_thread_t *p_vout = vlc_object_find( VLCIntf, VLC_OBJECT_VOUT, vout_thread_t *p_vout = input_GetVout( pl_CurrentInput( VLCIntf ));
FIND_ANYWHERE );
if( p_vout != NULL ) if( p_vout != NULL )
{ {
/* Escape */ /* Escape */
...@@ -1044,8 +1041,7 @@ ...@@ -1044,8 +1041,7 @@
NSEnumerator *o_enumerator = [o_windows objectEnumerator]; NSEnumerator *o_enumerator = [o_windows objectEnumerator];
bEnabled = FALSE; bEnabled = FALSE;
vout_thread_t *p_vout = vlc_object_find( p_intf, VLC_OBJECT_VOUT, vout_thread_t *p_vout = input_GetVout( pl_CurrentInput( VLCIntf ));
FIND_ANYWHERE );
if( p_vout != NULL ) if( p_vout != NULL )
{ {
if( [[o_mi title] isEqualToString: _NS("Float on Top")] ) if( [[o_mi title] isEqualToString: _NS("Float on Top")] )
......
...@@ -26,9 +26,6 @@ ...@@ -26,9 +26,6 @@
* Preamble * Preamble
*****************************************************************************/ *****************************************************************************/
/* DisableScreenUpdates, SetSystemUIMode, ... */
#import <QuickTime/QuickTime.h>
#import "intf.h" #import "intf.h"
#import "controls.h" #import "controls.h"
#import "vout.h" #import "vout.h"
...@@ -36,6 +33,9 @@ ...@@ -36,6 +33,9 @@
#import "fspanel.h" #import "fspanel.h"
#import "playlist.h" #import "playlist.h"
/* SetSystemUIMode, ... */
#import <Carbon/Carbon.h>
/***************************************************************************** /*****************************************************************************
* extension to NSWindow's interface to fix compilation warnings * extension to NSWindow's interface to fix compilation warnings
* and let us access this functions properly * and let us access this functions properly
...@@ -53,6 +53,22 @@ ...@@ -53,6 +53,22 @@
@implementation VLCEmbeddedWindow @implementation VLCEmbeddedWindow
- (id)initWithContentRect:(NSRect)contentRect styleMask: (NSUInteger)windowStyle backing:(NSBackingStoreType)bufferingType defer:(BOOL)deferCreation
{
BOOL b_useTextured = YES;
if( [[NSWindow class] instancesRespondToSelector:@selector(setContentBorderThickness:forEdge:)] )
{
b_useTextured = NO;
windowStyle ^= NSTexturedBackgroundWindowMask;
}
self = [super initWithContentRect:contentRect styleMask:windowStyle backing:bufferingType defer:deferCreation];
if(! b_useTextured )
{
[self setContentBorderThickness:28.0 forEdge:NSMinYEdge];
}
return self;
}
- (void)awakeFromNib - (void)awakeFromNib
{ {
[self setDelegate: self]; [self setDelegate: self];
...@@ -71,15 +87,9 @@ ...@@ -71,15 +87,9 @@
[o_btn_playlist setToolTip: _NS("Playlist")]; [o_btn_playlist setToolTip: _NS("Playlist")];
[self setTitle: _NS("VLC media player")]; [self setTitle: _NS("VLC media player")];
if(MACOS_VERSION < 10.5f) { o_img_play = [NSImage imageNamed: @"play_big"];
o_img_play = [NSImage imageNamed: @"play"]; o_img_pause = [NSImage imageNamed: @"pause_big"];
o_img_pause = [NSImage imageNamed: @"pause"];
[o_btn_play setImage: [NSImage imageNamed: @"play"]];
}
else {
o_img_play = [NSImage imageNamed: @"play_big"];
o_img_pause = [NSImage imageNamed: @"pause_big"];
}
[self controlTintChanged]; [self controlTintChanged];
[[NSNotificationCenter defaultCenter] addObserver: self [[NSNotificationCenter defaultCenter] addObserver: self
selector: @selector( controlTintChanged ) selector: @selector( controlTintChanged )
...@@ -118,30 +128,8 @@ ...@@ -118,30 +128,8 @@
if( [o_btn_play alternateImage] == o_img_play_pressed ) if( [o_btn_play alternateImage] == o_img_play_pressed )
b_playing = YES; b_playing = YES;
if (MACOS_VERSION < 10.5f) { o_img_play_pressed = [NSImage imageNamed: @"play_big_down"];
/* System is running Tiger and should use aqua buttons */ o_img_pause_pressed = [NSImage imageNamed: @"pause_big_down"];
[o_btn_backward setImage: [NSImage imageNamed: @"skip_previous_active"]];
[o_btn_forward setImage: [NSImage imageNamed: @"skip_forward_active"]];
if( [NSColor currentControlTint] == NSGraphiteControlTint )
{
o_img_play_pressed = [NSImage imageNamed: @"play_graphite"];
o_img_pause_pressed = [NSImage imageNamed: @"pause_graphite"];
[o_btn_backward setAlternateImage: [NSImage imageNamed: @"skip_previous_graphite"]];
[o_btn_forward setAlternateImage: [NSImage imageNamed: @"skip_forward_graphite"]];
}
else
{
o_img_play_pressed = [NSImage imageNamed: @"play_blue"];
o_img_pause_pressed = [NSImage imageNamed: @"pause_blue"];
[o_btn_backward setAlternateImage: [NSImage imageNamed: @"skip_previous_blue"]];
[o_btn_forward setAlternateImage: [NSImage imageNamed: @"skip_forward_blue"]];
}
}
else{
/* System is running Leopard or later and should use metal buttons */
o_img_play_pressed = [NSImage imageNamed: @"play_big_down"];
o_img_pause_pressed = [NSImage imageNamed: @"pause_big_down"];
}
if( b_playing ) if( b_playing )
[o_btn_play setAlternateImage: o_img_play_pressed]; [o_btn_play setAlternateImage: o_img_play_pressed];
...@@ -461,10 +449,9 @@ ...@@ -461,10 +449,9 @@
[o_fullscreen_window setBackgroundColor: [NSColor blackColor]]; [o_fullscreen_window setBackgroundColor: [NSColor blackColor]];
[o_fullscreen_window setCanBecomeKeyWindow: YES]; [o_fullscreen_window setCanBecomeKeyWindow: YES];
if (![self isVisible] || [self alphaValue] == 0.0 || MACOS_VERSION < 10.4f) if (![self isVisible] || [self alphaValue] == 0.0)
{ {
/* We don't animate if we are not visible or if we are running on /* We don't animate if we are not visible, instead we
* Mac OS X <10.4 which doesn't support NSAnimation, instead we
* simply fade the display */ * simply fade the display */
CGDisplayFadeReservationToken token; CGDisplayFadeReservationToken token;
...@@ -495,20 +482,12 @@ ...@@ -495,20 +482,12 @@
} }
/* Make sure we don't see the o_view disappearing of the screen during this operation */ /* Make sure we don't see the o_view disappearing of the screen during this operation */
DisableScreenUpdates(); NSDisableScreenUpdates();
[[self contentView] replaceSubview:o_view with:o_temp_view]; [[self contentView] replaceSubview:o_view with:o_temp_view];
[o_temp_view setFrame:[o_view frame]]; [o_temp_view setFrame:[o_view frame]];
[o_fullscreen_window setContentView:o_view]; [o_fullscreen_window setContentView:o_view];
[o_fullscreen_window makeKeyAndOrderFront:self]; [o_fullscreen_window makeKeyAndOrderFront:self];
EnableScreenUpdates(); NSEnableScreenUpdates();
}
if (MACOS_VERSION < 10.4f)
{
/* We were already fullscreen nothing to do when NSAnimation
* is not supported */
[self unlockFullscreenAnimation];
return;
} }
/* We are in fullscreen (and no animation is running) */ /* We are in fullscreen (and no animation is running) */
...@@ -612,10 +591,9 @@ ...@@ -612,10 +591,9 @@
return; return;
} }
if (fadeout || MACOS_VERSION < 10.4f) if (fadeout)
{ {
/* We don't animate if we are not visible or if we are running on /* We don't animate if we are not visible, instead we
* Mac OS X <10.4 which doesn't support NSAnimation, instead we
* simply fade the display */ * simply fade the display */
CGDisplayFadeReservationToken token; CGDisplayFadeReservationToken token;
...@@ -696,7 +674,7 @@ ...@@ -696,7 +674,7 @@
{ {
/* This function is private and should be only triggered at the end of the fullscreen change animation */ /* This function is private and should be only triggered at the end of the fullscreen change animation */
/* Make sure we don't see the o_view disappearing of the screen during this operation */ /* Make sure we don't see the o_view disappearing of the screen during this operation */
DisableScreenUpdates(); NSDisableScreenUpdates();
[o_view retain]; [o_view retain];
[o_view removeFromSuperviewWithoutNeedingDisplay]; [o_view removeFromSuperviewWithoutNeedingDisplay];
[[self contentView] replaceSubview:o_temp_view with:o_view]; [[self contentView] replaceSubview:o_temp_view with:o_view];
...@@ -706,7 +684,7 @@ ...@@ -706,7 +684,7 @@
if ([self isVisible]) if ([self isVisible])
[super makeKeyAndOrderFront:self]; /* our version contains a workaround */ [super makeKeyAndOrderFront:self]; /* our version contains a workaround */
[o_fullscreen_window orderOut: self]; [o_fullscreen_window orderOut: self];
EnableScreenUpdates(); NSEnableScreenUpdates();
[o_fullscreen_window release]; [o_fullscreen_window release];
o_fullscreen_window = nil; o_fullscreen_window = nil;
......
...@@ -1551,10 +1551,12 @@ ...@@ -1551,10 +1551,12 @@
playlist_t *p_playlist = pl_Hold( VLCIntf ); playlist_t *p_playlist = pl_Hold( VLCIntf );
id o_playing_item; id o_playing_item;
PL_LOCK;
o_playing_item = [o_outline_dict objectForKey: o_playing_item = [o_outline_dict objectForKey:
[NSString stringWithFormat:@"%p", playlist_CurrentPlayingItem( p_playlist )]]; [NSString stringWithFormat:@"%p", playlist_CurrentPlayingItem( p_playlist )]];
PL_UNLOCK;
pl_Release( VLCIntf ); pl_Release( VLCIntf );
return o_playing_item; return o_playing_item;
......
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