Debian Codegraph @

xbmc/windowing/osx/OSScreenSaverOSX.cpp

raw
1 /*
2 * Copyright (C) 2017-2018 Team Kodi
3 * This file is part of Kodi - https://kodi.tv
4 *
5 * SPDX-License-Identifier: GPL-2.0-or-later
6 * See LICENSES/README.md for more information.
7 */
8
9 #include "OSScreenSaverOSX.h"
10
11 #include <CoreFoundation/CoreFoundation.h>
12
13 void COSScreenSaverOSX::Inhibit()
14 {
15 // see Technical Q&A QA1340
16 if (m_assertionID == 0)
17 {
18 CFStringRef reasonForActivity= CFSTR("XBMC requested disable system screen saver");
19 IOPMAssertionCreateWithName(kIOPMAssertionTypeNoDisplaySleep,
20 kIOPMAssertionLevelOn, reasonForActivity, &m_assertionID);
21 }
22 }
23
24 void COSScreenSaverOSX::Uninhibit()
25 {
26 if (m_assertionID != 0)
27 {
28 IOPMAssertionRelease(m_assertionID);
29 m_assertionID = 0;
30 }
31 }