Members of the KDE Community are recommended to subscribe to the kde-community mailing list at https://mail.kde.org/mailman/listinfo/kde-community to allow them to participate in important discussions and receive other important announcements

Commit 4fac71d6 authored by Vlad Zahorodnii's avatar Vlad Zahorodnii

Use appropriate sequence algorithms in IdleInhibition

Summary: This simplifies code a little bit.

Test Plan: Compiles, existing tests pass.

Reviewers: #kwin, graesslin

Reviewed By: #kwin, graesslin

Subscribers: kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D17353
parent 2e2a4627
......@@ -26,6 +26,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include <KWayland/Server/idle_interface.h>
#include <KWayland/Server/surface_interface.h>
#include <algorithm>
#include <functional>
using KWayland::Server::SurfaceInterface;
......@@ -82,7 +83,7 @@ void IdleInhibition::inhibit(AbstractClient *client)
void IdleInhibition::uninhibit(AbstractClient *client)
{
auto it = std::find_if(m_idleInhibitors.begin(), m_idleInhibitors.end(), [client] (auto c) { return c == client; });
auto it = std::find(m_idleInhibitors.begin(), m_idleInhibitors.end(), client);
if (it == m_idleInhibitors.end()) {
// not inhibited
return;
......
......@@ -24,8 +24,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include <QVector>
#include <QMap>
#include <algorithm>
namespace KWayland
{
namespace Server
......@@ -54,7 +52,7 @@ public:
return !m_idleInhibitors.isEmpty();
}
bool isInhibited(AbstractClient *client) const {
return std::any_of(m_idleInhibitors.begin(), m_idleInhibitors.end(), [client] (auto c) { return c == client; });
return m_idleInhibitors.contains(client);
}
private Q_SLOTS:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment