[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:52:12 CEST 2012


vlc | branch: master | Felix Paul Kühne <fkuehne at videolan.org> | Fri May 18 17:52:02 2012 +0200| [9a73999a1f22b13051da16feaf54d8dd02e5bc80] | 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.

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=9a73999a1f22b13051da16feaf54d8dd02e5bc80
---

 modules/gui/macosx/intf.m |   15 +++++++++++----
 1 file changed, 11 insertions(+), 4 deletions(-)

diff --git a/modules/gui/macosx/intf.m b/modules/gui/macosx/intf.m
index f7e36d7..32b129a 100644
--- a/modules/gui/macosx/intf.m
+++ b/modules/gui/macosx/intf.m
@@ -960,16 +960,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)
         {
@@ -1029,6 +1029,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