wayland/idle-inhibit: add idle inhibitor

This commit is contained in:
outfoxxed 2025-08-27 02:30:16 -07:00
parent a5431dd02d
commit b8625aa098
No known key found for this signature in database
GPG key ID: 4C88A185FB89301E
8 changed files with 377 additions and 0 deletions

View file

@ -0,0 +1,23 @@
#include "proto.hpp"
#include <private/qwaylandwindow_p.h>
#include <qwaylandclientextension.h>
namespace qs::wayland::idle_inhibit::impl {
IdleInhibitManager::IdleInhibitManager(): QWaylandClientExtensionTemplate(1) { this->initialize(); }
IdleInhibitManager* IdleInhibitManager::instance() {
static auto* instance = new IdleInhibitManager(); // NOLINT
return instance->isInitialized() ? instance : nullptr;
}
IdleInhibitor* IdleInhibitManager::createIdleInhibitor(QtWaylandClient::QWaylandWindow* surface) {
return new IdleInhibitor(this->create_inhibitor(surface->surface()));
}
IdleInhibitor::~IdleInhibitor() {
if (this->isInitialized()) this->destroy();
}
} // namespace qs::wayland::idle_inhibit::impl