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 4e545f55 authored by Vlad Zahorodnii's avatar Vlad Zahorodnii

[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
parent 9f3a447a
......@@ -32,6 +32,11 @@ static const QSet<QString> 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()));
}
......
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