Commit 64d1b0e9 authored by Vlad Zahorodnii's avatar Vlad Zahorodnii

[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
parent 1879303d
......@@ -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.
......
......@@ -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;
......
......@@ -18,5 +18,8 @@
<entry name="SlideDocks" type="Bool">
<default>true</default>
</entry>
<entry name="SlideBackground" type="Bool">
<default>true</default>
</entry>
</group>
</kcfg>
......@@ -106,6 +106,13 @@
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="kcfg_SlideBackground">
<property name="text">
<string>Slide desktop background</string>
</property>
</widget>
</item>
<item>
<spacer name="verticalSpacer">
<property name="orientation">
......
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