Changeset View
Changeset View
Standalone View
Standalone View
idle_inhibition.h
1 | /******************************************************************** | 1 | /******************************************************************** | ||
---|---|---|---|---|---|
2 | KWin - the KDE window manager | 2 | KWin - the KDE window manager | ||
3 | This file is part of the KDE project. | 3 | This file is part of the KDE project. | ||
4 | 4 | | |||
5 | Copyright (C) 2017 Martin Flöser <mgraesslin@kde.org> | 5 | Copyright (C) 2017 Martin Flöser <mgraesslin@kde.org> | ||
6 | Copyright (C) 2018 Vlad Zagorodniy <vladzzag@gmail.com> | ||||
6 | 7 | | |||
7 | This program is free software; you can redistribute it and/or modify | 8 | This program is free software; you can redistribute it and/or modify | ||
8 | it under the terms of the GNU General Public License as published by | 9 | it under the terms of the GNU General Public License as published by | ||
9 | the Free Software Foundation; either version 2 of the License, or | 10 | the Free Software Foundation; either version 2 of the License, or | ||
10 | (at your option) any later version. | 11 | (at your option) any later version. | ||
11 | 12 | | |||
12 | This program is distributed in the hope that it will be useful, | 13 | This program is distributed in the hope that it will be useful, | ||
13 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 14 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
Show All 36 Lines | 46 | public: | |||
50 | 51 | | |||
51 | bool isInhibited() const { | 52 | bool isInhibited() const { | ||
52 | return !m_idleInhibitors.isEmpty(); | 53 | return !m_idleInhibitors.isEmpty(); | ||
53 | } | 54 | } | ||
54 | bool isInhibited(ShellClient *client) const { | 55 | bool isInhibited(ShellClient *client) const { | ||
55 | return std::any_of(m_idleInhibitors.begin(), m_idleInhibitors.end(), [client] (auto c) { return c == client; }); | 56 | return std::any_of(m_idleInhibitors.begin(), m_idleInhibitors.end(), [client] (auto c) { return c == client; }); | ||
56 | } | 57 | } | ||
57 | 58 | | |||
59 | private Q_SLOTS: | ||||
graesslin: You don't need the Q_SLOTS any more with the new connect syntax. | |||||
zzag: Yes, I know, I just prefer to be explicit. | |||||
60 | void slotWorkspaceCreated(); | ||||
61 | void slotDesktopChanged(); | ||||
62 | | ||||
58 | private: | 63 | private: | ||
59 | void inhibit(ShellClient *client); | 64 | void inhibit(ShellClient *client); | ||
60 | void uninhibit(ShellClient *client); | 65 | void uninhibit(ShellClient *client); | ||
66 | void update(ShellClient *client); | ||||
61 | 67 | | |||
62 | IdleInterface *m_idle; | 68 | IdleInterface *m_idle; | ||
63 | QVector<ShellClient*> m_idleInhibitors; | 69 | QVector<ShellClient*> m_idleInhibitors; | ||
64 | QMap<ShellClient*, QMetaObject::Connection> m_connections; | 70 | QMap<ShellClient*, QMetaObject::Connection> m_connections; | ||
65 | }; | 71 | }; | ||
66 | } | 72 | } |
You don't need the Q_SLOTS any more with the new connect syntax.