[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: [kwin] effects/dimscreen: [effects/dimscreen] Use QSet for checking whether activated window asks fo
From: Vlad Zagorodniy <null () kde ! org>
Date: 2018-06-09 9:27:59
Message-ID: E1fRaAB-0000c1-Ca () code ! kde ! org
[Download RAW message or body]
Git commit 7550d2a02064e7e524945a659b8499ed7a9dc0d6 by Vlad Zagorodniy.
Committed on 09/06/2018 at 09:27.
Pushed by vladz into branch 'master'.
[effects/dimscreen] Use QSet for checking whether activated window asks for permissions
Summary:
Do not construct QStringList with classes of windows that ask for
permissions. Instead, create a static set of those window classes (to
avoid the unnecessary construction of QStringList and make lookups
faster).
Reviewers: #kwin, davidedmundson
Reviewed By: #kwin, davidedmundson
Subscribers: kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D13440
M +11 -7 effects/dimscreen/dimscreen.cpp
https://commits.kde.org/kwin/7550d2a02064e7e524945a659b8499ed7a9dc0d6
diff --git a/effects/dimscreen/dimscreen.cpp b/effects/dimscreen/dimscreen.cpp
index 3b6147c1b..a7f4f7e4d 100644
--- a/effects/dimscreen/dimscreen.cpp
+++ b/effects/dimscreen/dimscreen.cpp
@@ -21,9 +21,19 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include <kwinglutils.h>
+#include <QSet>
+
namespace KWin
{
+static const QSet<QString> s_authWindows {
+ QStringLiteral("kdesu kdesu"),
+ QStringLiteral("kdesudo kdesudo"),
+ QStringLiteral("pinentry pinentry"),
+ QStringLiteral("polkit-kde-authentication-agent-1 polkit-kde-authentication-agent-1"),
+ QStringLiteral("polkit-kde-manager polkit-kde-manager"),
+};
+
DimScreenEffect::DimScreenEffect()
: mActivated(false)
, activateAnimation(false)
@@ -86,13 +96,7 @@ void DimScreenEffect::paintWindow(EffectWindow *w, int mask, QRegion region, Win
void DimScreenEffect::slotWindowActivated(EffectWindow *w)
{
if (!w) return;
- QStringList check;
- check << QStringLiteral("kdesu kdesu");
- check << QStringLiteral("kdesudo kdesudo");
- check << QStringLiteral("polkit-kde-manager polkit-kde-manager");
- check << QStringLiteral("polkit-kde-authentication-agent-1 polkit-kde-authentication-agent-1");
- check << QStringLiteral("pinentry pinentry");
- if (check.contains(w->windowClass())) {
+ if (s_authWindows.contains(w->windowClass())) {
mActivated = true;
activateAnimation = true;
deactivateAnimation = false;
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic