2020-08-02 22:22:19 +00:00
|
|
|
/*
|
|
|
|
KWin - the KDE window manager
|
|
|
|
This file is part of the KDE project.
|
2015-11-06 11:57:24 +00:00
|
|
|
|
2020-08-02 22:22:19 +00:00
|
|
|
SPDX-FileCopyrightText: 2015 Martin Gräßlin <mgraesslin@kde.org>
|
2015-11-06 11:57:24 +00:00
|
|
|
|
2020-08-02 22:22:19 +00:00
|
|
|
SPDX-License-Identifier: GPL-2.0-or-later
|
|
|
|
*/
|
2015-11-06 11:57:24 +00:00
|
|
|
#ifndef POLLER_H
|
|
|
|
#define POLLER_H
|
|
|
|
|
|
|
|
#include <KIdleTime/private/abstractsystempoller.h>
|
|
|
|
|
|
|
|
#include <QHash>
|
|
|
|
|
|
|
|
namespace KWayland
|
|
|
|
{
|
|
|
|
namespace Client
|
|
|
|
{
|
|
|
|
class Seat;
|
|
|
|
class Idle;
|
|
|
|
class IdleTimeout;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-11-21 10:36:49 +00:00
|
|
|
class KWinIdleTimePoller : public AbstractSystemPoller
|
2015-11-06 11:57:24 +00:00
|
|
|
{
|
|
|
|
Q_OBJECT
|
2020-11-21 10:36:49 +00:00
|
|
|
Q_PLUGIN_METADATA(IID AbstractSystemPoller_iid FILE "kwin.json")
|
2015-11-06 11:57:24 +00:00
|
|
|
Q_INTERFACES(AbstractSystemPoller)
|
|
|
|
|
|
|
|
public:
|
2020-11-21 10:36:49 +00:00
|
|
|
KWinIdleTimePoller(QObject *parent = nullptr);
|
|
|
|
~KWinIdleTimePoller() override;
|
2015-11-06 11:57:24 +00:00
|
|
|
|
|
|
|
bool isAvailable() override;
|
|
|
|
bool setUpPoller() override;
|
|
|
|
void unloadPoller() override;
|
|
|
|
|
|
|
|
public Q_SLOTS:
|
|
|
|
void addTimeout(int nextTimeout) override;
|
|
|
|
void removeTimeout(int nextTimeout) override;
|
|
|
|
QList<int> timeouts() const override;
|
|
|
|
int forcePollRequest() override;
|
|
|
|
void catchIdleEvent() override;
|
|
|
|
void stopCatchingIdleEvents() override;
|
|
|
|
void simulateUserActivity() override;
|
|
|
|
|
|
|
|
private:
|
|
|
|
KWayland::Client::Seat *m_seat = nullptr;
|
|
|
|
KWayland::Client::Idle *m_idle = nullptr;
|
|
|
|
KWayland::Client::IdleTimeout *m_catchResumeTimeout = nullptr;
|
|
|
|
QHash<int, KWayland::Client::IdleTimeout*> m_timeouts;
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|