diff --git a/effects/slide/slide.h b/effects/slide/slide.h --- a/effects/slide/slide.h +++ b/effects/slide/slide.h @@ -40,6 +40,7 @@ public: SlideEffect(); + ~SlideEffect() override; void reconfigure(ReconfigureFlags) override; @@ -82,9 +83,6 @@ bool isTranslated(const EffectWindow *w) const; bool isPainted(const EffectWindow *w) const; - - bool shouldForceBlur(const EffectWindow *w) const; - bool shouldForceBackgroundContrast(const EffectWindow *w) const; bool shouldElevate(const EffectWindow *w) const; void start(int old, int current, EffectWindow *movingWindow = nullptr); @@ -111,11 +109,6 @@ EffectWindowList fullscreenWindows; } m_paintCtx; - struct { - EffectWindowList blur; - EffectWindowList backgroundContrast; - } m_forcedRoles; - EffectWindowList m_elevatedWindows; }; diff --git a/effects/slide/slide.cpp b/effects/slide/slide.cpp --- a/effects/slide/slide.cpp +++ b/effects/slide/slide.cpp @@ -26,11 +26,6 @@ // KConfigSkeleton #include "slideconfig.h" -// KWayland -#include -#include -#include - namespace KWin { @@ -53,6 +48,13 @@ this, &SlideEffect::numberScreensChanged); } +SlideEffect::~SlideEffect() +{ + if (m_active) { + stop(); + } +} + bool SlideEffect::supported() { return effects->animationsSupported(); @@ -334,70 +336,6 @@ return h; } -bool SlideEffect::shouldForceBlur(const EffectWindow *w) const -{ - // While there is an active fullscreen effect, the blur effect - // tends to do nothing, i.e. it doesn't blur behind windows. - // So, we should force the blur effect to blur by setting - // WindowForceBlurRole. - - if (w->data(WindowForceBlurRole).toBool()) { - return false; - } - - if (w->data(WindowBlurBehindRole).isValid()) { - return true; - } - - if (w->decorationHasAlpha() && effects->decorationSupportsBlurBehind()) { - return true; - } - - // FIXME: it should be something like this: - // if (surf) { - // return !surf->blur().isNull(); - // } - const KWayland::Server::SurfaceInterface *surf = w->surface(); - if (surf && surf->blur()) { - return true; - } - - // TODO: make it X11-specific(check _KDE_NET_WM_BLUR_BEHIND_REGION) - // or delete it in the future - return w->hasAlpha(); -} - -bool SlideEffect::shouldForceBackgroundContrast(const EffectWindow *w) const -{ - // While there is an active fullscreen effect, the background - // contrast effect tends to do nothing, i.e. it doesn't change - // contrast. So, we should force the background contrast effect - // to change contrast by setting WindowForceBackgroundContrastRole. - - if (w->data(WindowForceBackgroundContrastRole).toBool()) { - return false; - } - - if (w->data(WindowBackgroundContrastRole).isValid()) { - return true; - } - - // FIXME: it should be something like this: - // if (surf) { - // return !surf->contrast().isNull(); - // } - const KWayland::Server::SurfaceInterface *surf = w->surface(); - if (surf && surf->contrast()) { - return true; - } - - // TODO: make it X11-specific(check _KDE_NET_WM_BACKGROUND_CONTRAST_REGION) - // or delete it in the future - return w->hasAlpha() - && w->isOnAllDesktops() - && (w->isDock() || w->keepAbove()); -} - bool SlideEffect::shouldElevate(const EffectWindow *w) const { // Static docks(i.e. this effect doesn't slide docks) should be elevated @@ -430,18 +368,12 @@ const auto windows = effects->stackingOrder(); for (EffectWindow *w : windows) { - if (shouldForceBlur(w)) { - w->setData(WindowForceBlurRole, QVariant(true)); - m_forcedRoles.blur << w; - } - if (shouldForceBackgroundContrast(w)) { - w->setData(WindowForceBackgroundContrastRole, QVariant(true)); - m_forcedRoles.backgroundContrast << w; - } if (shouldElevate(w)) { effects->setElevatedWindow(w, true); m_elevatedWindows << w; } + w->setData(WindowForceBackgroundContrastRole, QVariant(true)); + w->setData(WindowForceBlurRole, QVariant(true)); } m_diff = desktopCoords(current) - desktopCoords(old); @@ -457,15 +389,11 @@ void SlideEffect::stop() { - for (EffectWindow *w : m_forcedRoles.blur) { - w->setData(WindowForceBlurRole, QVariant()); - } - m_forcedRoles.blur.clear(); - - for (EffectWindow *w : m_forcedRoles.backgroundContrast) { + const EffectWindowList windows = effects->stackingOrder(); + for (EffectWindow *w : windows) { w->setData(WindowForceBackgroundContrastRole, QVariant()); + w->setData(WindowForceBlurRole, QVariant()); } - m_forcedRoles.backgroundContrast.clear(); for (EffectWindow *w : m_elevatedWindows) { effects->setElevatedWindow(w, false); @@ -491,18 +419,12 @@ if (!m_active) { return; } - if (shouldForceBlur(w)) { - w->setData(WindowForceBlurRole, QVariant(true)); - m_forcedRoles.blur << w; - } - if (shouldForceBackgroundContrast(w)) { - w->setData(WindowForceBackgroundContrastRole, QVariant(true)); - m_forcedRoles.backgroundContrast << w; - } if (shouldElevate(w)) { effects->setElevatedWindow(w, true); m_elevatedWindows << w; } + w->setData(WindowForceBackgroundContrastRole, QVariant(true)); + w->setData(WindowForceBlurRole, QVariant(true)); } void SlideEffect::windowDeleted(EffectWindow *w) @@ -513,8 +435,6 @@ if (w == m_movingWindow) { m_movingWindow = nullptr; } - m_forcedRoles.blur.removeAll(w); - m_forcedRoles.backgroundContrast.removeAll(w); m_elevatedWindows.removeAll(w); m_paintCtx.fullscreenWindows.removeAll(w); }