mirror of
https://git.outfoxxed.me/quickshell/quickshell.git
synced 2025-11-04 19:04:56 +11:00
wayland/idle-inhibit: add idle inhibitor
This commit is contained in:
parent
a5431dd02d
commit
b8625aa098
8 changed files with 377 additions and 0 deletions
23
src/wayland/idle_inhibit/proto.cpp
Normal file
23
src/wayland/idle_inhibit/proto.cpp
Normal 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
|
||||
Loading…
Add table
Add a link
Reference in a new issue