From 4e545f5594fc8445046f7b6a20b2c313a7891785 Mon Sep 17 00:00:00 2001 From: Vlad Zagorodniy Date: Fri, 19 Oct 2018 14:43:58 +0300 Subject: [PATCH] [effects/dimscreen] Make it work on Wayland Summary: There is no concept of managed windows in Wayland, so every time we call managed() on a Wayland client, it will return false. We need to call that method only for X11 clients. The resource name part for authentication agents is empty because KWayland can't get their executable paths. CCBUG: 398100 Test Plan: Before: {F6338545} After: {F6338546} Reviewers: #kwin, davidedmundson Reviewed By: #kwin, davidedmundson Subscribers: davidedmundson, kwin Tags: #kwin Differential Revision: https://phabricator.kde.org/D16317 --- effects/dimscreen/dimscreen.cpp | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/effects/dimscreen/dimscreen.cpp b/effects/dimscreen/dimscreen.cpp index a7f4f7e4d7..4c078643a3 100644 --- a/effects/dimscreen/dimscreen.cpp +++ b/effects/dimscreen/dimscreen.cpp @@ -32,6 +32,11 @@ static const QSet s_authWindows { QStringLiteral("pinentry pinentry"), QStringLiteral("polkit-kde-authentication-agent-1 polkit-kde-authentication-agent-1"), QStringLiteral("polkit-kde-manager polkit-kde-manager"), + + // On Wayland, the resource name is filename of executable. It's empty for + // authentication agents because KWayland can't get their executable paths. + QStringLiteral(" org.kde.kdesu"), + QStringLiteral(" org.kde.polkit-kde-authentication-agent-1") }; DimScreenEffect::DimScreenEffect() @@ -84,9 +89,22 @@ void DimScreenEffect::postPaintScreen() effects->postPaintScreen(); } +static inline bool isDimWindow(const EffectWindow *w) +{ + if (w->isPopupWindow()) { + return false; + } + + if (w->isX11Client() && !w->isManaged()) { + return false; + } + + return true; +} + void DimScreenEffect::paintWindow(EffectWindow *w, int mask, QRegion region, WindowPaintData &data) { - if (mActivated && (w != window) && w->isManaged()) { + if (mActivated && (w != window) && isDimWindow(w)) { data.multiplyBrightness((1.0 - 0.33 * timeline.currentValue())); data.multiplySaturation((1.0 - 0.33 * timeline.currentValue())); }