File indexing completed on 2024-04-28 05:30:17

0001 /*
0002     KWin - the KDE window manager
0003     This file is part of the KDE project.
0004 
0005     SPDX-FileCopyrightText: 2017 Martin Flöser <mgraesslin@kde.org>
0006     SPDX-FileCopyrightText: 2018 Vlad Zahorodnii <vlad.zahorodnii@kde.org>
0007 
0008     SPDX-License-Identifier: GPL-2.0-or-later
0009 */
0010 #pragma once
0011 
0012 #include <QList>
0013 #include <QMap>
0014 #include <QObject>
0015 
0016 namespace KWin
0017 {
0018 class Window;
0019 
0020 class IdleInhibition : public QObject
0021 {
0022     Q_OBJECT
0023 public:
0024     explicit IdleInhibition(QObject *parent = nullptr);
0025     ~IdleInhibition() override;
0026 
0027     void registerClient(Window *client);
0028 
0029 private Q_SLOTS:
0030     void slotWorkspaceCreated();
0031     void slotDesktopChanged();
0032 
0033 private:
0034     void inhibit(Window *client);
0035     void uninhibit(Window *client);
0036     void update(Window *client);
0037 
0038     QMap<Window *, QMetaObject::Connection> m_connections;
0039 };
0040 }