summaryrefslogtreecommitdiffstats
path: root/xbmc/windowing/osx/OSScreenSaverOSX.cpp
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--xbmc/windowing/osx/OSScreenSaverOSX.cpp31
1 files changed, 31 insertions, 0 deletions
diff --git a/xbmc/windowing/osx/OSScreenSaverOSX.cpp b/xbmc/windowing/osx/OSScreenSaverOSX.cpp
new file mode 100644
index 0000000..019f86c
--- /dev/null
+++ b/xbmc/windowing/osx/OSScreenSaverOSX.cpp
@@ -0,0 +1,31 @@
+/*
+ * Copyright (C) 2017-2018 Team Kodi
+ * This file is part of Kodi - https://kodi.tv
+ *
+ * SPDX-License-Identifier: GPL-2.0-or-later
+ * See LICENSES/README.md for more information.
+ */
+
+#include "OSScreenSaverOSX.h"
+
+#include <CoreFoundation/CoreFoundation.h>
+
+void COSScreenSaverOSX::Inhibit()
+{
+ // see Technical Q&A QA1340
+ if (m_assertionID == 0)
+ {
+ CFStringRef reasonForActivity= CFSTR("XBMC requested disable system screen saver");
+ IOPMAssertionCreateWithName(kIOPMAssertionTypeNoDisplaySleep,
+ kIOPMAssertionLevelOn, reasonForActivity, &m_assertionID);
+ }
+}
+
+void COSScreenSaverOSX::Uninhibit()
+{
+ if (m_assertionID != 0)
+ {
+ IOPMAssertionRelease(m_assertionID);
+ m_assertionID = 0;
+ }
+} \ No newline at end of file