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

macosx: added another option to disable media key support specifically for background usage

parent a066a057
......@@ -123,6 +123,7 @@
"o_intf_fspanel_ckb" = id;
"o_intf_lang_pop" = id;
"o_intf_lang_txt" = id;
"o_intf_mediakeys_bg_ckb" = id;
"o_intf_mediakeys_ckb" = id;
"o_intf_network_box" = id;
"o_intf_view" = id;
......
......@@ -7,7 +7,7 @@
<key>IBEditorPositions</key>
<dict>
<key>2311</key>
<string>345 378 590 293 0 0 1280 778 </string>
<string>345 356 590 315 0 0 1280 778 </string>
<key>2330</key>
<string>345 222 590 502 0 0 1280 778 </string>
<key>2440</key>
......
......@@ -426,6 +426,8 @@ struct intf_sys_t
{
BOOL b_justJumped;
BOOL b_mediaKeySupport;
BOOL b_activeInBackground;
BOOL b_active;
}
- (void)coreChangedMediaKeySupportSetting: (NSNotification *)o_notification;
......
......@@ -2825,8 +2825,11 @@ end:
- (void)awakeFromNib
{
b_mediaKeySupport = config_GetInt( VLCIntf, "macosx-mediakeys" );
b_active = b_mediaKeySupport = config_GetInt( VLCIntf, "macosx-mediakeys" );
b_activeInBackground = config_GetInt( VLCIntf, "macosx-mediakeys-background" );
[[NSNotificationCenter defaultCenter] addObserver: self selector: @selector(coreChangedMediaKeySupportSetting:) name: @"VLCMediaKeySupportSettingChanged" object: nil];
[[NSNotificationCenter defaultCenter] addObserver: self selector: @selector(appGotActiveOrInactive:) name: @"NSApplicationDidBecomeActiveNotification" object: nil];
[[NSNotificationCenter defaultCenter] addObserver: self selector: @selector(appGotActiveOrInactive:) name: @"NSApplicationWillResignActiveNotification" object: nil];
}
- (void)dealloc
......@@ -2835,15 +2838,24 @@ end:
[super dealloc];
}
- (void)appGotActiveOrInactive: (NSNotification *)o_notification
{
if(( [[o_notification name] isEqualToString: @"NSApplicationWillResignActiveNotification"] && !b_activeInBackground ) || !b_mediaKeySupport)
b_active = NO;
else
b_active = YES;
}
- (void)coreChangedMediaKeySupportSetting: (NSNotification *)o_notification
{
b_mediaKeySupport = config_GetInt( VLCIntf, "macosx-mediakeys" );
b_active = b_mediaKeySupport = config_GetInt( VLCIntf, "macosx-mediakeys" );
b_activeInBackground = config_GetInt( VLCIntf, "macosx-mediakeys-background" );
}
- (void)sendEvent: (NSEvent*)event
{
if( b_mediaKeySupport )
if( b_active )
{
if( [event type] == NSSystemDefined && [event subtype] == 8 )
{
......
......@@ -87,13 +87,17 @@ void CloseVideoGL ( vlc_object_t * );
#define EQ_KEEP_LONGTEXT N_("By default, VLC keeps the last equalizer settings before " \
"termination. This feature can be disabled here.")
#define USE_APPLE_REMOTE_TEXT N_("Allow playback control with the Apple Remote")
#define USE_APPLE_REMOTE_TEXT N_("Control playback with the Apple Remote")
#define USE_APPLE_REMOTE_LONGTEXT N_("By default, VLC can be remotely controlled with the Apple Remote.")
#define USE_MEDIAKEYS_TEXT N_("Allow playback control with the media keys")
#define USE_MEDIAKEYS_TEXT N_("Control playback with media keys")
#define USE_MEDIAKEYS_LONGTEXT N_("By default, VLC can be controlled using the media keys on modern Apple " \
"keyboards.")
#define USE_MEDIAKEYS_BACKGROUND_TEXT N_("Use media key control when VLC is in background")
#define USE_MEDIAKEYS_BACKGROUND_LONGTEXT N_("By default, VLC will accept media key events also when being " \
"in background.")
vlc_module_begin ()
set_description( N_("Mac OS X interface") )
set_capability( "interface", 200 )
......@@ -112,6 +116,8 @@ vlc_module_begin ()
false )
add_bool( "macosx-mediakeys", 1, NULL, USE_MEDIAKEYS_TEXT, USE_MEDIAKEYS_LONGTEXT,
false )
add_bool( "macosx-mediakeys-background", 1, NULL, USE_MEDIAKEYS_BACKGROUND_TEXT, USE_MEDIAKEYS_BACKGROUND_LONGTEXT,
false )
add_submodule ()
set_description( "Mac OS X OpenGL" )
......
......@@ -91,6 +91,7 @@
IBOutlet id o_intf_fspanel_ckb;
IBOutlet id o_intf_appleremote_ckb;
IBOutlet id o_intf_mediakeys_ckb;
IBOutlet id o_intf_mediakeys_bg_ckb;
IBOutlet id o_intf_lang_pop;
IBOutlet id o_intf_lang_txt;
IBOutlet id o_intf_network_box;
......
......@@ -265,6 +265,7 @@ create_toolbar_item( NSString * o_itemIdent, NSString * o_name, NSString * o_des
[o_intf_network_box setTitle: _NS("Privacy / Network Interaction")];
[o_intf_appleremote_ckb setTitle: _NS("Control playback with the Apple Remote")];
[o_intf_mediakeys_ckb setTitle: _NS("Control playback with media keys")];
[o_intf_mediakeys_bg_ckb setTitle: _NS("...when VLC is in background")];
/* Subtitles and OSD */
[o_osd_encoding_txt setStringValue: _NS("Default Encoding")];
......@@ -451,6 +452,8 @@ static inline char * __config_GetLabel( vlc_object_t *p_this, const char *psz_na
[self setupButton: o_intf_embedded_ckb forBoolValue: "embedded-video"];
[self setupButton: o_intf_appleremote_ckb forBoolValue: "macosx-appleremote"];
[self setupButton: o_intf_mediakeys_ckb forBoolValue: "macosx-mediakeys"];
[self setupButton: o_intf_mediakeys_bg_ckb forBoolValue: "macosx-mediakeys-background"];
[o_intf_mediakeys_bg_ckb setEnabled: [o_intf_mediakeys_ckb state]];
/******************
* audio settings *
......@@ -779,6 +782,7 @@ static inline void save_module_list( intf_thread_t * p_intf, id object, const ch
config_PutInt( p_intf, "embedded-video", [o_intf_embedded_ckb state] );
config_PutInt( p_intf, "macosx-appleremote", [o_intf_appleremote_ckb state] );
config_PutInt( p_intf, "macosx-mediakeys", [o_intf_mediakeys_ckb state] );
config_PutInt( p_intf, "macosx-mediakeys-background", [o_intf_mediakeys_bg_ckb state] );
/* activate stuff without restart */
if( [o_intf_appleremote_ckb state] == YES )
......@@ -1079,6 +1083,8 @@ static inline void save_module_list( intf_thread_t * p_intf, id object, const ch
- (IBAction)interfaceSettingChanged:(id)sender
{
if( sender == o_intf_mediakeys_ckb )
[o_intf_mediakeys_bg_ckb setEnabled: [o_intf_mediakeys_ckb state]];
b_intfSettingChanged = YES;
}
......
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