From 4fac71d6978a0500852a16eabd6e40a9122bdb07 Mon Sep 17 00:00:00 2001 From: Vlad Zagorodniy Date: Fri, 11 Jan 2019 15:21:20 +0200 Subject: [PATCH] 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 --- idle_inhibition.cpp | 3 ++- idle_inhibition.h | 4 +--- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/idle_inhibition.cpp b/idle_inhibition.cpp index fa04af713f..30c433fb95 100644 --- a/idle_inhibition.cpp +++ b/idle_inhibition.cpp @@ -26,6 +26,7 @@ along with this program. If not, see . #include #include +#include #include 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; diff --git a/idle_inhibition.h b/idle_inhibition.h index 79e5106df5..a5f310e2b8 100644 --- a/idle_inhibition.h +++ b/idle_inhibition.h @@ -24,8 +24,6 @@ along with this program. If not, see . #include #include -#include - 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: