Commit 09ad74bd authored by Felix Paul Kühne's avatar Felix Paul Kühne

macosx: fix the window menu's close and minimize commands when using the black window style

parent 0bce8706
/***************************************************************************** /*****************************************************************************
* CoreInteraction.h: MacOS X interface module * CoreInteraction.h: MacOS X interface module
***************************************************************************** *****************************************************************************
* Copyright (C) 2011 Felix Paul Kühne * Copyright (C) 2011-2012 Felix Paul Kühne
* $Id$ * $Id$
* *
* Authors: Felix Paul Kühne <fkuehne -at- videolan -dot- org> * Authors: Felix Paul Kühne <fkuehne -at- videolan -dot- org>
...@@ -32,6 +32,7 @@ ...@@ -32,6 +32,7 @@
+ (VLCCoreInteraction *)sharedInstance; + (VLCCoreInteraction *)sharedInstance;
- (void)play; - (void)play;
- (void)pause;
- (void)stop; - (void)stop;
- (void)faster; - (void)faster;
- (void)slower; - (void)slower;
......
/***************************************************************************** /*****************************************************************************
* CoreInteraction.m: MacOS X interface module * CoreInteraction.m: MacOS X interface module
***************************************************************************** *****************************************************************************
* Copyright (C) 2011 Felix Paul Kühne * Copyright (C) 2011-2012 Felix Paul Kühne
* $Id$ * $Id$
* *
* Authors: Felix Paul Kühne <fkuehne -at- videolan -dot- org> * Authors: Felix Paul Kühne <fkuehne -at- videolan -dot- org>
...@@ -91,6 +91,11 @@ static VLCCoreInteraction *_o_sharedInstance = nil; ...@@ -91,6 +91,11 @@ static VLCCoreInteraction *_o_sharedInstance = nil;
var_SetInteger( VLCIntf->p_libvlc, "key-action", ACTIONID_PLAY_PAUSE ); var_SetInteger( VLCIntf->p_libvlc, "key-action", ACTIONID_PLAY_PAUSE );
} }
- (void)pause
{
var_SetInteger( VLCIntf->p_libvlc, "key-action", ACTIONID_PAUSE );
}
- (void)stop - (void)stop
{ {
var_SetInteger( VLCIntf->p_libvlc, "key-action", ACTIONID_STOP ); var_SetInteger( VLCIntf->p_libvlc, "key-action", ACTIONID_STOP );
......
/***************************************************************************** /*****************************************************************************
* MainWindow.h: MacOS X interface module * MainWindow.h: MacOS X interface module
***************************************************************************** *****************************************************************************
* Copyright (C) 2002-2011 VLC authors and VideoLAN * Copyright (C) 2002-2012 VLC authors and VideoLAN
* $Id$ * $Id$
* *
* Authors: Felix Paul Kühne <fkuehne -at- videolan -dot- org> * Authors: Felix Paul Kühne <fkuehne -at- videolan -dot- org>
......
/***************************************************************************** /*****************************************************************************
* MainWindow.m: MacOS X interface module * MainWindow.m: MacOS X interface module
***************************************************************************** *****************************************************************************
* Copyright (C) 2002-2011 VLC authors and VideoLAN * Copyright (C) 2002-2012 VLC authors and VideoLAN
* $Id$ * $Id$
* *
* Authors: Felix Paul Kühne <fkuehne -at- videolan -dot- org> * Authors: Felix Paul Kühne <fkuehne -at- videolan -dot- org>
...@@ -709,6 +709,15 @@ static VLCMainWindow *_o_sharedInstance = nil; ...@@ -709,6 +709,15 @@ static VLCMainWindow *_o_sharedInstance = nil;
return YES; return YES;
} }
- (BOOL)validateMenuItem:(NSMenuItem *)menuItem
{
SEL s_menuAction = [menuItem action];
if ((s_menuAction == @selector(performClose:)) || (s_menuAction == @selector(performMiniaturize:)) || (s_menuAction == @selector(performZoom:)))
return YES;
return [super validateMenuItem:menuItem];
}
- (BOOL)isMainWindow - (BOOL)isMainWindow
{ {
return YES; return YES;
...@@ -723,6 +732,22 @@ static VLCMainWindow *_o_sharedInstance = nil; ...@@ -723,6 +732,22 @@ static VLCMainWindow *_o_sharedInstance = nil;
[super setTitle: title]; [super setTitle: title];
} }
- (void)performClose:(id)sender
{
if (b_dark_interface)
[self orderOut: sender];
else
[super performClose: sender];
}
- (void)performMiniaturize:(id)sender
{
if (b_dark_interface)
[self miniaturize: sender];
else
[super performMiniaturize: sender];
}
- (void)performZoom:(id)sender - (void)performZoom:(id)sender
{ {
if (b_dark_interface) if (b_dark_interface)
...@@ -1210,7 +1235,7 @@ static VLCMainWindow *_o_sharedInstance = nil; ...@@ -1210,7 +1235,7 @@ static VLCMainWindow *_o_sharedInstance = nil;
- (void)someWindowWillClose:(NSNotification *)notification - (void)someWindowWillClose:(NSNotification *)notification
{ {
if([notification object] == o_nonembedded_window) if([notification object] == o_nonembedded_window || [notification object] == self)
[[VLCCoreInteraction sharedInstance] stop]; [[VLCCoreInteraction sharedInstance] stop];
} }
......
...@@ -783,7 +783,7 @@ static VLCMain *_o_sharedMainInstance = nil; ...@@ -783,7 +783,7 @@ static VLCMain *_o_sharedMainInstance = nil;
{ {
[NSApp activateIgnoringOtherApps:YES]; [NSApp activateIgnoringOtherApps:YES];
[o_remote stopListening: self]; [o_remote stopListening: self];
var_SetInteger( p_intf->p_libvlc, "key-action", ACTIONID_STOP ); [[VLCCoreInteraction sharedInstance] stop];
} }
#pragma mark - #pragma mark -
...@@ -853,16 +853,7 @@ static VLCMain *_o_sharedMainInstance = nil; ...@@ -853,16 +853,7 @@ static VLCMain *_o_sharedMainInstance = nil;
/* Triggered when the computer goes to sleep */ /* Triggered when the computer goes to sleep */
- (void)computerWillSleep: (NSNotification *)notification - (void)computerWillSleep: (NSNotification *)notification
{ {
input_thread_t * p_input; [[VLCCoreInteraction sharedInstance] pause];
p_input = pl_CurrentInput( p_intf );
if( p_input )
{
int state = var_GetInteger( p_input, "state" );
if( state == PLAYING_S )
var_SetInteger( p_intf->p_libvlc, "key-action", ACTIONID_PLAY_PAUSE );
vlc_object_release( p_input );
}
} }
#pragma mark - #pragma mark -
......
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