File tree Expand file tree Collapse file tree 4 files changed +40
-2
lines changed Expand file tree Collapse file tree 4 files changed +40
-2
lines changed Original file line number Diff line number Diff line change @@ -13,9 +13,13 @@ namespace qs::wayland::idle_inhibit {
1313using QtWaylandClient::QWaylandWindow;
1414
1515IdleInhibitor::IdleInhibitor () {
16- this ->bBoundWindow .setBinding ([this ] { return this ->bEnabled ? this ->bWindowObject .value () : nullptr ; });
16+ this ->bBoundWindow .setBinding ([this ] {
17+ return this ->bEnabled ? this ->bWindowObject .value () : nullptr ;
18+ });
1719}
1820
21+ IdleInhibitor::~IdleInhibitor () { delete this ->inhibitor ; }
22+
1923QObject* IdleInhibitor::window () const { return this ->bWindowObject ; }
2024
2125void IdleInhibitor::setWindow (QObject* window) {
Original file line number Diff line number Diff line change 33#include < qobject.h>
44#include < qproperty.h>
55#include < qqmlintegration.h>
6+ #include < qtclasshelpermacros.h>
67#include < qtmetamacros.h>
78
89#include " ../../window/proxywindow.hpp"
@@ -38,6 +39,8 @@ class IdleInhibitor: public QObject {
3839
3940public:
4041 IdleInhibitor ();
42+ ~IdleInhibitor () override ;
43+ Q_DISABLE_COPY_MOVE (IdleInhibitor);
4144
4245 [[nodiscard]] QObject* window () const ;
4346 void setWindow (QObject* window);
Original file line number Diff line number Diff line change 11#include " proto.hpp"
22
33#include < private/qwaylandwindow_p.h>
4+ #include < qlogging.h>
5+ #include < qloggingcategory.h>
46#include < qwaylandclientextension.h>
57
8+ #include " ../../core/logcat.hpp"
9+
610namespace qs ::wayland::idle_inhibit::impl {
711
12+ namespace {
13+ QS_LOGGING_CATEGORY (logIdleInhibit, " quickshell.wayland.idle_inhibit" , QtWarningMsg);
14+ }
15+
816IdleInhibitManager::IdleInhibitManager (): QWaylandClientExtensionTemplate(1 ) { this ->initialize (); }
917
1018IdleInhibitManager* IdleInhibitManager::instance () {
@@ -13,10 +21,13 @@ IdleInhibitManager* IdleInhibitManager::instance() {
1321}
1422
1523IdleInhibitor* IdleInhibitManager::createIdleInhibitor (QtWaylandClient::QWaylandWindow* surface) {
16- return new IdleInhibitor (this ->create_inhibitor (surface->surface ()));
24+ auto * inhibitor = new IdleInhibitor (this ->create_inhibitor (surface->surface ()));
25+ qCDebug (logIdleInhibit) << " Created inhibitor" << inhibitor;
26+ return inhibitor;
1727}
1828
1929IdleInhibitor::~IdleInhibitor () {
30+ qCDebug (logIdleInhibit) << " Destroyed inhibitor" << this ;
2031 if (this ->isInitialized ()) this ->destroy ();
2132}
2233
Original file line number Diff line number Diff line change 1+ import QtQuick
2+ import QtQuick.Controls
3+ import Quickshell
4+ import Quickshell.Wayland
5+
6+ FloatingWindow {
7+ id: root
8+ color: contentItem .palette .window
9+
10+ CheckBox {
11+ id: enableCb
12+ anchors .centerIn : parent
13+ text: " Enable Inhibitor"
14+ }
15+
16+ IdleInhibitor {
17+ window : root
18+ enabled: enableCb .checked
19+ }
20+ }
You can’t perform that action at this time.
0 commit comments