diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-10 18:07:22 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-10 18:07:22 +0000 |
commit | c04dcc2e7d834218ef2d4194331e383402495ae1 (patch) | |
tree | 7333e38d10d75386e60f336b80c2443c1166031d /xbmc/powermanagement/DPMSSupport.h | |
parent | Initial commit. (diff) | |
download | kodi-c04dcc2e7d834218ef2d4194331e383402495ae1.tar.xz kodi-c04dcc2e7d834218ef2d4194331e383402495ae1.zip |
Adding upstream version 2:20.4+dfsg.upstream/2%20.4+dfsg
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'xbmc/powermanagement/DPMSSupport.h')
-rw-r--r-- | xbmc/powermanagement/DPMSSupport.h | 56 |
1 files changed, 56 insertions, 0 deletions
diff --git a/xbmc/powermanagement/DPMSSupport.h b/xbmc/powermanagement/DPMSSupport.h new file mode 100644 index 0000000..cf10b4c --- /dev/null +++ b/xbmc/powermanagement/DPMSSupport.h @@ -0,0 +1,56 @@ +/* + * Copyright (C) 2009-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. + */ + +#pragma once + +#include <vector> + +// This class encapsulates support for monitor power-saving features (DPMS). +// An instance is connected to a Surface, provides information on which +// power-saving features are available for that screen, and it is able to +// turn power-saving on an off. +// Note that SDL turns off DPMS timeouts at the beginning of the application. +class CDPMSSupport +{ +public: + // All known DPMS power-saving modes, on any platform. + enum PowerSavingMode + { + STANDBY, + SUSPEND, + OFF, + NUM_MODES, + }; + + CDPMSSupport(); + virtual ~CDPMSSupport() = default; + + // Whether power-saving is supported on this screen. + bool IsSupported() const { return !m_supportedModes.empty(); } + + // Which power-saving modes are supported, in the order of preference (i.e. + // the first mode should be the best choice). + const std::vector<PowerSavingMode>& GetSupportedModes() const + { + return m_supportedModes; + } + + // Whether a given mode is supported. + bool IsModeSupported(PowerSavingMode mode) const; + + // Turns on the specified power-saving mode, which must be valid + // and supported. Returns false if this failed. + virtual bool EnablePowerSaving(PowerSavingMode mode) = 0; + + // Turns off power-saving mode. You should only call this if the display + // is currently in a power-saving mode, to avoid visual artifacts. + virtual bool DisablePowerSaving() = 0; + +protected: + std::vector<PowerSavingMode> m_supportedModes; +}; |