From 64d1b0e93c42cc4243b523d8df5ba85dfa87ac4f Mon Sep 17 00:00:00 2001 From: Vlad Zagorodniy Date: Thu, 14 Jun 2018 19:20:33 +0300 Subject: [PATCH] [effects/slide] Add "Slide desktop background" option Summary: Some people may not like the sliding of desktop background. Add corresponding option to disable the sliding of desktop background. By disabling the sliding of desktop background and docks, one can get old slide effect. {F5912713, layout=center, size=full} Test Plan: * Unchecked "Slide desktop background" checkbox, switched desktop; * Checked "Slide desktop background" checkbox, switched desktop. Reviewers: #kwin, #plasma, #vdg, mart Reviewed By: #kwin, #plasma, #vdg, mart Subscribers: romangg, abetts, ngraham, kwin Tags: #kwin Differential Revision: https://phabricator.kde.org/D13542 --- effects/slide/slide.cpp | 15 ++++++++++++++- effects/slide/slide.h | 2 ++ effects/slide/slide.kcfg | 3 +++ effects/slide/slide_config.ui | 7 +++++++ 4 files changed, 26 insertions(+), 1 deletion(-) diff --git a/effects/slide/slide.cpp b/effects/slide/slide.cpp index 579c15bce3..adaa71480a 100644 --- a/effects/slide/slide.cpp +++ b/effects/slide/slide.cpp @@ -71,6 +71,7 @@ void SlideEffect::reconfigure(ReconfigureFlags) m_hGap = SlideConfig::horizontalGap(); m_vGap = SlideConfig::verticalGap(); m_slideDocks = SlideConfig::slideDocks(); + m_slideBackground = SlideConfig::slideBackground(); } void SlideEffect::prePaintScreen(ScreenPrePaintData& data, int time) @@ -189,6 +190,7 @@ void SlideEffect::paintScreen(int mask, QRegion region, ScreenPaintData& data) // passes, depending how an user moves between virtual desktops. // Windows, such as docks or keep-above windows, are painted in // the last pass so they are above other windows. + m_paintCtx.firstPass = true; const int lastDesktop = visibleDesktops.last(); for (int desktop : qAsConst(visibleDesktops)) { m_paintCtx.desktop = desktop; @@ -198,6 +200,7 @@ void SlideEffect::paintScreen(int mask, QRegion region, ScreenPaintData& data) wrapDiff(m_paintCtx.translation, w, h); } effects->paintScreen(mask, region, data); + m_paintCtx.firstPass = false; } } @@ -211,7 +214,10 @@ bool SlideEffect::isTranslated(const EffectWindow* w) const if (w->isDock()) { return m_slideDocks; } - return w->isDesktop(); + if (w->isDesktop()) { + return m_slideBackground; + } + return false; } else if (w == m_movingWindow) { return false; } else if (w->isOnDesktop(m_paintCtx.desktop)) { @@ -239,6 +245,13 @@ bool SlideEffect::isPainted(const EffectWindow* w) const } return true; } + if (w->isDesktop()) { + // If desktop background is not being slided, draw it only + // in the first pass. Otherwise, desktop backgrounds from + // follow-up virtual desktops will be drawn above windows + // from previous virtual desktops. + return m_slideBackground || m_paintCtx.firstPass; + } // In order to make sure that 'keep above' windows are above // other windows during transition to another virtual desktop, // they should be painted in the last pass. diff --git a/effects/slide/slide.h b/effects/slide/slide.h index 3df02b22b8..02e46527a5 100644 --- a/effects/slide/slide.h +++ b/effects/slide/slide.h @@ -86,6 +86,7 @@ private: int m_hGap; int m_vGap; bool m_slideDocks; + bool m_slideBackground; bool m_active = false; QTimeLine m_timeline; @@ -95,6 +96,7 @@ private: struct { int desktop; + bool firstPass; bool lastPass; QPoint translation; diff --git a/effects/slide/slide.kcfg b/effects/slide/slide.kcfg index be278a8b40..5bf3a16b8d 100644 --- a/effects/slide/slide.kcfg +++ b/effects/slide/slide.kcfg @@ -18,5 +18,8 @@ true + + true + diff --git a/effects/slide/slide_config.ui b/effects/slide/slide_config.ui index 3366009986..4c9cb31ed6 100644 --- a/effects/slide/slide_config.ui +++ b/effects/slide/slide_config.ui @@ -106,6 +106,13 @@ + + + + Slide desktop background + + +