chore: rename XWindowsPowerManager => XDGPowerManager

fixes: 8949
This commit is contained in:
sithlord48
2025-09-12 11:22:42 -04:00
committed by Nick Bolton
parent 4632bec405
commit 612ca91f9c
5 changed files with 22 additions and 23 deletions

View File

@ -96,6 +96,8 @@ elseif(APPLE)
)
elseif(UNIX)
set(PLATFORM_SOURCES
XDGPowerManager.cpp
XDGPowerManager.h
XWindowsClipboard.cpp
XWindowsClipboard.h
XWindowsClipboardAnyBitmapConverter.cpp
@ -114,8 +116,6 @@ elseif(UNIX)
XWindowsEventQueueBuffer.h
XWindowsKeyState.cpp
XWindowsKeyState.h
XWindowsPowerManager.cpp
XWindowsPowerManager.h
XWindowsScreen.cpp
XWindowsScreen.h
XWindowsScreenSaver.cpp

View File

@ -9,7 +9,7 @@
#include "deskflow/KeyMap.h"
#include "deskflow/PlatformScreen.h"
#include "platform/XWindowsPowerManager.h"
#include "platform/XDGPowerManager.h"
#include <libei.h>
#include <memory>
@ -189,8 +189,7 @@ private:
using HotKeyMap = std::map<KeyID, HotKeySet>;
HotKeyMap m_hotkeys;
// Despite the name XWindowsPowerManager, this works on Wayland too
XWindowsPowerManager m_powerManager;
XDGPowerManager m_powerManager;
};
} // namespace deskflow

View File

@ -5,7 +5,7 @@
* SPDX-License-Identifier: GPL-2.0-only WITH LicenseRef-OpenSSL-Exception
*/
#include "XWindowsPowerManager.h"
#include "XDGPowerManager.h"
#include "arch/Arch.h"
#include "base/Log.h"
#include "common/Constants.h"
@ -17,9 +17,9 @@
namespace {
bool sleepInhibitCall(bool state, XWindowsPowerManager::InhibitScreenServices serviceID)
bool sleepInhibitCall(bool state, XDGPowerManager::InhibitScreenServices serviceID)
{
if (std::string error; !XWindowsPowerManager::inhibitScreenCall(serviceID, state, error)) {
if (std::string error; !XDGPowerManager::inhibitScreenCall(serviceID, state, error)) {
LOG_DEBUG("dbus inhibit error %s", error.c_str());
return false;
}
@ -29,28 +29,28 @@ bool sleepInhibitCall(bool state, XWindowsPowerManager::InhibitScreenServices se
} // namespace
XWindowsPowerManager::~XWindowsPowerManager()
XDGPowerManager::~XDGPowerManager()
{
enableSleep();
}
void XWindowsPowerManager::disableSleep() const
void XDGPowerManager::disableSleep() const
{
if (!sleepInhibitCall(true, XWindowsPowerManager::InhibitScreenServices::kScreenSaver) &&
!sleepInhibitCall(true, XWindowsPowerManager::InhibitScreenServices::kSessionManager)) {
if (!sleepInhibitCall(true, XDGPowerManager::InhibitScreenServices::kScreenSaver) &&
!sleepInhibitCall(true, XDGPowerManager::InhibitScreenServices::kSessionManager)) {
LOG_WARN("failed to prevent system from going to sleep");
}
}
void XWindowsPowerManager::enableSleep() const
void XDGPowerManager::enableSleep() const
{
if (!sleepInhibitCall(false, XWindowsPowerManager::InhibitScreenServices::kScreenSaver) &&
!sleepInhibitCall(false, XWindowsPowerManager::InhibitScreenServices::kSessionManager)) {
if (!sleepInhibitCall(false, XDGPowerManager::InhibitScreenServices::kScreenSaver) &&
!sleepInhibitCall(false, XDGPowerManager::InhibitScreenServices::kSessionManager)) {
LOG_WARN("failed to enable system idle sleep");
}
}
bool XWindowsPowerManager::inhibitScreenCall(InhibitScreenServices serviceID, bool state, std::string &error)
bool XDGPowerManager::inhibitScreenCall(InhibitScreenServices serviceID, bool state, std::string &error)
{
error = "";
static const std::array<QString, 2> services = {"org.freedesktop.ScreenSaver", "org.gnome.SessionManager"};

View File

@ -9,11 +9,11 @@
#include <string>
class XWindowsPowerManager
class XDGPowerManager
{
public:
XWindowsPowerManager() = default;
~XWindowsPowerManager();
XDGPowerManager() = default;
~XDGPowerManager();
/**
* @brief Prevent the system from sleep
@ -25,8 +25,8 @@ public:
*/
void enableSleep() const;
XWindowsPowerManager(const XWindowsPowerManager &) = delete;
XWindowsPowerManager &operator=(const XWindowsPowerManager &) = delete;
XDGPowerManager(const XDGPowerManager &) = delete;
XDGPowerManager &operator=(const XDGPowerManager &) = delete;
enum class InhibitScreenServices
{

View File

@ -12,7 +12,7 @@
#include "deskflow/ClientArgs.h"
#include "deskflow/KeyMap.h"
#include "deskflow/PlatformScreen.h"
#include "platform/XWindowsPowerManager.h"
#include "platform/XDGPowerManager.h"
#include <set>
#include <vector>
@ -251,5 +251,5 @@ private:
// pointer to (singleton) screen. this is only needed by
// ioErrorHandler().
static XWindowsScreen *s_screen;
XWindowsPowerManager m_powerManager;
XDGPowerManager m_powerManager;
};