vlc | branch: master | David Fuhrmann <dfuhrm...@videolan.org> | Sun Sep 3 10:14:41 2017 +0200| [8e2c6ccc072358405187386e75028513676d294c] | committer: David Fuhrmann
macosx: Inhibit: Remove 10.7 code, only release assertions once The new API works on 10.7 as well, the only difference between newer macOS versions is reuse of the assertion identifiers. Releasing the assertion ids only once fixes inhibit on 10.7. > http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=8e2c6ccc072358405187386e75028513676d294c --- modules/gui/macosx/VLCInputManager.m | 23 ++++++++--------------- 1 file changed, 8 insertions(+), 15 deletions(-) diff --git a/modules/gui/macosx/VLCInputManager.m b/modules/gui/macosx/VLCInputManager.m index fba66e4e7e..52aaf36867 100644 --- a/modules/gui/macosx/VLCInputManager.m +++ b/modules/gui/macosx/VLCInputManager.m @@ -295,24 +295,16 @@ static int InputEvent(vlc_object_t *p_this, const char *psz_var, if (systemSleepAssertionID > 0) { msg_Dbg(getIntf(), "releasing old sleep blocker (%i)" , systemSleepAssertionID); IOPMAssertionRelease(systemSleepAssertionID); + systemSleepAssertionID = 0; } IOReturn success; - /* work-around a bug for OSX Lion, 10.7.4 and 10.7.5 only */ - if (NSAppKitVersionNumber >= 1138.45 && !OSX_MOUNTAIN_LION_AND_HIGHER) { - /* fall-back on the 10.5 mode, which also works on 10.7.4 and 10.7.5 */ - if ([o_main activeVideoPlayback] && shouldDisableScreensaver) - success = IOPMAssertionCreate(kIOPMAssertionTypeNoDisplaySleep, kIOPMAssertionLevelOn, &systemSleepAssertionID); - else - success = IOPMAssertionCreate(kIOPMAssertionTypeNoIdleSleep, kIOPMAssertionLevelOn, &systemSleepAssertionID); - } else { - CFStringRef reasonForActivity = CFStringCreateWithCString(kCFAllocatorDefault, _("VLC media playback"), kCFStringEncodingUTF8); - if ([o_main activeVideoPlayback] && shouldDisableScreensaver) - success = IOPMAssertionCreateWithName(kIOPMAssertionTypeNoDisplaySleep, kIOPMAssertionLevelOn, reasonForActivity, &systemSleepAssertionID); - else - success = IOPMAssertionCreateWithName(kIOPMAssertionTypeNoIdleSleep, kIOPMAssertionLevelOn, reasonForActivity, &systemSleepAssertionID); - CFRelease(reasonForActivity); - } + CFStringRef reasonForActivity = CFStringCreateWithCString(kCFAllocatorDefault, _("VLC media playback"), kCFStringEncodingUTF8); + if ([o_main activeVideoPlayback] && shouldDisableScreensaver) + success = IOPMAssertionCreateWithName(kIOPMAssertionTypeNoDisplaySleep, kIOPMAssertionLevelOn, reasonForActivity, &systemSleepAssertionID); + else + success = IOPMAssertionCreateWithName(kIOPMAssertionTypeNoIdleSleep, kIOPMAssertionLevelOn, reasonForActivity, &systemSleepAssertionID); + CFRelease(reasonForActivity); if (success == kIOReturnSuccess) msg_Dbg(getIntf(), "prevented sleep through IOKit (%i)", systemSleepAssertionID); @@ -330,6 +322,7 @@ static int InputEvent(vlc_object_t *p_this, const char *psz_var, if (systemSleepAssertionID > 0) { msg_Dbg(getIntf(), "releasing sleep blocker (%i)" , systemSleepAssertionID); IOPMAssertionRelease(systemSleepAssertionID); + systemSleepAssertionID = 0; } if (state == END_S || state == -1) { _______________________________________________ vlc-commits mailing list vlc-commits@videolan.org https://mailman.videolan.org/listinfo/vlc-commits