Commit 58841098 authored by Felix Paul Kühne's avatar Felix Paul Kühne

macosx: compilation fix for 10.5 and 10.6

parent 3f82ec23
...@@ -80,13 +80,6 @@ extern OSErr UpdateSystemActivity(UInt8 activity); ...@@ -80,13 +80,6 @@ extern OSErr UpdateSystemActivity(UInt8 activity);
- (NSArray *)pathComponents; - (NSArray *)pathComponents;
@end @end
IOReturn IOPMAssertionCreateWithName( CFStringRef AssertionType,
IOPMAssertionLevel AssertionLevel,
CFStringRef AssertionName,
IOPMAssertionID *AssertionID );
#define kIOPMAssertionTypePreventUserIdleDisplaySleep CFSTR("PreventUserIdleDisplaySleep");
#define kIOPMAssertionTypePreventUserIdleSystemSleep CFSTR("PreventUserIdleSystemSleep");
#endif #endif
#pragma mark - #pragma mark -
...@@ -116,4 +109,7 @@ enum { ...@@ -116,4 +109,7 @@ enum {
- (BOOL)isDirectionInvertedFromDevice; - (BOOL)isDirectionInvertedFromDevice;
@end @end
#define kIOPMAssertionTypePreventUserIdleDisplaySleep CFSTR("PreventUserIdleDisplaySleep")
#define kIOPMAssertionTypePreventUserIdleSystemSleep CFSTR("PreventUserIdleSystemSleep")
#endif #endif
...@@ -1598,8 +1598,9 @@ unsigned int CocoaKeyToVLC( unichar i_key ) ...@@ -1598,8 +1598,9 @@ unsigned int CocoaKeyToVLC( unichar i_key )
systemSleepAssertionID = 0; systemSleepAssertionID = 0;
} }
#ifdef __x86_64__
/* prevent the system from sleeping using the 10.5 API to be as compatible as possible */ /* prevent the system from sleeping using the 10.5 API to be as compatible as possible */
/* work-around a bug in 10.7.4 and 10.7.5, so check for 10.7.x < 10.7.4, 10.8 and 10.6 */ /* work-around a bug in 10.7.4 and 10.7.5, so check for 10.7.x < 10.7.4 and 10.8 */
if ((NSAppKitVersionNumber >= 1115.2 && NSAppKitVersionNumber < 1138.45) || OSX_MOUNTAIN_LION) { if ((NSAppKitVersionNumber >= 1115.2 && NSAppKitVersionNumber < 1138.45) || OSX_MOUNTAIN_LION) {
CFStringRef reasonForActivity= CFStringCreateWithCString(kCFAllocatorDefault, "VLC media playback", kCFStringEncodingUTF8); CFStringRef reasonForActivity= CFStringCreateWithCString(kCFAllocatorDefault, "VLC media playback", kCFStringEncodingUTF8);
if ([self activeVideoPlayback]) { if ([self activeVideoPlayback]) {
...@@ -1611,12 +1612,15 @@ unsigned int CocoaKeyToVLC( unichar i_key ) ...@@ -1611,12 +1612,15 @@ unsigned int CocoaKeyToVLC( unichar i_key )
} }
CFRelease(reasonForActivity); CFRelease(reasonForActivity);
} else { } else {
/* fall-back on the 10.5 mode, which also works on 10.7.4 and 10.7.5 */ #endif
/* fall-back on the 10.5 mode, which also works on 10.6, 10.7.4 and 10.7.5 */
if ([self activeVideoPlayback]) if ([self activeVideoPlayback])
success = IOPMAssertionCreate(kIOPMAssertionTypeNoDisplaySleep, kIOPMAssertionLevelOn, &systemSleepAssertionID); success = IOPMAssertionCreate(kIOPMAssertionTypeNoDisplaySleep, kIOPMAssertionLevelOn, &systemSleepAssertionID);
else else
success = IOPMAssertionCreate(kIOPMAssertionTypeNoIdleSleep, kIOPMAssertionLevelOn, &systemSleepAssertionID); success = IOPMAssertionCreate(kIOPMAssertionTypeNoIdleSleep, kIOPMAssertionLevelOn, &systemSleepAssertionID);
#ifdef __x86_64__
} }
#endif
if (success == kIOReturnSuccess) if (success == kIOReturnSuccess)
msg_Dbg( VLCIntf, "prevented sleep through IOKit (%i)", systemSleepAssertionID); msg_Dbg( VLCIntf, "prevented sleep through IOKit (%i)", systemSleepAssertionID);
......
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