2020-08-02 22:22:19 +00:00
|
|
|
/*
|
|
|
|
KWin - the KDE window manager
|
|
|
|
This file is part of the KDE project.
|
2008-08-12 15:22:06 +00:00
|
|
|
|
2020-08-02 22:22:19 +00:00
|
|
|
SPDX-FileCopyrightText: 2007 Lubos Lunak <l.lunak@kde.org>
|
|
|
|
SPDX-FileCopyrightText: 2008 Lucas Murray <lmurray@undefinedfire.com>
|
|
|
|
SPDX-FileCopyrightText: 2018 Vlad Zahorodnii <vlad.zahorodnii@kde.org>
|
2020-08-02 22:10:35 +00:00
|
|
|
|
2020-08-02 22:22:19 +00:00
|
|
|
SPDX-License-Identifier: GPL-2.0-or-later
|
|
|
|
*/
|
2008-08-12 15:22:06 +00:00
|
|
|
|
2018-07-08 17:23:49 +00:00
|
|
|
// own
|
2008-08-12 15:22:06 +00:00
|
|
|
#include "slide.h"
|
2018-07-08 17:23:49 +00:00
|
|
|
|
2017-12-30 17:17:13 +00:00
|
|
|
// KConfigSkeleton
|
|
|
|
#include "slideconfig.h"
|
2008-08-12 15:22:06 +00:00
|
|
|
|
|
|
|
namespace KWin
|
|
|
|
{
|
|
|
|
|
|
|
|
SlideEffect::SlideEffect()
|
2011-01-30 14:34:42 +00:00
|
|
|
{
|
2017-12-30 17:17:13 +00:00
|
|
|
initConfig<SlideConfig>();
|
2011-01-30 14:34:42 +00:00
|
|
|
reconfigure(ReconfigureAll);
|
[effects] replace old slide effect with a new one
Summary:
The new slide effect tries to separate each virtual desktop
as much as possible. This separation makes the new slide
effect more intuitive than the old one.
Test Plan:
* switch between virtual desktops
* or, move a window to another virtual desktop
Reviewers: #vdg, #kwin, #plasma, graesslin, ngraham
Reviewed By: #kwin, #plasma, graesslin
Subscribers: mart, graesslin, abetts, ngraham, plasma-devel, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D9638
2018-02-14 21:36:47 +00:00
|
|
|
|
2018-06-27 16:11:55 +00:00
|
|
|
m_timeLine.setEasingCurve(QEasingCurve::OutCubic);
|
[effects] replace old slide effect with a new one
Summary:
The new slide effect tries to separate each virtual desktop
as much as possible. This separation makes the new slide
effect more intuitive than the old one.
Test Plan:
* switch between virtual desktops
* or, move a window to another virtual desktop
Reviewers: #vdg, #kwin, #plasma, graesslin, ngraham
Reviewed By: #kwin, #plasma, graesslin
Subscribers: mart, graesslin, abetts, ngraham, plasma-devel, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D9638
2018-02-14 21:36:47 +00:00
|
|
|
|
2018-09-05 17:49:24 +00:00
|
|
|
connect(effects, QOverload<int, int, EffectWindow *>::of(&EffectsHandler::desktopChanged),
|
[effects] replace old slide effect with a new one
Summary:
The new slide effect tries to separate each virtual desktop
as much as possible. This separation makes the new slide
effect more intuitive than the old one.
Test Plan:
* switch between virtual desktops
* or, move a window to another virtual desktop
Reviewers: #vdg, #kwin, #plasma, graesslin, ngraham
Reviewed By: #kwin, #plasma, graesslin
Subscribers: mart, graesslin, abetts, ngraham, plasma-devel, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D9638
2018-02-14 21:36:47 +00:00
|
|
|
this, &SlideEffect::desktopChanged);
|
|
|
|
connect(effects, &EffectsHandler::windowAdded,
|
|
|
|
this, &SlideEffect::windowAdded);
|
|
|
|
connect(effects, &EffectsHandler::windowDeleted,
|
|
|
|
this, &SlideEffect::windowDeleted);
|
|
|
|
connect(effects, &EffectsHandler::numberDesktopsChanged,
|
|
|
|
this, &SlideEffect::numberDesktopsChanged);
|
|
|
|
connect(effects, &EffectsHandler::numberScreensChanged,
|
|
|
|
this, &SlideEffect::numberScreensChanged);
|
2011-01-30 14:34:42 +00:00
|
|
|
}
|
2008-10-09 05:31:04 +00:00
|
|
|
|
2018-09-23 11:52:28 +00:00
|
|
|
SlideEffect::~SlideEffect()
|
|
|
|
{
|
|
|
|
if (m_active) {
|
|
|
|
stop();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-11-23 09:34:06 +00:00
|
|
|
bool SlideEffect::supported()
|
|
|
|
{
|
|
|
|
return effects->animationsSupported();
|
|
|
|
}
|
|
|
|
|
2011-01-30 14:34:42 +00:00
|
|
|
void SlideEffect::reconfigure(ReconfigureFlags)
|
|
|
|
{
|
2017-12-30 17:17:13 +00:00
|
|
|
SlideConfig::self()->read();
|
|
|
|
|
2018-06-27 16:11:55 +00:00
|
|
|
m_timeLine.setDuration(
|
|
|
|
std::chrono::milliseconds(animationTime<SlideConfig>(500)));
|
[effects] replace old slide effect with a new one
Summary:
The new slide effect tries to separate each virtual desktop
as much as possible. This separation makes the new slide
effect more intuitive than the old one.
Test Plan:
* switch between virtual desktops
* or, move a window to another virtual desktop
Reviewers: #vdg, #kwin, #plasma, graesslin, ngraham
Reviewed By: #kwin, #plasma, graesslin
Subscribers: mart, graesslin, abetts, ngraham, plasma-devel, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D9638
2018-02-14 21:36:47 +00:00
|
|
|
|
|
|
|
m_hGap = SlideConfig::horizontalGap();
|
|
|
|
m_vGap = SlideConfig::verticalGap();
|
|
|
|
m_slideDocks = SlideConfig::slideDocks();
|
[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
2018-06-14 16:20:33 +00:00
|
|
|
m_slideBackground = SlideConfig::slideBackground();
|
2011-01-30 14:34:42 +00:00
|
|
|
}
|
2008-08-12 15:22:06 +00:00
|
|
|
|
Provide expected presentation time to effects
Effects are given the interval between two consecutive frames. The main
flaw of this approach is that if the Compositor transitions from the idle
state to "active" state, i.e. when there is something to repaint,
effects may see a very large interval between the last painted frame and
the current. In order to address this issue, the Scene invalidates the
timer that is used to measure time between consecutive frames before the
Compositor is about to become idle.
While this works perfectly fine with Xinerama-style rendering, with per
screen rendering, determining whether the compositor is about to idle is
rather a tedious task mostly because a single output can't be used for
the test.
Furthermore, since the Compositor schedules pointless repaints just to
ensure that it's idle, it might take several attempts to figure out
whether the scene timer must be invalidated if you use (true) per screen
rendering.
Ideally, all effects should use a timeline helper that is aware of the
underlying render loop and its timings. However, this option is off the
table because it will involve a lot of work to implement it.
Alternative and much simpler option is to pass the expected presentation
time to effects rather than time between consecutive frames. This means
that effects are responsible for determining how much animation timelines
have to be advanced. Typically, an effect would have to store the
presentation timestamp provided in either prePaint{Screen,Window} and
use it in the subsequent prePaint{Screen,Window} call to estimate the
amount of time passed between the next and the last frames.
Unfortunately, this is an API incompatible change. However, it shouldn't
take a lot of work to port third-party binary effects, which don't use the
AnimationEffect class, to the new API. On the bright side, we no longer
need to be concerned about the Compositor getting idle.
We do still try to determine whether the Compositor is about to idle,
primarily, because the OpenGL render backend swaps buffers on present,
but that will change with the ongoing compositing timing rework.
2020-11-20 15:44:04 +00:00
|
|
|
void SlideEffect::prePaintScreen(ScreenPrePaintData &data, std::chrono::milliseconds presentTime)
|
2011-01-30 14:34:42 +00:00
|
|
|
{
|
Provide expected presentation time to effects
Effects are given the interval between two consecutive frames. The main
flaw of this approach is that if the Compositor transitions from the idle
state to "active" state, i.e. when there is something to repaint,
effects may see a very large interval between the last painted frame and
the current. In order to address this issue, the Scene invalidates the
timer that is used to measure time between consecutive frames before the
Compositor is about to become idle.
While this works perfectly fine with Xinerama-style rendering, with per
screen rendering, determining whether the compositor is about to idle is
rather a tedious task mostly because a single output can't be used for
the test.
Furthermore, since the Compositor schedules pointless repaints just to
ensure that it's idle, it might take several attempts to figure out
whether the scene timer must be invalidated if you use (true) per screen
rendering.
Ideally, all effects should use a timeline helper that is aware of the
underlying render loop and its timings. However, this option is off the
table because it will involve a lot of work to implement it.
Alternative and much simpler option is to pass the expected presentation
time to effects rather than time between consecutive frames. This means
that effects are responsible for determining how much animation timelines
have to be advanced. Typically, an effect would have to store the
presentation timestamp provided in either prePaint{Screen,Window} and
use it in the subsequent prePaint{Screen,Window} call to estimate the
amount of time passed between the next and the last frames.
Unfortunately, this is an API incompatible change. However, it shouldn't
take a lot of work to port third-party binary effects, which don't use the
AnimationEffect class, to the new API. On the bright side, we no longer
need to be concerned about the Compositor getting idle.
We do still try to determine whether the Compositor is about to idle,
primarily, because the OpenGL render backend swaps buffers on present,
but that will change with the ongoing compositing timing rework.
2020-11-20 15:44:04 +00:00
|
|
|
std::chrono::milliseconds delta = std::chrono::milliseconds::zero();
|
|
|
|
if (m_lastPresentTime.count()) {
|
|
|
|
delta = presentTime - m_lastPresentTime;
|
|
|
|
}
|
|
|
|
m_lastPresentTime = presentTime;
|
|
|
|
|
|
|
|
m_timeLine.update(delta);
|
2018-06-27 16:11:55 +00:00
|
|
|
|
|
|
|
data.mask |= PAINT_SCREEN_TRANSFORMED
|
|
|
|
| PAINT_SCREEN_BACKGROUND_FIRST;
|
[effects] replace old slide effect with a new one
Summary:
The new slide effect tries to separate each virtual desktop
as much as possible. This separation makes the new slide
effect more intuitive than the old one.
Test Plan:
* switch between virtual desktops
* or, move a window to another virtual desktop
Reviewers: #vdg, #kwin, #plasma, graesslin, ngraham
Reviewed By: #kwin, #plasma, graesslin
Subscribers: mart, graesslin, abetts, ngraham, plasma-devel, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D9638
2018-02-14 21:36:47 +00:00
|
|
|
|
Provide expected presentation time to effects
Effects are given the interval between two consecutive frames. The main
flaw of this approach is that if the Compositor transitions from the idle
state to "active" state, i.e. when there is something to repaint,
effects may see a very large interval between the last painted frame and
the current. In order to address this issue, the Scene invalidates the
timer that is used to measure time between consecutive frames before the
Compositor is about to become idle.
While this works perfectly fine with Xinerama-style rendering, with per
screen rendering, determining whether the compositor is about to idle is
rather a tedious task mostly because a single output can't be used for
the test.
Furthermore, since the Compositor schedules pointless repaints just to
ensure that it's idle, it might take several attempts to figure out
whether the scene timer must be invalidated if you use (true) per screen
rendering.
Ideally, all effects should use a timeline helper that is aware of the
underlying render loop and its timings. However, this option is off the
table because it will involve a lot of work to implement it.
Alternative and much simpler option is to pass the expected presentation
time to effects rather than time between consecutive frames. This means
that effects are responsible for determining how much animation timelines
have to be advanced. Typically, an effect would have to store the
presentation timestamp provided in either prePaint{Screen,Window} and
use it in the subsequent prePaint{Screen,Window} call to estimate the
amount of time passed between the next and the last frames.
Unfortunately, this is an API incompatible change. However, it shouldn't
take a lot of work to port third-party binary effects, which don't use the
AnimationEffect class, to the new API. On the bright side, we no longer
need to be concerned about the Compositor getting idle.
We do still try to determine whether the Compositor is about to idle,
primarily, because the OpenGL render backend swaps buffers on present,
but that will change with the ongoing compositing timing rework.
2020-11-20 15:44:04 +00:00
|
|
|
effects->prePaintScreen(data, presentTime);
|
2011-01-30 14:34:42 +00:00
|
|
|
}
|
2008-08-12 15:22:06 +00:00
|
|
|
|
[effects] replace old slide effect with a new one
Summary:
The new slide effect tries to separate each virtual desktop
as much as possible. This separation makes the new slide
effect more intuitive than the old one.
Test Plan:
* switch between virtual desktops
* or, move a window to another virtual desktop
Reviewers: #vdg, #kwin, #plasma, graesslin, ngraham
Reviewed By: #kwin, #plasma, graesslin
Subscribers: mart, graesslin, abetts, ngraham, plasma-devel, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D9638
2018-02-14 21:36:47 +00:00
|
|
|
/**
|
|
|
|
* Wrap vector @p diff around grid @p w x @p h.
|
|
|
|
*
|
|
|
|
* Wrapping is done in such a way that magnitude of x and y component of vector
|
|
|
|
* @p diff is less than half of @p w and half of @p h, respectively. This will
|
|
|
|
* result in having the "shortest" path between two points.
|
|
|
|
*
|
|
|
|
* @param diff Vector between two points
|
|
|
|
* @param w Width of the desktop grid
|
|
|
|
* @param h Height of the desktop grid
|
2019-07-29 18:58:33 +00:00
|
|
|
*/
|
2018-07-21 08:33:40 +00:00
|
|
|
inline void wrapDiff(QPoint &diff, int w, int h)
|
2011-01-30 14:34:42 +00:00
|
|
|
{
|
[effects] replace old slide effect with a new one
Summary:
The new slide effect tries to separate each virtual desktop
as much as possible. This separation makes the new slide
effect more intuitive than the old one.
Test Plan:
* switch between virtual desktops
* or, move a window to another virtual desktop
Reviewers: #vdg, #kwin, #plasma, graesslin, ngraham
Reviewed By: #kwin, #plasma, graesslin
Subscribers: mart, graesslin, abetts, ngraham, plasma-devel, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D9638
2018-02-14 21:36:47 +00:00
|
|
|
if (diff.x() > w/2) {
|
|
|
|
diff.setX(diff.x() - w);
|
|
|
|
} else if (diff.x() < -w/2) {
|
|
|
|
diff.setX(diff.x() + w);
|
2008-08-12 15:22:06 +00:00
|
|
|
}
|
[effects] replace old slide effect with a new one
Summary:
The new slide effect tries to separate each virtual desktop
as much as possible. This separation makes the new slide
effect more intuitive than the old one.
Test Plan:
* switch between virtual desktops
* or, move a window to another virtual desktop
Reviewers: #vdg, #kwin, #plasma, graesslin, ngraham
Reviewed By: #kwin, #plasma, graesslin
Subscribers: mart, graesslin, abetts, ngraham, plasma-devel, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D9638
2018-02-14 21:36:47 +00:00
|
|
|
|
|
|
|
if (diff.y() > h/2) {
|
|
|
|
diff.setY(diff.y() - h);
|
|
|
|
} else if (diff.y() < -h/2) {
|
|
|
|
diff.setY(diff.y() + h);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-07-21 08:33:40 +00:00
|
|
|
inline QRegion buildClipRegion(const QPoint &pos, int w, int h)
|
[effects] replace old slide effect with a new one
Summary:
The new slide effect tries to separate each virtual desktop
as much as possible. This separation makes the new slide
effect more intuitive than the old one.
Test Plan:
* switch between virtual desktops
* or, move a window to another virtual desktop
Reviewers: #vdg, #kwin, #plasma, graesslin, ngraham
Reviewed By: #kwin, #plasma, graesslin
Subscribers: mart, graesslin, abetts, ngraham, plasma-devel, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D9638
2018-02-14 21:36:47 +00:00
|
|
|
{
|
|
|
|
const QSize screenSize = effects->virtualScreenSize();
|
|
|
|
QRegion r = QRect(pos, screenSize);
|
|
|
|
if (effects->optionRollOverDesktops()) {
|
|
|
|
r |= (r & QRect(-w, 0, w, h)).translated(w, 0); // W
|
|
|
|
r |= (r & QRect(w, 0, w, h)).translated(-w, 0); // E
|
|
|
|
|
|
|
|
r |= (r & QRect(0, -h, w, h)).translated(0, h); // N
|
|
|
|
r |= (r & QRect(0, h, w, h)).translated(0, -h); // S
|
|
|
|
|
|
|
|
r |= (r & QRect(-w, -h, w, h)).translated(w, h); // NW
|
|
|
|
r |= (r & QRect(w, -h, w, h)).translated(-w, h); // NE
|
|
|
|
r |= (r & QRect(w, h, w, h)).translated(-w, -h); // SE
|
|
|
|
r |= (r & QRect(-w, h, w, h)).translated(w, -h); // SW
|
|
|
|
}
|
|
|
|
return r;
|
2011-01-30 14:34:42 +00:00
|
|
|
}
|
2008-08-12 15:22:06 +00:00
|
|
|
|
2019-10-29 22:04:15 +00:00
|
|
|
void SlideEffect::paintScreen(int mask, const QRegion ®ion, ScreenPaintData &data)
|
2011-01-30 14:34:42 +00:00
|
|
|
{
|
[effects] replace old slide effect with a new one
Summary:
The new slide effect tries to separate each virtual desktop
as much as possible. This separation makes the new slide
effect more intuitive than the old one.
Test Plan:
* switch between virtual desktops
* or, move a window to another virtual desktop
Reviewers: #vdg, #kwin, #plasma, graesslin, ngraham
Reviewed By: #kwin, #plasma, graesslin
Subscribers: mart, graesslin, abetts, ngraham, plasma-devel, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D9638
2018-02-14 21:36:47 +00:00
|
|
|
const bool wrap = effects->optionRollOverDesktops();
|
|
|
|
const int w = workspaceWidth();
|
|
|
|
const int h = workspaceHeight();
|
|
|
|
|
2018-06-27 16:11:55 +00:00
|
|
|
QPoint currentPos = m_startPos + m_diff * m_timeLine.value();
|
[effects] replace old slide effect with a new one
Summary:
The new slide effect tries to separate each virtual desktop
as much as possible. This separation makes the new slide
effect more intuitive than the old one.
Test Plan:
* switch between virtual desktops
* or, move a window to another virtual desktop
Reviewers: #vdg, #kwin, #plasma, graesslin, ngraham
Reviewed By: #kwin, #plasma, graesslin
Subscribers: mart, graesslin, abetts, ngraham, plasma-devel, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D9638
2018-02-14 21:36:47 +00:00
|
|
|
|
|
|
|
// When "Desktop navigation wraps around" checkbox is checked, currentPos
|
|
|
|
// can be outside the rectangle Rect{x:-w, y:-h, width:2*w, height: 2*h},
|
|
|
|
// so we map currentPos back to the rect.
|
|
|
|
if (wrap) {
|
|
|
|
currentPos.setX(currentPos.x() % w);
|
|
|
|
currentPos.setY(currentPos.y() % h);
|
|
|
|
}
|
|
|
|
|
|
|
|
QVector<int> visibleDesktops;
|
|
|
|
visibleDesktops.reserve(4); // 4 - maximum number of visible desktops
|
2018-05-25 15:46:38 +00:00
|
|
|
const QRegion clipRegion = buildClipRegion(currentPos, w, h);
|
[effects] replace old slide effect with a new one
Summary:
The new slide effect tries to separate each virtual desktop
as much as possible. This separation makes the new slide
effect more intuitive than the old one.
Test Plan:
* switch between virtual desktops
* or, move a window to another virtual desktop
Reviewers: #vdg, #kwin, #plasma, graesslin, ngraham
Reviewed By: #kwin, #plasma, graesslin
Subscribers: mart, graesslin, abetts, ngraham, plasma-devel, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D9638
2018-02-14 21:36:47 +00:00
|
|
|
for (int i = 1; i <= effects->numberOfDesktops(); i++) {
|
2018-05-25 15:46:38 +00:00
|
|
|
const QRect desktopGeo = desktopGeometry(i);
|
2018-07-21 08:33:40 +00:00
|
|
|
if (!clipRegion.contains(desktopGeo)) {
|
[effects] replace old slide effect with a new one
Summary:
The new slide effect tries to separate each virtual desktop
as much as possible. This separation makes the new slide
effect more intuitive than the old one.
Test Plan:
* switch between virtual desktops
* or, move a window to another virtual desktop
Reviewers: #vdg, #kwin, #plasma, graesslin, ngraham
Reviewed By: #kwin, #plasma, graesslin
Subscribers: mart, graesslin, abetts, ngraham, plasma-devel, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D9638
2018-02-14 21:36:47 +00:00
|
|
|
continue;
|
|
|
|
}
|
|
|
|
visibleDesktops << i;
|
|
|
|
}
|
|
|
|
|
|
|
|
// When we enter a virtual desktop that has a window in fullscreen mode,
|
|
|
|
// stacking order is fine. When we leave a virtual desktop that has
|
|
|
|
// a window in fullscreen mode, stacking order is no longer valid
|
|
|
|
// because panels are raised above the fullscreen window. Construct
|
|
|
|
// a list of fullscreen windows, so we can decide later whether
|
|
|
|
// docks should be visible on different virtual desktops.
|
|
|
|
if (m_slideDocks) {
|
|
|
|
const auto windows = effects->stackingOrder();
|
|
|
|
m_paintCtx.fullscreenWindows.clear();
|
2018-07-21 08:33:40 +00:00
|
|
|
for (EffectWindow *w : windows) {
|
|
|
|
if (!w->isFullScreen()) {
|
[effects] replace old slide effect with a new one
Summary:
The new slide effect tries to separate each virtual desktop
as much as possible. This separation makes the new slide
effect more intuitive than the old one.
Test Plan:
* switch between virtual desktops
* or, move a window to another virtual desktop
Reviewers: #vdg, #kwin, #plasma, graesslin, ngraham
Reviewed By: #kwin, #plasma, graesslin
Subscribers: mart, graesslin, abetts, ngraham, plasma-devel, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D9638
2018-02-14 21:36:47 +00:00
|
|
|
continue;
|
|
|
|
}
|
|
|
|
m_paintCtx.fullscreenWindows << w;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// If screen is painted with either PAINT_SCREEN_TRANSFORMED or
|
|
|
|
// PAINT_SCREEN_WITH_TRANSFORMED_WINDOWS there is no clipping!!
|
|
|
|
// Push the screen geometry to the paint clipper so everything outside
|
|
|
|
// of the screen geometry is clipped.
|
|
|
|
PaintClipper pc(QRegion(effects->virtualScreenGeometry()));
|
|
|
|
|
|
|
|
// Screen is painted in several passes. Each painting pass paints
|
|
|
|
// a single virtual desktop. There could be either 2 or 4 painting
|
|
|
|
// 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.
|
[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
2018-06-14 16:20:33 +00:00
|
|
|
m_paintCtx.firstPass = true;
|
[effects] replace old slide effect with a new one
Summary:
The new slide effect tries to separate each virtual desktop
as much as possible. This separation makes the new slide
effect more intuitive than the old one.
Test Plan:
* switch between virtual desktops
* or, move a window to another virtual desktop
Reviewers: #vdg, #kwin, #plasma, graesslin, ngraham
Reviewed By: #kwin, #plasma, graesslin
Subscribers: mart, graesslin, abetts, ngraham, plasma-devel, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D9638
2018-02-14 21:36:47 +00:00
|
|
|
const int lastDesktop = visibleDesktops.last();
|
|
|
|
for (int desktop : qAsConst(visibleDesktops)) {
|
|
|
|
m_paintCtx.desktop = desktop;
|
|
|
|
m_paintCtx.lastPass = (lastDesktop == desktop);
|
|
|
|
m_paintCtx.translation = desktopCoords(desktop) - currentPos;
|
|
|
|
if (wrap) {
|
|
|
|
wrapDiff(m_paintCtx.translation, w, h);
|
|
|
|
}
|
|
|
|
effects->paintScreen(mask, region, data);
|
[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
2018-06-14 16:20:33 +00:00
|
|
|
m_paintCtx.firstPass = false;
|
[effects] replace old slide effect with a new one
Summary:
The new slide effect tries to separate each virtual desktop
as much as possible. This separation makes the new slide
effect more intuitive than the old one.
Test Plan:
* switch between virtual desktops
* or, move a window to another virtual desktop
Reviewers: #vdg, #kwin, #plasma, graesslin, ngraham
Reviewed By: #kwin, #plasma, graesslin
Subscribers: mart, graesslin, abetts, ngraham, plasma-devel, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D9638
2018-02-14 21:36:47 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Decide whether given window @p w should be transformed/translated.
|
|
|
|
* @returns @c true if given window @p w should be transformed, otherwise @c false
|
2019-07-29 18:58:33 +00:00
|
|
|
*/
|
2018-07-21 08:33:40 +00:00
|
|
|
bool SlideEffect::isTranslated(const EffectWindow *w) const
|
[effects] replace old slide effect with a new one
Summary:
The new slide effect tries to separate each virtual desktop
as much as possible. This separation makes the new slide
effect more intuitive than the old one.
Test Plan:
* switch between virtual desktops
* or, move a window to another virtual desktop
Reviewers: #vdg, #kwin, #plasma, graesslin, ngraham
Reviewed By: #kwin, #plasma, graesslin
Subscribers: mart, graesslin, abetts, ngraham, plasma-devel, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D9638
2018-02-14 21:36:47 +00:00
|
|
|
{
|
|
|
|
if (w->isOnAllDesktops()) {
|
|
|
|
if (w->isDock()) {
|
|
|
|
return m_slideDocks;
|
2011-12-10 21:16:41 +00:00
|
|
|
}
|
[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
2018-06-14 16:20:33 +00:00
|
|
|
if (w->isDesktop()) {
|
|
|
|
return m_slideBackground;
|
|
|
|
}
|
|
|
|
return false;
|
[effects] replace old slide effect with a new one
Summary:
The new slide effect tries to separate each virtual desktop
as much as possible. This separation makes the new slide
effect more intuitive than the old one.
Test Plan:
* switch between virtual desktops
* or, move a window to another virtual desktop
Reviewers: #vdg, #kwin, #plasma, graesslin, ngraham
Reviewed By: #kwin, #plasma, graesslin
Subscribers: mart, graesslin, abetts, ngraham, plasma-devel, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D9638
2018-02-14 21:36:47 +00:00
|
|
|
} else if (w == m_movingWindow) {
|
|
|
|
return false;
|
|
|
|
} else if (w->isOnDesktop(m_paintCtx.desktop)) {
|
|
|
|
return true;
|
2011-12-10 21:16:41 +00:00
|
|
|
}
|
[effects] replace old slide effect with a new one
Summary:
The new slide effect tries to separate each virtual desktop
as much as possible. This separation makes the new slide
effect more intuitive than the old one.
Test Plan:
* switch between virtual desktops
* or, move a window to another virtual desktop
Reviewers: #vdg, #kwin, #plasma, graesslin, ngraham
Reviewed By: #kwin, #plasma, graesslin
Subscribers: mart, graesslin, abetts, ngraham, plasma-devel, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D9638
2018-02-14 21:36:47 +00:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Decide whether given window @p w should be painted.
|
|
|
|
* @returns @c true if given window @p w should be painted, otherwise @c false
|
2019-07-29 18:58:33 +00:00
|
|
|
*/
|
2018-07-21 08:33:40 +00:00
|
|
|
bool SlideEffect::isPainted(const EffectWindow *w) const
|
[effects] replace old slide effect with a new one
Summary:
The new slide effect tries to separate each virtual desktop
as much as possible. This separation makes the new slide
effect more intuitive than the old one.
Test Plan:
* switch between virtual desktops
* or, move a window to another virtual desktop
Reviewers: #vdg, #kwin, #plasma, graesslin, ngraham
Reviewed By: #kwin, #plasma, graesslin
Subscribers: mart, graesslin, abetts, ngraham, plasma-devel, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D9638
2018-02-14 21:36:47 +00:00
|
|
|
{
|
|
|
|
if (w->isOnAllDesktops()) {
|
|
|
|
if (w->isDock()) {
|
2018-07-21 08:33:40 +00:00
|
|
|
if (!m_slideDocks) {
|
[effects] replace old slide effect with a new one
Summary:
The new slide effect tries to separate each virtual desktop
as much as possible. This separation makes the new slide
effect more intuitive than the old one.
Test Plan:
* switch between virtual desktops
* or, move a window to another virtual desktop
Reviewers: #vdg, #kwin, #plasma, graesslin, ngraham
Reviewed By: #kwin, #plasma, graesslin
Subscribers: mart, graesslin, abetts, ngraham, plasma-devel, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D9638
2018-02-14 21:36:47 +00:00
|
|
|
return m_paintCtx.lastPass;
|
|
|
|
}
|
2018-07-21 08:33:40 +00:00
|
|
|
for (const EffectWindow *fw : qAsConst(m_paintCtx.fullscreenWindows)) {
|
[effects] replace old slide effect with a new one
Summary:
The new slide effect tries to separate each virtual desktop
as much as possible. This separation makes the new slide
effect more intuitive than the old one.
Test Plan:
* switch between virtual desktops
* or, move a window to another virtual desktop
Reviewers: #vdg, #kwin, #plasma, graesslin, ngraham
Reviewed By: #kwin, #plasma, graesslin
Subscribers: mart, graesslin, abetts, ngraham, plasma-devel, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D9638
2018-02-14 21:36:47 +00:00
|
|
|
if (fw->isOnDesktop(m_paintCtx.desktop)
|
|
|
|
&& fw->screen() == w->screen()) {
|
|
|
|
return false;
|
|
|
|
}
|
2011-01-30 14:34:42 +00:00
|
|
|
}
|
[effects] replace old slide effect with a new one
Summary:
The new slide effect tries to separate each virtual desktop
as much as possible. This separation makes the new slide
effect more intuitive than the old one.
Test Plan:
* switch between virtual desktops
* or, move a window to another virtual desktop
Reviewers: #vdg, #kwin, #plasma, graesslin, ngraham
Reviewed By: #kwin, #plasma, graesslin
Subscribers: mart, graesslin, abetts, ngraham, plasma-devel, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D9638
2018-02-14 21:36:47 +00:00
|
|
|
return true;
|
|
|
|
}
|
[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
2018-06-14 16:20:33 +00:00
|
|
|
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;
|
|
|
|
}
|
[effects] replace old slide effect with a new one
Summary:
The new slide effect tries to separate each virtual desktop
as much as possible. This separation makes the new slide
effect more intuitive than the old one.
Test Plan:
* switch between virtual desktops
* or, move a window to another virtual desktop
Reviewers: #vdg, #kwin, #plasma, graesslin, ngraham
Reviewed By: #kwin, #plasma, graesslin
Subscribers: mart, graesslin, abetts, ngraham, plasma-devel, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D9638
2018-02-14 21:36:47 +00:00
|
|
|
// 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.
|
|
|
|
if (w->keepAbove()) {
|
|
|
|
return m_paintCtx.lastPass;
|
2008-08-12 15:22:06 +00:00
|
|
|
}
|
[effects] replace old slide effect with a new one
Summary:
The new slide effect tries to separate each virtual desktop
as much as possible. This separation makes the new slide
effect more intuitive than the old one.
Test Plan:
* switch between virtual desktops
* or, move a window to another virtual desktop
Reviewers: #vdg, #kwin, #plasma, graesslin, ngraham
Reviewed By: #kwin, #plasma, graesslin
Subscribers: mart, graesslin, abetts, ngraham, plasma-devel, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D9638
2018-02-14 21:36:47 +00:00
|
|
|
return true;
|
|
|
|
} else if (w == m_movingWindow) {
|
|
|
|
return m_paintCtx.lastPass;
|
|
|
|
} else if (w->isOnDesktop(m_paintCtx.desktop)) {
|
|
|
|
return true;
|
2008-08-12 15:22:06 +00:00
|
|
|
}
|
[effects] replace old slide effect with a new one
Summary:
The new slide effect tries to separate each virtual desktop
as much as possible. This separation makes the new slide
effect more intuitive than the old one.
Test Plan:
* switch between virtual desktops
* or, move a window to another virtual desktop
Reviewers: #vdg, #kwin, #plasma, graesslin, ngraham
Reviewed By: #kwin, #plasma, graesslin
Subscribers: mart, graesslin, abetts, ngraham, plasma-devel, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D9638
2018-02-14 21:36:47 +00:00
|
|
|
return false;
|
2011-01-30 14:34:42 +00:00
|
|
|
}
|
2008-08-12 15:22:06 +00:00
|
|
|
|
Provide expected presentation time to effects
Effects are given the interval between two consecutive frames. The main
flaw of this approach is that if the Compositor transitions from the idle
state to "active" state, i.e. when there is something to repaint,
effects may see a very large interval between the last painted frame and
the current. In order to address this issue, the Scene invalidates the
timer that is used to measure time between consecutive frames before the
Compositor is about to become idle.
While this works perfectly fine with Xinerama-style rendering, with per
screen rendering, determining whether the compositor is about to idle is
rather a tedious task mostly because a single output can't be used for
the test.
Furthermore, since the Compositor schedules pointless repaints just to
ensure that it's idle, it might take several attempts to figure out
whether the scene timer must be invalidated if you use (true) per screen
rendering.
Ideally, all effects should use a timeline helper that is aware of the
underlying render loop and its timings. However, this option is off the
table because it will involve a lot of work to implement it.
Alternative and much simpler option is to pass the expected presentation
time to effects rather than time between consecutive frames. This means
that effects are responsible for determining how much animation timelines
have to be advanced. Typically, an effect would have to store the
presentation timestamp provided in either prePaint{Screen,Window} and
use it in the subsequent prePaint{Screen,Window} call to estimate the
amount of time passed between the next and the last frames.
Unfortunately, this is an API incompatible change. However, it shouldn't
take a lot of work to port third-party binary effects, which don't use the
AnimationEffect class, to the new API. On the bright side, we no longer
need to be concerned about the Compositor getting idle.
We do still try to determine whether the Compositor is about to idle,
primarily, because the OpenGL render backend swaps buffers on present,
but that will change with the ongoing compositing timing rework.
2020-11-20 15:44:04 +00:00
|
|
|
void SlideEffect::prePaintWindow(EffectWindow *w, WindowPrePaintData &data, std::chrono::milliseconds presentTime)
|
2011-01-30 14:34:42 +00:00
|
|
|
{
|
2018-09-23 12:04:20 +00:00
|
|
|
const bool painted = isPainted(w);
|
|
|
|
if (painted) {
|
|
|
|
w->enablePainting(EffectWindow::PAINT_DISABLED_BY_DESKTOP);
|
|
|
|
} else {
|
|
|
|
w->disablePainting(EffectWindow::PAINT_DISABLED_BY_DESKTOP);
|
|
|
|
}
|
|
|
|
if (painted && isTranslated(w)) {
|
|
|
|
data.setTransformed();
|
2008-08-12 15:22:06 +00:00
|
|
|
}
|
Provide expected presentation time to effects
Effects are given the interval between two consecutive frames. The main
flaw of this approach is that if the Compositor transitions from the idle
state to "active" state, i.e. when there is something to repaint,
effects may see a very large interval between the last painted frame and
the current. In order to address this issue, the Scene invalidates the
timer that is used to measure time between consecutive frames before the
Compositor is about to become idle.
While this works perfectly fine with Xinerama-style rendering, with per
screen rendering, determining whether the compositor is about to idle is
rather a tedious task mostly because a single output can't be used for
the test.
Furthermore, since the Compositor schedules pointless repaints just to
ensure that it's idle, it might take several attempts to figure out
whether the scene timer must be invalidated if you use (true) per screen
rendering.
Ideally, all effects should use a timeline helper that is aware of the
underlying render loop and its timings. However, this option is off the
table because it will involve a lot of work to implement it.
Alternative and much simpler option is to pass the expected presentation
time to effects rather than time between consecutive frames. This means
that effects are responsible for determining how much animation timelines
have to be advanced. Typically, an effect would have to store the
presentation timestamp provided in either prePaint{Screen,Window} and
use it in the subsequent prePaint{Screen,Window} call to estimate the
amount of time passed between the next and the last frames.
Unfortunately, this is an API incompatible change. However, it shouldn't
take a lot of work to port third-party binary effects, which don't use the
AnimationEffect class, to the new API. On the bright side, we no longer
need to be concerned about the Compositor getting idle.
We do still try to determine whether the Compositor is about to idle,
primarily, because the OpenGL render backend swaps buffers on present,
but that will change with the ongoing compositing timing rework.
2020-11-20 15:44:04 +00:00
|
|
|
effects->prePaintWindow(w, data, presentTime);
|
[effects] replace old slide effect with a new one
Summary:
The new slide effect tries to separate each virtual desktop
as much as possible. This separation makes the new slide
effect more intuitive than the old one.
Test Plan:
* switch between virtual desktops
* or, move a window to another virtual desktop
Reviewers: #vdg, #kwin, #plasma, graesslin, ngraham
Reviewed By: #kwin, #plasma, graesslin
Subscribers: mart, graesslin, abetts, ngraham, plasma-devel, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D9638
2018-02-14 21:36:47 +00:00
|
|
|
}
|
|
|
|
|
2018-07-21 08:33:40 +00:00
|
|
|
void SlideEffect::paintWindow(EffectWindow *w, int mask, QRegion region, WindowPaintData &data)
|
[effects] replace old slide effect with a new one
Summary:
The new slide effect tries to separate each virtual desktop
as much as possible. This separation makes the new slide
effect more intuitive than the old one.
Test Plan:
* switch between virtual desktops
* or, move a window to another virtual desktop
Reviewers: #vdg, #kwin, #plasma, graesslin, ngraham
Reviewed By: #kwin, #plasma, graesslin
Subscribers: mart, graesslin, abetts, ngraham, plasma-devel, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D9638
2018-02-14 21:36:47 +00:00
|
|
|
{
|
2018-09-23 12:04:20 +00:00
|
|
|
if (isTranslated(w)) {
|
[effects] replace old slide effect with a new one
Summary:
The new slide effect tries to separate each virtual desktop
as much as possible. This separation makes the new slide
effect more intuitive than the old one.
Test Plan:
* switch between virtual desktops
* or, move a window to another virtual desktop
Reviewers: #vdg, #kwin, #plasma, graesslin, ngraham
Reviewed By: #kwin, #plasma, graesslin
Subscribers: mart, graesslin, abetts, ngraham, plasma-devel, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D9638
2018-02-14 21:36:47 +00:00
|
|
|
data += m_paintCtx.translation;
|
|
|
|
}
|
2011-01-30 14:34:42 +00:00
|
|
|
effects->paintWindow(w, mask, region, data);
|
|
|
|
}
|
2008-08-12 15:22:06 +00:00
|
|
|
|
|
|
|
void SlideEffect::postPaintScreen()
|
2011-01-30 14:34:42 +00:00
|
|
|
{
|
2018-06-27 16:11:55 +00:00
|
|
|
if (m_timeLine.done()) {
|
|
|
|
stop();
|
[effects] replace old slide effect with a new one
Summary:
The new slide effect tries to separate each virtual desktop
as much as possible. This separation makes the new slide
effect more intuitive than the old one.
Test Plan:
* switch between virtual desktops
* or, move a window to another virtual desktop
Reviewers: #vdg, #kwin, #plasma, graesslin, ngraham
Reviewed By: #kwin, #plasma, graesslin
Subscribers: mart, graesslin, abetts, ngraham, plasma-devel, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D9638
2018-02-14 21:36:47 +00:00
|
|
|
}
|
2018-06-27 16:11:55 +00:00
|
|
|
|
|
|
|
effects->addRepaintFull();
|
2008-08-12 15:22:06 +00:00
|
|
|
effects->postPaintScreen();
|
2011-01-30 14:34:42 +00:00
|
|
|
}
|
2008-08-12 15:22:06 +00:00
|
|
|
|
[effects] replace old slide effect with a new one
Summary:
The new slide effect tries to separate each virtual desktop
as much as possible. This separation makes the new slide
effect more intuitive than the old one.
Test Plan:
* switch between virtual desktops
* or, move a window to another virtual desktop
Reviewers: #vdg, #kwin, #plasma, graesslin, ngraham
Reviewed By: #kwin, #plasma, graesslin
Subscribers: mart, graesslin, abetts, ngraham, plasma-devel, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D9638
2018-02-14 21:36:47 +00:00
|
|
|
/**
|
|
|
|
* Get position of the top-left corner of desktop @p id within desktop grid with gaps.
|
|
|
|
* @param id ID of a virtual desktop
|
2019-07-29 18:58:33 +00:00
|
|
|
*/
|
[effects] replace old slide effect with a new one
Summary:
The new slide effect tries to separate each virtual desktop
as much as possible. This separation makes the new slide
effect more intuitive than the old one.
Test Plan:
* switch between virtual desktops
* or, move a window to another virtual desktop
Reviewers: #vdg, #kwin, #plasma, graesslin, ngraham
Reviewed By: #kwin, #plasma, graesslin
Subscribers: mart, graesslin, abetts, ngraham, plasma-devel, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D9638
2018-02-14 21:36:47 +00:00
|
|
|
QPoint SlideEffect::desktopCoords(int id) const
|
2011-01-30 14:34:42 +00:00
|
|
|
{
|
[effects] replace old slide effect with a new one
Summary:
The new slide effect tries to separate each virtual desktop
as much as possible. This separation makes the new slide
effect more intuitive than the old one.
Test Plan:
* switch between virtual desktops
* or, move a window to another virtual desktop
Reviewers: #vdg, #kwin, #plasma, graesslin, ngraham
Reviewed By: #kwin, #plasma, graesslin
Subscribers: mart, graesslin, abetts, ngraham, plasma-devel, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D9638
2018-02-14 21:36:47 +00:00
|
|
|
QPoint c = effects->desktopCoords(id);
|
2018-05-25 15:46:38 +00:00
|
|
|
const QPoint gridPos = effects->desktopGridCoords(id);
|
[effects] replace old slide effect with a new one
Summary:
The new slide effect tries to separate each virtual desktop
as much as possible. This separation makes the new slide
effect more intuitive than the old one.
Test Plan:
* switch between virtual desktops
* or, move a window to another virtual desktop
Reviewers: #vdg, #kwin, #plasma, graesslin, ngraham
Reviewed By: #kwin, #plasma, graesslin
Subscribers: mart, graesslin, abetts, ngraham, plasma-devel, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D9638
2018-02-14 21:36:47 +00:00
|
|
|
c.setX(c.x() + m_hGap * gridPos.x());
|
|
|
|
c.setY(c.y() + m_vGap * gridPos.y());
|
|
|
|
return c;
|
2011-01-30 14:34:42 +00:00
|
|
|
}
|
2008-08-12 15:22:06 +00:00
|
|
|
|
[effects] replace old slide effect with a new one
Summary:
The new slide effect tries to separate each virtual desktop
as much as possible. This separation makes the new slide
effect more intuitive than the old one.
Test Plan:
* switch between virtual desktops
* or, move a window to another virtual desktop
Reviewers: #vdg, #kwin, #plasma, graesslin, ngraham
Reviewed By: #kwin, #plasma, graesslin
Subscribers: mart, graesslin, abetts, ngraham, plasma-devel, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D9638
2018-02-14 21:36:47 +00:00
|
|
|
/**
|
|
|
|
* Get geometry of desktop @p id within desktop grid with gaps.
|
|
|
|
* @param id ID of a virtual desktop
|
2019-07-29 18:58:33 +00:00
|
|
|
*/
|
[effects] replace old slide effect with a new one
Summary:
The new slide effect tries to separate each virtual desktop
as much as possible. This separation makes the new slide
effect more intuitive than the old one.
Test Plan:
* switch between virtual desktops
* or, move a window to another virtual desktop
Reviewers: #vdg, #kwin, #plasma, graesslin, ngraham
Reviewed By: #kwin, #plasma, graesslin
Subscribers: mart, graesslin, abetts, ngraham, plasma-devel, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D9638
2018-02-14 21:36:47 +00:00
|
|
|
QRect SlideEffect::desktopGeometry(int id) const
|
2011-01-30 14:34:42 +00:00
|
|
|
{
|
[effects] replace old slide effect with a new one
Summary:
The new slide effect tries to separate each virtual desktop
as much as possible. This separation makes the new slide
effect more intuitive than the old one.
Test Plan:
* switch between virtual desktops
* or, move a window to another virtual desktop
Reviewers: #vdg, #kwin, #plasma, graesslin, ngraham
Reviewed By: #kwin, #plasma, graesslin
Subscribers: mart, graesslin, abetts, ngraham, plasma-devel, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D9638
2018-02-14 21:36:47 +00:00
|
|
|
QRect g = effects->virtualScreenGeometry();
|
|
|
|
g.translate(desktopCoords(id));
|
|
|
|
return g;
|
|
|
|
}
|
2011-01-30 14:34:42 +00:00
|
|
|
|
[effects] replace old slide effect with a new one
Summary:
The new slide effect tries to separate each virtual desktop
as much as possible. This separation makes the new slide
effect more intuitive than the old one.
Test Plan:
* switch between virtual desktops
* or, move a window to another virtual desktop
Reviewers: #vdg, #kwin, #plasma, graesslin, ngraham
Reviewed By: #kwin, #plasma, graesslin
Subscribers: mart, graesslin, abetts, ngraham, plasma-devel, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D9638
2018-02-14 21:36:47 +00:00
|
|
|
/**
|
|
|
|
* Get width of a virtual desktop grid.
|
2019-07-29 18:58:33 +00:00
|
|
|
*/
|
[effects] replace old slide effect with a new one
Summary:
The new slide effect tries to separate each virtual desktop
as much as possible. This separation makes the new slide
effect more intuitive than the old one.
Test Plan:
* switch between virtual desktops
* or, move a window to another virtual desktop
Reviewers: #vdg, #kwin, #plasma, graesslin, ngraham
Reviewed By: #kwin, #plasma, graesslin
Subscribers: mart, graesslin, abetts, ngraham, plasma-devel, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D9638
2018-02-14 21:36:47 +00:00
|
|
|
int SlideEffect::workspaceWidth() const
|
|
|
|
{
|
|
|
|
int w = effects->workspaceWidth();
|
|
|
|
w += m_hGap * effects->desktopGridWidth();
|
|
|
|
return w;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Get height of a virtual desktop grid.
|
2019-07-29 18:58:33 +00:00
|
|
|
*/
|
[effects] replace old slide effect with a new one
Summary:
The new slide effect tries to separate each virtual desktop
as much as possible. This separation makes the new slide
effect more intuitive than the old one.
Test Plan:
* switch between virtual desktops
* or, move a window to another virtual desktop
Reviewers: #vdg, #kwin, #plasma, graesslin, ngraham
Reviewed By: #kwin, #plasma, graesslin
Subscribers: mart, graesslin, abetts, ngraham, plasma-devel, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D9638
2018-02-14 21:36:47 +00:00
|
|
|
int SlideEffect::workspaceHeight() const
|
|
|
|
{
|
|
|
|
int h = effects->workspaceHeight();
|
|
|
|
h += m_vGap * effects->desktopGridHeight();
|
|
|
|
return h;
|
|
|
|
}
|
|
|
|
|
2018-07-21 08:33:40 +00:00
|
|
|
bool SlideEffect::shouldElevate(const EffectWindow *w) const
|
[effects] replace old slide effect with a new one
Summary:
The new slide effect tries to separate each virtual desktop
as much as possible. This separation makes the new slide
effect more intuitive than the old one.
Test Plan:
* switch between virtual desktops
* or, move a window to another virtual desktop
Reviewers: #vdg, #kwin, #plasma, graesslin, ngraham
Reviewed By: #kwin, #plasma, graesslin
Subscribers: mart, graesslin, abetts, ngraham, plasma-devel, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D9638
2018-02-14 21:36:47 +00:00
|
|
|
{
|
|
|
|
// Static docks(i.e. this effect doesn't slide docks) should be elevated
|
|
|
|
// so they can properly animate themselves when an user enters or leaves
|
|
|
|
// a virtual desktop with a window in fullscreen mode.
|
|
|
|
return w->isDock() && !m_slideDocks;
|
|
|
|
}
|
|
|
|
|
2018-07-21 08:33:40 +00:00
|
|
|
void SlideEffect::start(int old, int current, EffectWindow *movingWindow)
|
[effects] replace old slide effect with a new one
Summary:
The new slide effect tries to separate each virtual desktop
as much as possible. This separation makes the new slide
effect more intuitive than the old one.
Test Plan:
* switch between virtual desktops
* or, move a window to another virtual desktop
Reviewers: #vdg, #kwin, #plasma, graesslin, ngraham
Reviewed By: #kwin, #plasma, graesslin
Subscribers: mart, graesslin, abetts, ngraham, plasma-devel, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D9638
2018-02-14 21:36:47 +00:00
|
|
|
{
|
|
|
|
m_movingWindow = movingWindow;
|
|
|
|
|
|
|
|
const bool wrap = effects->optionRollOverDesktops();
|
|
|
|
const int w = workspaceWidth();
|
|
|
|
const int h = workspaceHeight();
|
|
|
|
|
|
|
|
if (m_active) {
|
2018-06-27 16:11:55 +00:00
|
|
|
QPoint passed = m_diff * m_timeLine.value();
|
[effects] replace old slide effect with a new one
Summary:
The new slide effect tries to separate each virtual desktop
as much as possible. This separation makes the new slide
effect more intuitive than the old one.
Test Plan:
* switch between virtual desktops
* or, move a window to another virtual desktop
Reviewers: #vdg, #kwin, #plasma, graesslin, ngraham
Reviewed By: #kwin, #plasma, graesslin
Subscribers: mart, graesslin, abetts, ngraham, plasma-devel, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D9638
2018-02-14 21:36:47 +00:00
|
|
|
QPoint currentPos = m_startPos + passed;
|
|
|
|
QPoint delta = desktopCoords(current) - desktopCoords(old);
|
|
|
|
if (wrap) {
|
|
|
|
wrapDiff(delta, w, h);
|
2011-01-30 14:34:42 +00:00
|
|
|
}
|
[effects] replace old slide effect with a new one
Summary:
The new slide effect tries to separate each virtual desktop
as much as possible. This separation makes the new slide
effect more intuitive than the old one.
Test Plan:
* switch between virtual desktops
* or, move a window to another virtual desktop
Reviewers: #vdg, #kwin, #plasma, graesslin, ngraham
Reviewed By: #kwin, #plasma, graesslin
Subscribers: mart, graesslin, abetts, ngraham, plasma-devel, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D9638
2018-02-14 21:36:47 +00:00
|
|
|
m_diff += delta - passed;
|
|
|
|
m_startPos = currentPos;
|
2018-06-27 16:11:55 +00:00
|
|
|
// TODO: Figure out how to smooth movement.
|
|
|
|
m_timeLine.reset();
|
[effects] replace old slide effect with a new one
Summary:
The new slide effect tries to separate each virtual desktop
as much as possible. This separation makes the new slide
effect more intuitive than the old one.
Test Plan:
* switch between virtual desktops
* or, move a window to another virtual desktop
Reviewers: #vdg, #kwin, #plasma, graesslin, ngraham
Reviewed By: #kwin, #plasma, graesslin
Subscribers: mart, graesslin, abetts, ngraham, plasma-devel, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D9638
2018-02-14 21:36:47 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
const auto windows = effects->stackingOrder();
|
2018-07-21 08:33:40 +00:00
|
|
|
for (EffectWindow *w : windows) {
|
[effects] replace old slide effect with a new one
Summary:
The new slide effect tries to separate each virtual desktop
as much as possible. This separation makes the new slide
effect more intuitive than the old one.
Test Plan:
* switch between virtual desktops
* or, move a window to another virtual desktop
Reviewers: #vdg, #kwin, #plasma, graesslin, ngraham
Reviewed By: #kwin, #plasma, graesslin
Subscribers: mart, graesslin, abetts, ngraham, plasma-devel, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D9638
2018-02-14 21:36:47 +00:00
|
|
|
if (shouldElevate(w)) {
|
|
|
|
effects->setElevatedWindow(w, true);
|
|
|
|
m_elevatedWindows << w;
|
2011-12-10 21:16:41 +00:00
|
|
|
}
|
2018-09-23 11:52:28 +00:00
|
|
|
w->setData(WindowForceBackgroundContrastRole, QVariant(true));
|
|
|
|
w->setData(WindowForceBlurRole, QVariant(true));
|
2008-08-12 15:22:06 +00:00
|
|
|
}
|
2018-01-01 15:07:41 +00:00
|
|
|
|
[effects] replace old slide effect with a new one
Summary:
The new slide effect tries to separate each virtual desktop
as much as possible. This separation makes the new slide
effect more intuitive than the old one.
Test Plan:
* switch between virtual desktops
* or, move a window to another virtual desktop
Reviewers: #vdg, #kwin, #plasma, graesslin, ngraham
Reviewed By: #kwin, #plasma, graesslin
Subscribers: mart, graesslin, abetts, ngraham, plasma-devel, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D9638
2018-02-14 21:36:47 +00:00
|
|
|
m_diff = desktopCoords(current) - desktopCoords(old);
|
|
|
|
if (wrap) {
|
|
|
|
wrapDiff(m_diff, w, h);
|
|
|
|
}
|
|
|
|
m_startPos = desktopCoords(old);
|
2018-06-27 16:11:55 +00:00
|
|
|
m_timeLine.reset();
|
[effects] replace old slide effect with a new one
Summary:
The new slide effect tries to separate each virtual desktop
as much as possible. This separation makes the new slide
effect more intuitive than the old one.
Test Plan:
* switch between virtual desktops
* or, move a window to another virtual desktop
Reviewers: #vdg, #kwin, #plasma, graesslin, ngraham
Reviewed By: #kwin, #plasma, graesslin
Subscribers: mart, graesslin, abetts, ngraham, plasma-devel, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D9638
2018-02-14 21:36:47 +00:00
|
|
|
m_active = true;
|
|
|
|
effects->setActiveFullScreenEffect(this);
|
2011-01-30 14:34:42 +00:00
|
|
|
effects->addRepaintFull();
|
|
|
|
}
|
2008-08-12 15:22:06 +00:00
|
|
|
|
[effects] replace old slide effect with a new one
Summary:
The new slide effect tries to separate each virtual desktop
as much as possible. This separation makes the new slide
effect more intuitive than the old one.
Test Plan:
* switch between virtual desktops
* or, move a window to another virtual desktop
Reviewers: #vdg, #kwin, #plasma, graesslin, ngraham
Reviewed By: #kwin, #plasma, graesslin
Subscribers: mart, graesslin, abetts, ngraham, plasma-devel, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D9638
2018-02-14 21:36:47 +00:00
|
|
|
void SlideEffect::stop()
|
|
|
|
{
|
2018-09-23 11:52:28 +00:00
|
|
|
const EffectWindowList windows = effects->stackingOrder();
|
|
|
|
for (EffectWindow *w : windows) {
|
2018-06-10 20:39:22 +00:00
|
|
|
w->setData(WindowForceBackgroundContrastRole, QVariant());
|
2018-09-23 11:52:28 +00:00
|
|
|
w->setData(WindowForceBlurRole, QVariant());
|
[effects] replace old slide effect with a new one
Summary:
The new slide effect tries to separate each virtual desktop
as much as possible. This separation makes the new slide
effect more intuitive than the old one.
Test Plan:
* switch between virtual desktops
* or, move a window to another virtual desktop
Reviewers: #vdg, #kwin, #plasma, graesslin, ngraham
Reviewed By: #kwin, #plasma, graesslin
Subscribers: mart, graesslin, abetts, ngraham, plasma-devel, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D9638
2018-02-14 21:36:47 +00:00
|
|
|
}
|
|
|
|
|
2018-07-21 08:33:40 +00:00
|
|
|
for (EffectWindow *w : m_elevatedWindows) {
|
[effects] replace old slide effect with a new one
Summary:
The new slide effect tries to separate each virtual desktop
as much as possible. This separation makes the new slide
effect more intuitive than the old one.
Test Plan:
* switch between virtual desktops
* or, move a window to another virtual desktop
Reviewers: #vdg, #kwin, #plasma, graesslin, ngraham
Reviewed By: #kwin, #plasma, graesslin
Subscribers: mart, graesslin, abetts, ngraham, plasma-devel, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D9638
2018-02-14 21:36:47 +00:00
|
|
|
effects->setElevatedWindow(w, false);
|
|
|
|
}
|
|
|
|
m_elevatedWindows.clear();
|
|
|
|
|
|
|
|
m_paintCtx.fullscreenWindows.clear();
|
|
|
|
m_movingWindow = nullptr;
|
|
|
|
m_active = false;
|
Provide expected presentation time to effects
Effects are given the interval between two consecutive frames. The main
flaw of this approach is that if the Compositor transitions from the idle
state to "active" state, i.e. when there is something to repaint,
effects may see a very large interval between the last painted frame and
the current. In order to address this issue, the Scene invalidates the
timer that is used to measure time between consecutive frames before the
Compositor is about to become idle.
While this works perfectly fine with Xinerama-style rendering, with per
screen rendering, determining whether the compositor is about to idle is
rather a tedious task mostly because a single output can't be used for
the test.
Furthermore, since the Compositor schedules pointless repaints just to
ensure that it's idle, it might take several attempts to figure out
whether the scene timer must be invalidated if you use (true) per screen
rendering.
Ideally, all effects should use a timeline helper that is aware of the
underlying render loop and its timings. However, this option is off the
table because it will involve a lot of work to implement it.
Alternative and much simpler option is to pass the expected presentation
time to effects rather than time between consecutive frames. This means
that effects are responsible for determining how much animation timelines
have to be advanced. Typically, an effect would have to store the
presentation timestamp provided in either prePaint{Screen,Window} and
use it in the subsequent prePaint{Screen,Window} call to estimate the
amount of time passed between the next and the last frames.
Unfortunately, this is an API incompatible change. However, it shouldn't
take a lot of work to port third-party binary effects, which don't use the
AnimationEffect class, to the new API. On the bright side, we no longer
need to be concerned about the Compositor getting idle.
We do still try to determine whether the Compositor is about to idle,
primarily, because the OpenGL render backend swaps buffers on present,
but that will change with the ongoing compositing timing rework.
2020-11-20 15:44:04 +00:00
|
|
|
m_lastPresentTime = std::chrono::milliseconds::zero();
|
[effects] replace old slide effect with a new one
Summary:
The new slide effect tries to separate each virtual desktop
as much as possible. This separation makes the new slide
effect more intuitive than the old one.
Test Plan:
* switch between virtual desktops
* or, move a window to another virtual desktop
Reviewers: #vdg, #kwin, #plasma, graesslin, ngraham
Reviewed By: #kwin, #plasma, graesslin
Subscribers: mart, graesslin, abetts, ngraham, plasma-devel, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D9638
2018-02-14 21:36:47 +00:00
|
|
|
effects->setActiveFullScreenEffect(nullptr);
|
|
|
|
}
|
|
|
|
|
2018-07-21 08:33:40 +00:00
|
|
|
void SlideEffect::desktopChanged(int old, int current, EffectWindow *with)
|
[effects] replace old slide effect with a new one
Summary:
The new slide effect tries to separate each virtual desktop
as much as possible. This separation makes the new slide
effect more intuitive than the old one.
Test Plan:
* switch between virtual desktops
* or, move a window to another virtual desktop
Reviewers: #vdg, #kwin, #plasma, graesslin, ngraham
Reviewed By: #kwin, #plasma, graesslin
Subscribers: mart, graesslin, abetts, ngraham, plasma-devel, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D9638
2018-02-14 21:36:47 +00:00
|
|
|
{
|
|
|
|
if (effects->activeFullScreenEffect() && effects->activeFullScreenEffect() != this) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
start(old, current, with);
|
|
|
|
}
|
|
|
|
|
Force-enable blur for Plasma's windows during desktop slide
Without setting the property, Plasma's panel and dialogs lose the
backgroundcontrast effect during slides, which makes them flicker.
As the panel is shown on screen all the time, this is quite a visible
bug. To fix this, when the slide effect is started, we check for window
types and properties of each window, and force the blur flag on if it's
unset.
If the background contrast flag is set to false, we leave the window
alone assuming that there's a reason to force it off. Windows that
are newly added during the slide get the same treatment, so something
popping up while sliding (such as the desktop switch OSD) also gets
the background effect applied.When the effect stops or is interupted, we
unset what we've set, and clean up our internal bookkeeping.
Thanks Martin and Thomas for the thorough review!
REVIEW:115857
2014-02-19 13:02:09 +00:00
|
|
|
void SlideEffect::windowAdded(EffectWindow *w)
|
|
|
|
{
|
2018-07-21 08:33:40 +00:00
|
|
|
if (!m_active) {
|
[effects] replace old slide effect with a new one
Summary:
The new slide effect tries to separate each virtual desktop
as much as possible. This separation makes the new slide
effect more intuitive than the old one.
Test Plan:
* switch between virtual desktops
* or, move a window to another virtual desktop
Reviewers: #vdg, #kwin, #plasma, graesslin, ngraham
Reviewed By: #kwin, #plasma, graesslin
Subscribers: mart, graesslin, abetts, ngraham, plasma-devel, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D9638
2018-02-14 21:36:47 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
if (shouldElevate(w)) {
|
|
|
|
effects->setElevatedWindow(w, true);
|
|
|
|
m_elevatedWindows << w;
|
Force-enable blur for Plasma's windows during desktop slide
Without setting the property, Plasma's panel and dialogs lose the
backgroundcontrast effect during slides, which makes them flicker.
As the panel is shown on screen all the time, this is quite a visible
bug. To fix this, when the slide effect is started, we check for window
types and properties of each window, and force the blur flag on if it's
unset.
If the background contrast flag is set to false, we leave the window
alone assuming that there's a reason to force it off. Windows that
are newly added during the slide get the same treatment, so something
popping up while sliding (such as the desktop switch OSD) also gets
the background effect applied.When the effect stops or is interupted, we
unset what we've set, and clean up our internal bookkeeping.
Thanks Martin and Thomas for the thorough review!
REVIEW:115857
2014-02-19 13:02:09 +00:00
|
|
|
}
|
2018-09-23 11:52:28 +00:00
|
|
|
w->setData(WindowForceBackgroundContrastRole, QVariant(true));
|
|
|
|
w->setData(WindowForceBlurRole, QVariant(true));
|
Force-enable blur for Plasma's windows during desktop slide
Without setting the property, Plasma's panel and dialogs lose the
backgroundcontrast effect during slides, which makes them flicker.
As the panel is shown on screen all the time, this is quite a visible
bug. To fix this, when the slide effect is started, we check for window
types and properties of each window, and force the blur flag on if it's
unset.
If the background contrast flag is set to false, we leave the window
alone assuming that there's a reason to force it off. Windows that
are newly added during the slide get the same treatment, so something
popping up while sliding (such as the desktop switch OSD) also gets
the background effect applied.When the effect stops or is interupted, we
unset what we've set, and clean up our internal bookkeeping.
Thanks Martin and Thomas for the thorough review!
REVIEW:115857
2014-02-19 13:02:09 +00:00
|
|
|
}
|
|
|
|
|
2018-01-01 15:07:41 +00:00
|
|
|
void SlideEffect::windowDeleted(EffectWindow *w)
|
|
|
|
{
|
2018-07-21 08:33:40 +00:00
|
|
|
if (!m_active) {
|
[effects] replace old slide effect with a new one
Summary:
The new slide effect tries to separate each virtual desktop
as much as possible. This separation makes the new slide
effect more intuitive than the old one.
Test Plan:
* switch between virtual desktops
* or, move a window to another virtual desktop
Reviewers: #vdg, #kwin, #plasma, graesslin, ngraham
Reviewed By: #kwin, #plasma, graesslin
Subscribers: mart, graesslin, abetts, ngraham, plasma-devel, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D9638
2018-02-14 21:36:47 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
if (w == m_movingWindow) {
|
2018-01-01 15:07:41 +00:00
|
|
|
m_movingWindow = nullptr;
|
[effects] replace old slide effect with a new one
Summary:
The new slide effect tries to separate each virtual desktop
as much as possible. This separation makes the new slide
effect more intuitive than the old one.
Test Plan:
* switch between virtual desktops
* or, move a window to another virtual desktop
Reviewers: #vdg, #kwin, #plasma, graesslin, ngraham
Reviewed By: #kwin, #plasma, graesslin
Subscribers: mart, graesslin, abetts, ngraham, plasma-devel, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D9638
2018-02-14 21:36:47 +00:00
|
|
|
}
|
|
|
|
m_elevatedWindows.removeAll(w);
|
|
|
|
m_paintCtx.fullscreenWindows.removeAll(w);
|
2018-01-01 15:07:41 +00:00
|
|
|
}
|
|
|
|
|
[effects] replace old slide effect with a new one
Summary:
The new slide effect tries to separate each virtual desktop
as much as possible. This separation makes the new slide
effect more intuitive than the old one.
Test Plan:
* switch between virtual desktops
* or, move a window to another virtual desktop
Reviewers: #vdg, #kwin, #plasma, graesslin, ngraham
Reviewed By: #kwin, #plasma, graesslin
Subscribers: mart, graesslin, abetts, ngraham, plasma-devel, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D9638
2018-02-14 21:36:47 +00:00
|
|
|
void SlideEffect::numberDesktopsChanged(uint)
|
Force-enable blur for Plasma's windows during desktop slide
Without setting the property, Plasma's panel and dialogs lose the
backgroundcontrast effect during slides, which makes them flicker.
As the panel is shown on screen all the time, this is quite a visible
bug. To fix this, when the slide effect is started, we check for window
types and properties of each window, and force the blur flag on if it's
unset.
If the background contrast flag is set to false, we leave the window
alone assuming that there's a reason to force it off. Windows that
are newly added during the slide get the same treatment, so something
popping up while sliding (such as the desktop switch OSD) also gets
the background effect applied.When the effect stops or is interupted, we
unset what we've set, and clean up our internal bookkeeping.
Thanks Martin and Thomas for the thorough review!
REVIEW:115857
2014-02-19 13:02:09 +00:00
|
|
|
{
|
2018-07-21 08:33:40 +00:00
|
|
|
if (!m_active) {
|
[effects] replace old slide effect with a new one
Summary:
The new slide effect tries to separate each virtual desktop
as much as possible. This separation makes the new slide
effect more intuitive than the old one.
Test Plan:
* switch between virtual desktops
* or, move a window to another virtual desktop
Reviewers: #vdg, #kwin, #plasma, graesslin, ngraham
Reviewed By: #kwin, #plasma, graesslin
Subscribers: mart, graesslin, abetts, ngraham, plasma-devel, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D9638
2018-02-14 21:36:47 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
stop();
|
Force-enable blur for Plasma's windows during desktop slide
Without setting the property, Plasma's panel and dialogs lose the
backgroundcontrast effect during slides, which makes them flicker.
As the panel is shown on screen all the time, this is quite a visible
bug. To fix this, when the slide effect is started, we check for window
types and properties of each window, and force the blur flag on if it's
unset.
If the background contrast flag is set to false, we leave the window
alone assuming that there's a reason to force it off. Windows that
are newly added during the slide get the same treatment, so something
popping up while sliding (such as the desktop switch OSD) also gets
the background effect applied.When the effect stops or is interupted, we
unset what we've set, and clean up our internal bookkeeping.
Thanks Martin and Thomas for the thorough review!
REVIEW:115857
2014-02-19 13:02:09 +00:00
|
|
|
}
|
|
|
|
|
[effects] replace old slide effect with a new one
Summary:
The new slide effect tries to separate each virtual desktop
as much as possible. This separation makes the new slide
effect more intuitive than the old one.
Test Plan:
* switch between virtual desktops
* or, move a window to another virtual desktop
Reviewers: #vdg, #kwin, #plasma, graesslin, ngraham
Reviewed By: #kwin, #plasma, graesslin
Subscribers: mart, graesslin, abetts, ngraham, plasma-devel, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D9638
2018-02-14 21:36:47 +00:00
|
|
|
void SlideEffect::numberScreensChanged()
|
2011-08-27 09:21:31 +00:00
|
|
|
{
|
2018-07-21 08:33:40 +00:00
|
|
|
if (!m_active) {
|
[effects] replace old slide effect with a new one
Summary:
The new slide effect tries to separate each virtual desktop
as much as possible. This separation makes the new slide
effect more intuitive than the old one.
Test Plan:
* switch between virtual desktops
* or, move a window to another virtual desktop
Reviewers: #vdg, #kwin, #plasma, graesslin, ngraham
Reviewed By: #kwin, #plasma, graesslin
Subscribers: mart, graesslin, abetts, ngraham, plasma-devel, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D9638
2018-02-14 21:36:47 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
stop();
|
2011-08-27 09:21:31 +00:00
|
|
|
}
|
|
|
|
|
2018-07-08 17:23:49 +00:00
|
|
|
} // namespace KWin
|