Changeset View
Changeset View
Standalone View
Standalone View
idle_inhibition.cpp
Show All 20 Lines | |||||
21 | #include "idle_inhibition.h" | 21 | #include "idle_inhibition.h" | ||
22 | #include "deleted.h" | 22 | #include "deleted.h" | ||
23 | #include "shell_client.h" | 23 | #include "shell_client.h" | ||
24 | #include "workspace.h" | 24 | #include "workspace.h" | ||
25 | 25 | | |||
26 | #include <KWayland/Server/idle_interface.h> | 26 | #include <KWayland/Server/idle_interface.h> | ||
27 | #include <KWayland/Server/surface_interface.h> | 27 | #include <KWayland/Server/surface_interface.h> | ||
28 | 28 | | |||
29 | #include <algorithm> | ||||
29 | #include <functional> | 30 | #include <functional> | ||
30 | 31 | | |||
31 | using KWayland::Server::SurfaceInterface; | 32 | using KWayland::Server::SurfaceInterface; | ||
32 | 33 | | |||
33 | namespace KWin | 34 | namespace KWin | ||
34 | { | 35 | { | ||
35 | 36 | | |||
36 | IdleInhibition::IdleInhibition(IdleInterface *idle) | 37 | IdleInhibition::IdleInhibition(IdleInterface *idle) | ||
Show All 40 Lines | 74 | { | |||
77 | } | 78 | } | ||
78 | m_idleInhibitors << client; | 79 | m_idleInhibitors << client; | ||
79 | m_idle->inhibit(); | 80 | m_idle->inhibit(); | ||
80 | // TODO: notify powerdevil? | 81 | // TODO: notify powerdevil? | ||
81 | } | 82 | } | ||
82 | 83 | | |||
83 | void IdleInhibition::uninhibit(AbstractClient *client) | 84 | void IdleInhibition::uninhibit(AbstractClient *client) | ||
84 | { | 85 | { | ||
85 | auto it = std::find_if(m_idleInhibitors.begin(), m_idleInhibitors.end(), [client] (auto c) { return c == client; }); | 86 | auto it = std::find(m_idleInhibitors.begin(), m_idleInhibitors.end(), client); | ||
86 | if (it == m_idleInhibitors.end()) { | 87 | if (it == m_idleInhibitors.end()) { | ||
87 | // not inhibited | 88 | // not inhibited | ||
88 | return; | 89 | return; | ||
89 | } | 90 | } | ||
90 | m_idleInhibitors.erase(it); | 91 | m_idleInhibitors.erase(it); | ||
91 | m_idle->uninhibit(); | 92 | m_idle->uninhibit(); | ||
92 | } | 93 | } | ||
93 | 94 | | |||
Show All 23 Lines |