Commit 47649fbf authored by Felix Paul Kühne's avatar Felix Paul Kühne

macosx: backported the new options to disable Apple Remote and Media Keys support

parent d7bd6ae3
......@@ -353,6 +353,7 @@ struct intf_sys_t
- (id)controllerWindow;
- (id)voutMenu;
- (id)eyeTVController;
- (id)appleRemoteController;
- (void)applicationWillTerminate:(NSNotification *)notification;
- (NSString *)localizedString:(const char *)psz;
- (char *)delocalizeString:(NSString *)psz;
......@@ -424,9 +425,11 @@ struct intf_sys_t
@interface VLCApplication : NSApplication
{
BOOL b_justJumped;
BOOL b_mediaKeySupport;
}
- (void)sendEvent: (NSEvent*)event;
- (void)coreChangedMediaKeySupportSetting: (NSNotification *)o_notification;
//- (void)sendEvent: (NSEvent*)event;
- (void)resetJump;
@end
......@@ -1479,6 +1479,11 @@ static unsigned int VLCModifiersToCocoa( unsigned int i_key )
return nil;
}
- (id)appleRemoteController
{
return o_remote;
}
#pragma mark -
#pragma mark Polling
......@@ -2818,8 +2823,28 @@ end:
@implementation VLCApplication
- (void)awakeFromNib
{
b_mediaKeySupport = config_GetInt( VLCIntf, "macosx-mediakeys" );
[[NSNotificationCenter defaultCenter] addObserver: self selector: @selector(coreChangedMediaKeySupportSetting:) name: @"VLCMediaKeySupportSettingChanged" object: nil];
}
- (void)dealloc
{
[[NSNotificationCenter defaultCenter] removeObserver: self];
[super dealloc];
}
- (void)coreChangedMediaKeySupportSetting: (NSNotification *)o_notification
{
b_mediaKeySupport = config_GetInt( VLCIntf, "macosx-mediakeys" );
}
/*
- (void)sendEvent: (NSEvent*)event
{
if( b_mediaKeySupport )
{
if( [event type] == NSSystemDefined && [event subtype] == 8 )
{
int keyCode = (([event data1] & 0xFFFF0000) >> 16);
......@@ -2862,8 +2887,9 @@ end:
}
}
}
}
[super sendEvent: event];
}
}*/
- (void)resetJump
{
......
......@@ -87,6 +87,13 @@ 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_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_LONGTEXT N_("By default, VLC can be controlled using the media keys on modern Apple " \
"keyboards.")
vlc_module_begin ()
set_description( N_("Mac OS X interface") )
set_capability( "interface", 200 )
......@@ -101,6 +108,10 @@ vlc_module_begin ()
false )
add_bool( "macosx-fspanel", 1, NULL, FSPANEL_TEXT, FSPANEL_LONGTEXT,
false )
add_bool( "macosx-appleremote", 1, NULL, USE_APPLE_REMOTE_TEXT, USE_APPLE_REMOTE_LONGTEXT,
false )
add_bool( "macosx-mediakeys", 1, NULL, USE_MEDIAKEYS_TEXT, USE_MEDIAKEYS_LONGTEXT,
false )
add_submodule ()
set_description( "Mac OS X OpenGL" )
......
/*****************************************************************************
* simple_prefs.h: Simple Preferences for Mac OS X
*****************************************************************************
* Copyright (C) 2008 the VideoLAN team
* Copyright (C) 2008-2009 the VideoLAN team
* $Id$
*
* Authors: Felix Paul Kühne <fkuehne at videolan dot org>
......@@ -89,6 +89,8 @@
IBOutlet id o_intf_art_txt;
IBOutlet id o_intf_embedded_ckb;
IBOutlet id o_intf_fspanel_ckb;
IBOutlet id o_intf_appleremote_ckb;
IBOutlet id o_intf_mediakeys_ckb;
IBOutlet id o_intf_lang_pop;
IBOutlet id o_intf_lang_txt;
IBOutlet id o_intf_network_box;
......
/*****************************************************************************
* simple_prefs.m: Simple Preferences for Mac OS X
*****************************************************************************
* Copyright (C) 2008 the VideoLAN team
* Copyright (C) 2008-2009 the VideoLAN team
* $Id$
*
* Authors: Felix Paul Kühne <fkuehne at videolan dot org>
......@@ -27,6 +27,7 @@
#import <vlc_interface.h>
#import <vlc_dialog.h>
#import "misc.h"
#import "AppleRemote.h"
static NSString* VLCSPrefsToolbarIdentifier = @"Our Simple Preferences Toolbar Identifier";
static NSString* VLCIntfSettingToolbarIdentifier = @"Intf Settings Item Identifier";
......@@ -262,6 +263,8 @@ create_toolbar_item( NSString * o_itemIdent, NSString * o_name, NSString * o_des
[o_intf_fspanel_ckb setTitle: _NS("Show Fullscreen Controller")];
[o_intf_lang_txt setStringValue: _NS("Language")];
[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")];
/* Subtitles and OSD */
[o_osd_encoding_txt setStringValue: _NS("Default Encoding")];
......@@ -413,6 +416,8 @@ create_toolbar_item( NSString * o_itemIdent, NSString * o_name, NSString * o_des
[o_intf_fspanel_ckb setState: config_GetInt( p_intf, "macosx-fspanel" )];
[o_intf_embedded_ckb setState: config_GetInt( p_intf, "embedded-video" )];
[o_intf_appleremote_ckb setState: config_GetInt( p_intf, "macosx-appleremote" )];
[o_intf_mediakeys_ckb setState: config_GetInt( p_intf, "macosx-mediakeys" )];
/******************
* audio settings *
......@@ -610,6 +615,7 @@ create_toolbar_item( NSString * o_itemIdent, NSString * o_name, NSString * o_des
- (void)showSimplePrefs
{
NSAutoreleasePool *o_pool = [[NSAutoreleasePool alloc] init];
/* we want to show the interface settings, if no category was chosen */
if( [[o_sprefs_win toolbar] selectedItemIdentifier] == nil )
{
......@@ -621,6 +627,7 @@ create_toolbar_item( NSString * o_itemIdent, NSString * o_name, NSString * o_des
[o_sprefs_win center];
[o_sprefs_win makeKeyAndOrderFront: self];
[o_pool release];
}
- (IBAction)buttonAction:(id)sender
......@@ -732,6 +739,17 @@ static inline void save_module_list( intf_thread_t * p_intf, id object, const ch
config_PutInt( p_intf, "macosx-fspanel", [o_intf_fspanel_ckb state] );
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] );
/* activate stuff without restart */
if( [o_intf_appleremote_ckb state] == YES )
[[[VLCMain sharedInstance] appleRemoteController] startListening: [VLCMain sharedInstance]];
else
[[[VLCMain sharedInstance] appleRemoteController] stopListening: [VLCMain sharedInstance]];
//[[NSNotificationCenter defaultCenter] postNotificationName: @"VLCMediaKeySupportSettingChanged"
// object: nil
// userInfo: nil];
/* okay, let's save our changes to vlcrc */
i = config_SaveConfigFile( p_intf, "main" );
......
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