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 7550d2a0 authored by Vlad Zahorodnii's avatar Vlad Zahorodnii

[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
parent d50f2803
......@@ -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;
......
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