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 {
13
13
using QtWaylandClient::QWaylandWindow;
14
14
15
15
IdleInhibitor::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
+ });
17
19
}
18
20
21
+ IdleInhibitor::~IdleInhibitor () { delete this ->inhibitor ; }
22
+
19
23
QObject* IdleInhibitor::window () const { return this ->bWindowObject ; }
20
24
21
25
void IdleInhibitor::setWindow (QObject* window) {
Original file line number Diff line number Diff line change 3
3
#include < qobject.h>
4
4
#include < qproperty.h>
5
5
#include < qqmlintegration.h>
6
+ #include < qtclasshelpermacros.h>
6
7
#include < qtmetamacros.h>
7
8
8
9
#include " ../../window/proxywindow.hpp"
@@ -38,6 +39,8 @@ class IdleInhibitor: public QObject {
38
39
39
40
public:
40
41
IdleInhibitor ();
42
+ ~IdleInhibitor () override ;
43
+ Q_DISABLE_COPY_MOVE (IdleInhibitor);
41
44
42
45
[[nodiscard]] QObject* window () const ;
43
46
void setWindow (QObject* window);
Original file line number Diff line number Diff line change 1
1
#include " proto.hpp"
2
2
3
3
#include < private/qwaylandwindow_p.h>
4
+ #include < qlogging.h>
5
+ #include < qloggingcategory.h>
4
6
#include < qwaylandclientextension.h>
5
7
8
+ #include " ../../core/logcat.hpp"
9
+
6
10
namespace qs ::wayland::idle_inhibit::impl {
7
11
12
+ namespace {
13
+ QS_LOGGING_CATEGORY (logIdleInhibit, " quickshell.wayland.idle_inhibit" , QtWarningMsg);
14
+ }
15
+
8
16
IdleInhibitManager::IdleInhibitManager (): QWaylandClientExtensionTemplate(1 ) { this ->initialize (); }
9
17
10
18
IdleInhibitManager* IdleInhibitManager::instance () {
@@ -13,10 +21,13 @@ IdleInhibitManager* IdleInhibitManager::instance() {
13
21
}
14
22
15
23
IdleInhibitor* 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;
17
27
}
18
28
19
29
IdleInhibitor::~IdleInhibitor () {
30
+ qCDebug (logIdleInhibit) << " Destroyed inhibitor" << this ;
20
31
if (this ->isInitialized ()) this ->destroy ();
21
32
}
22
33
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