summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStefano Pigozzi <stefano.pigozzi@gmail.com>2014-10-17 17:07:01 +0200
committerStefano Pigozzi <stefano.pigozzi@gmail.com>2014-10-17 19:16:58 +0200
commit49b6fa877938e9f53ca905467975ef580d3a4ab2 (patch)
tree48eb7c87d6233473c94b148946fecd5bea103d4c
parenta0acb6eaa7bba1abf0ab1c21e3661c5c1fff4481 (diff)
downloadmpv-49b6fa877938e9f53ca905467975ef580d3a4ab2.tar.bz2
mpv-49b6fa877938e9f53ca905467975ef580d3a4ab2.tar.xz
cocoa: allow to disable apple remote at compile time
Actually doesn't remove the related flags so that one can still pass the option with the option doing nothing.
-rw-r--r--osdep/macosx_events.m9
-rw-r--r--wscript5
-rw-r--r--wscript_build.py2
3 files changed, 15 insertions, 1 deletions
diff --git a/osdep/macosx_events.m b/osdep/macosx_events.m
index f913b5db1a..7d0302114b 100644
--- a/osdep/macosx_events.m
+++ b/osdep/macosx_events.m
@@ -35,12 +35,16 @@
#include "osdep/macosx_compat.h"
#import "osdep/macosx_events_objc.h"
+#include "config.h"
+
@interface EventsResponder ()
{
struct input_ctx *_inputContext;
NSCondition *_input_ready;
CFMachPortRef _mk_tap_port;
+#if HAVE_APPLE_REMOTE
HIDRemote *_remote;
+#endif
}
- (BOOL)handleMediaKey:(NSEvent *)event;
@@ -270,6 +274,8 @@ void cocoa_set_input_context(struct input_ctx *input_context)
- (void)startAppleRemote
{
+
+#if HAVE_APPLE_REMOTE
dispatch_async(dispatch_get_main_queue(), ^{
self->_remote = [[HIDRemote alloc] init];
if (self->_remote) {
@@ -277,14 +283,17 @@ void cocoa_set_input_context(struct input_ctx *input_context)
[self->_remote startRemoteControl:kHIDRemoteModeExclusiveAuto];
}
});
+#endif
}
- (void)stopAppleRemote
{
+#if HAVE_APPLE_REMOTE
dispatch_async(dispatch_get_main_queue(), ^{
[self->_remote stopRemoteControl];
[self->_remote release];
});
+#endif
}
- (void)restartMediaKeys
{
diff --git a/wscript b/wscript
index 881333f675..e1e5fa4dab 100644
--- a/wscript
+++ b/wscript
@@ -756,6 +756,11 @@ standalone_features = [
'deps_neg': [ 'libmpv-shared', 'libmpv-static' ],
'func': check_true
}, {
+ 'name': '--apple-remote',
+ 'desc': 'Apple Remote support',
+ 'deps': [ 'cocoa' ],
+ 'func': check_true
+ }, {
'name': '--macosx-bundle',
'desc': 'compilation of a Mac OS X Application bundle',
'deps': [ 'os-darwin' ],
diff --git a/wscript_build.py b/wscript_build.py
index 3f2cc68ffc..bb699764df 100644
--- a/wscript_build.py
+++ b/wscript_build.py
@@ -382,7 +382,7 @@ def build(ctx):
( timer_c ),
( "osdep/threads.c" ),
- ( "osdep/ar/HIDRemote.m", "cocoa" ),
+ ( "osdep/ar/HIDRemote.m", "apple-remote" ),
( "osdep/macosx_application.m", "cocoa-application" ),
( "osdep/macosx_events.m", "cocoa" ),
( "osdep/semaphore_osx.c" ),