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