[vlc-commits] macosx: respect 'disable-screensaver' option (closes #16670)
Felix Paul Kühne
git at videolan.org
Wed Feb 24 08:55:25 CET 2016
vlc/vlc-2.2 | branch: master | Felix Paul Kühne <fkuehne at videolan.org> | Wed Feb 24 08:55:07 2016 +0100| [e7788b351c53ca9d11e354b24a6466805d64e31b] | committer: Felix Paul Kühne
macosx: respect 'disable-screensaver' option (closes #16670)
Manual backport of e97065eb
> http://git.videolan.org/gitweb.cgi/vlc/vlc-2.2.git/?a=commit;h=e7788b351c53ca9d11e354b24a6466805d64e31b
---
modules/gui/macosx/intf.m | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/modules/gui/macosx/intf.m b/modules/gui/macosx/intf.m
index 5623e07..9f78d16 100644
--- a/modules/gui/macosx/intf.m
+++ b/modules/gui/macosx/intf.m
@@ -1539,11 +1539,13 @@ static bool f_appExit = false;
}
}
+ BOOL shouldDisableScreensaver = var_InheritInteger(p_intf, "disable-screensaver");
+
/* Declare user activity.
This wakes the display if it is off, and postpones display sleep according to the users system preferences
Available from 10.7.3 */
#ifdef MAC_OS_X_VERSION_10_7
- if ([self activeVideoPlayback] && IOPMAssertionDeclareUserActivity)
+ if ([self activeVideoPlayback] && IOPMAssertionDeclareUserActivity && shouldDisableScreensaver)
{
CFStringRef reasonForActivity = CFStringCreateWithCString(kCFAllocatorDefault, _("VLC media playback"), kCFStringEncodingUTF8);
IOPMAssertionDeclareUserActivity(reasonForActivity,
@@ -1563,14 +1565,14 @@ static bool f_appExit = false;
/* 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 */
if ((NSAppKitVersionNumber >= 1115.2 && NSAppKitVersionNumber < 1138.45) || OSX_MOUNTAIN_LION || OSX_MAVERICKS || OSX_YOSEMITE || OSX_EL_CAPITAN || OSX_SNOW_LEOPARD) {
CFStringRef reasonForActivity = CFStringCreateWithCString(kCFAllocatorDefault, _("VLC media playback"), kCFStringEncodingUTF8);
- if ([self activeVideoPlayback])
+ if ([self activeVideoPlayback] && shouldDisableScreensaver)
success = IOPMAssertionCreateWithName(kIOPMAssertionTypeNoDisplaySleep, kIOPMAssertionLevelOn, reasonForActivity, &systemSleepAssertionID);
else
success = IOPMAssertionCreateWithName(kIOPMAssertionTypeNoIdleSleep, kIOPMAssertionLevelOn, reasonForActivity, &systemSleepAssertionID);
CFRelease(reasonForActivity);
} else {
/* fall-back on the 10.5 mode, which also works on 10.7.4 and 10.7.5 */
- if ([self activeVideoPlayback])
+ if ([self activeVideoPlayback] && shouldDisableScreensaver)
success = IOPMAssertionCreate(kIOPMAssertionTypeNoDisplaySleep, kIOPMAssertionLevelOn, &systemSleepAssertionID);
else
success = IOPMAssertionCreate(kIOPMAssertionTypeNoIdleSleep, kIOPMAssertionLevelOn, &systemSleepAssertionID);
More information about the vlc-commits
mailing list