]> git.sesse.net Git - vlc/commitdiff
macosx: allow the user to sleep his/her Mac using the Apple Remote using the designat...
authorFelix Paul Kühne <fkuehne@videolan.org>
Fri, 18 May 2012 15:52:02 +0000 (17:52 +0200)
committerFelix Paul Kühne <fkuehne@videolan.org>
Fri, 18 May 2012 15:52:02 +0000 (17:52 +0200)
This code uses NSAppleScript. Hence, it is likely going to be incompatible with the current sandbox implementation.

modules/gui/macosx/intf.m

index f7e36d751283fbe11ef23fb0713b6fef958929c3..32b129aba7deb24ca1784d3fa575836b9bdf46cd 100644 (file)
@@ -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;