KWin
Loading...
Searching...
No Matches
idledetector.h
Go to the documentation of this file.
1/*
2 SPDX-FileCopyrightText: 2021 Vlad Zahorodnii <vlad.zahorodnii@kde.org>
3
4 SPDX-License-Identifier: GPL-2.0-or-later
5*/
6
7#pragma once
8
9#include <kwin_export.h>
10
11#include <QTimer>
12
13namespace KWin
14{
15
16class KWIN_EXPORT IdleDetector : public QObject
17{
18 Q_OBJECT
19
20public:
21 explicit IdleDetector(std::chrono::milliseconds timeout, QObject *parent = nullptr);
22 ~IdleDetector() override;
23
24 void activity();
25
26 bool isInhibited() const;
27 void setInhibited(bool inhibited);
28
29Q_SIGNALS:
30 void idle();
31 void resumed();
32
33private:
34 void markAsIdle();
35 void markAsResumed();
36
37 QTimer *m_timer;
38 bool m_isIdle = false;
39 bool m_isInhibited = false;
40};
41
42} // namespace KWin