[vlc-commits] macosx: allow the user to sleep his/ her Mac using the Apple Remote using the designated AR event (close #4383)
Felix Paul Kühne
git at videolan.org
Fri May 18 17:56:23 CEST 2012
vlc/vlc-2.0 | branch: master | Felix Paul Kühne <fkuehne at videolan.org> | Fri May 18 17:52:02 2012 +0200| [49fad7ae9029bfd2384af242a821a3a58954eadd] | committer: Felix Paul Kühne
macosx: allow the user to sleep his/her Mac using the Apple Remote using the designated AR event (close #4383)
This code uses NSAppleScript. Hence, it is likely going to be incompatible with the current sandbox implementation.
(cherry picked from commit 9a73999a1f22b13051da16feaf54d8dd02e5bc80)
> http://git.videolan.org/gitweb.cgi/vlc/vlc-2.0.git/?a=commit;h=49fad7ae9029bfd2384af242a821a3a58954eadd
---
NEWS | 2 ++
modules/gui/macosx/intf.m | 15 +++++++++++----
2 files changed, 13 insertions(+), 4 deletions(-)
diff --git a/NEWS b/NEWS
index 3373033..4b238f1 100644
--- a/NEWS
+++ b/NEWS
@@ -51,6 +51,8 @@ Mac OS X:
* Added media key support for keyboards by other manufacturers than Apple
This fix was facilitated through a hardware donation by ZF Friedrichshafen AG
manufacturing keyboards under the brand "Cherry".
+ * Added support for the Apple Remote to set the Mac to sleep using a longer
+ press on the Play/Pause button
* Improved compatibility with other 3rd party apps using SPMediaKeyTap
* Fullscreen fixes
* Keep Aspect Ratio when resizing is back
diff --git a/modules/gui/macosx/intf.m b/modules/gui/macosx/intf.m
index f4c55dd..8ccfa75 100644
--- a/modules/gui/macosx/intf.m
+++ b/modules/gui/macosx/intf.m
@@ -954,16 +954,16 @@ static VLCMain *_o_sharedMainInstance = nil;
{
case kRemoteButtonRight_Hold:
[[VLCCoreInteraction sharedInstance] forward];
- break;
+ break;
case kRemoteButtonLeft_Hold:
[[VLCCoreInteraction sharedInstance] backward];
- break;
+ break;
case kRemoteButtonVolume_Plus_Hold:
[[VLCCoreInteraction sharedInstance] volumeUp];
- break;
+ break;
case kRemoteButtonVolume_Minus_Hold:
[[VLCCoreInteraction sharedInstance] volumeDown];
- break;
+ break;
}
if(b_remote_button_hold)
{
@@ -1023,6 +1023,13 @@ static VLCMain *_o_sharedMainInstance = nil;
case kRemoteButtonMenu:
[o_controls showPosition: self]; //FIXME
break;
+ case kRemoteButtonPlay_Sleep:
+ {
+ NSAppleScript * script = [[NSAppleScript alloc] initWithSource:@"tell application \"System Events\" to sleep"];
+ [script executeAndReturnError:nil];
+ [script release];
+ break;
+ }
default:
/* Add here whatever you want other buttons to do */
break;
More information about the vlc-commits
mailing list