kwin/effects/glide/glide.cpp

331 lines
10 KiB
C++
Raw Normal View History

2020-08-02 22:22:19 +00:00
/*
KWin - the KDE window manager
This file is part of the KDE project.
2020-08-02 22:22:19 +00:00
SPDX-FileCopyrightText: 2007 Philip Falkner <philip.falkner@gmail.com>
SPDX-FileCopyrightText: 2009 Martin Gräßlin <mgraesslin@kde.org>
SPDX-FileCopyrightText: 2010 Alexandre Pereira <pereira.alex@gmail.com>
SPDX-FileCopyrightText: 2018 Vlad Zahorodnii <vlad.zahorodnii@kde.org>
2020-08-02 22:22:19 +00:00
SPDX-License-Identifier: GPL-2.0-or-later
*/
[effects] Rewrite the Glide effect Summary: There are several reasons why I "re-wrote" the Glide effect: * it doesn't work correctly because it suffers from undesired perspective distortions: {F5914378} The worst part is that windows are distorted so much on multiple monitor setups that it's hard to say whether that's glide animation. * window close animation is not quite intuitive: if the close button is located at the top and I click it, I would expect that window is rotated around the bottom edge, not the top; (IMHO) * it's too much distracting when working on something for quite good amount of time: e.g. when editing photos, which involves a big number of different dialogs; * there are issues with deletion of QTimeLine; * windows are not gracefully released if some other effect grabs them; * its code doesn't follow common coding style in KWin. So, the "new" Glide effect is more subtle, it's possible to have different rotation edges for window open/close animations, it doesn't animate special windows(like audio volume feedback), the code is simpler and readable. Yet, there are some issues with QTimeLine, which are common to all effects in KWin anyway. ### Demos {F5889803} //Window Open Animation// {F5889804} //Window Close Animation// {F5889805, layout=center, size=full} //KCM// CCBUG: 394245 Test Plan: * Enabled the Glide effect * Closed System Settings * Opened it again Reviewers: #kwin, #plasma, #vdg, davidedmundson Reviewed By: #kwin, #plasma, #vdg, davidedmundson Subscribers: ngraham, kwin Tags: #kwin Differential Revision: https://phabricator.kde.org/D13338
2018-06-01 09:56:33 +00:00
// own
#include "glide.h"
[effects] Rewrite the Glide effect Summary: There are several reasons why I "re-wrote" the Glide effect: * it doesn't work correctly because it suffers from undesired perspective distortions: {F5914378} The worst part is that windows are distorted so much on multiple monitor setups that it's hard to say whether that's glide animation. * window close animation is not quite intuitive: if the close button is located at the top and I click it, I would expect that window is rotated around the bottom edge, not the top; (IMHO) * it's too much distracting when working on something for quite good amount of time: e.g. when editing photos, which involves a big number of different dialogs; * there are issues with deletion of QTimeLine; * windows are not gracefully released if some other effect grabs them; * its code doesn't follow common coding style in KWin. So, the "new" Glide effect is more subtle, it's possible to have different rotation edges for window open/close animations, it doesn't animate special windows(like audio volume feedback), the code is simpler and readable. Yet, there are some issues with QTimeLine, which are common to all effects in KWin anyway. ### Demos {F5889803} //Window Open Animation// {F5889804} //Window Close Animation// {F5889805, layout=center, size=full} //KCM// CCBUG: 394245 Test Plan: * Enabled the Glide effect * Closed System Settings * Opened it again Reviewers: #kwin, #plasma, #vdg, davidedmundson Reviewed By: #kwin, #plasma, #vdg, davidedmundson Subscribers: ngraham, kwin Tags: #kwin Differential Revision: https://phabricator.kde.org/D13338
2018-06-01 09:56:33 +00:00
// KConfigSkeleton
#include "glideconfig.h"
[effects] Rewrite the Glide effect Summary: There are several reasons why I "re-wrote" the Glide effect: * it doesn't work correctly because it suffers from undesired perspective distortions: {F5914378} The worst part is that windows are distorted so much on multiple monitor setups that it's hard to say whether that's glide animation. * window close animation is not quite intuitive: if the close button is located at the top and I click it, I would expect that window is rotated around the bottom edge, not the top; (IMHO) * it's too much distracting when working on something for quite good amount of time: e.g. when editing photos, which involves a big number of different dialogs; * there are issues with deletion of QTimeLine; * windows are not gracefully released if some other effect grabs them; * its code doesn't follow common coding style in KWin. So, the "new" Glide effect is more subtle, it's possible to have different rotation edges for window open/close animations, it doesn't animate special windows(like audio volume feedback), the code is simpler and readable. Yet, there are some issues with QTimeLine, which are common to all effects in KWin anyway. ### Demos {F5889803} //Window Open Animation// {F5889804} //Window Close Animation// {F5889805, layout=center, size=full} //KCM// CCBUG: 394245 Test Plan: * Enabled the Glide effect * Closed System Settings * Opened it again Reviewers: #kwin, #plasma, #vdg, davidedmundson Reviewed By: #kwin, #plasma, #vdg, davidedmundson Subscribers: ngraham, kwin Tags: #kwin Differential Revision: https://phabricator.kde.org/D13338
2018-06-01 09:56:33 +00:00
// Qt
#include <QMatrix4x4>
#include <QSet>
namespace KWin
{
static const QSet<QString> s_blacklist {
[effects] Rewrite the Glide effect Summary: There are several reasons why I "re-wrote" the Glide effect: * it doesn't work correctly because it suffers from undesired perspective distortions: {F5914378} The worst part is that windows are distorted so much on multiple monitor setups that it's hard to say whether that's glide animation. * window close animation is not quite intuitive: if the close button is located at the top and I click it, I would expect that window is rotated around the bottom edge, not the top; (IMHO) * it's too much distracting when working on something for quite good amount of time: e.g. when editing photos, which involves a big number of different dialogs; * there are issues with deletion of QTimeLine; * windows are not gracefully released if some other effect grabs them; * its code doesn't follow common coding style in KWin. So, the "new" Glide effect is more subtle, it's possible to have different rotation edges for window open/close animations, it doesn't animate special windows(like audio volume feedback), the code is simpler and readable. Yet, there are some issues with QTimeLine, which are common to all effects in KWin anyway. ### Demos {F5889803} //Window Open Animation// {F5889804} //Window Close Animation// {F5889805, layout=center, size=full} //KCM// CCBUG: 394245 Test Plan: * Enabled the Glide effect * Closed System Settings * Opened it again Reviewers: #kwin, #plasma, #vdg, davidedmundson Reviewed By: #kwin, #plasma, #vdg, davidedmundson Subscribers: ngraham, kwin Tags: #kwin Differential Revision: https://phabricator.kde.org/D13338
2018-06-01 09:56:33 +00:00
QStringLiteral("ksmserver ksmserver"),
QStringLiteral("ksmserver-logout-greeter ksmserver-logout-greeter"),
[effects] Rewrite the Glide effect Summary: There are several reasons why I "re-wrote" the Glide effect: * it doesn't work correctly because it suffers from undesired perspective distortions: {F5914378} The worst part is that windows are distorted so much on multiple monitor setups that it's hard to say whether that's glide animation. * window close animation is not quite intuitive: if the close button is located at the top and I click it, I would expect that window is rotated around the bottom edge, not the top; (IMHO) * it's too much distracting when working on something for quite good amount of time: e.g. when editing photos, which involves a big number of different dialogs; * there are issues with deletion of QTimeLine; * windows are not gracefully released if some other effect grabs them; * its code doesn't follow common coding style in KWin. So, the "new" Glide effect is more subtle, it's possible to have different rotation edges for window open/close animations, it doesn't animate special windows(like audio volume feedback), the code is simpler and readable. Yet, there are some issues with QTimeLine, which are common to all effects in KWin anyway. ### Demos {F5889803} //Window Open Animation// {F5889804} //Window Close Animation// {F5889805, layout=center, size=full} //KCM// CCBUG: 394245 Test Plan: * Enabled the Glide effect * Closed System Settings * Opened it again Reviewers: #kwin, #plasma, #vdg, davidedmundson Reviewed By: #kwin, #plasma, #vdg, davidedmundson Subscribers: ngraham, kwin Tags: #kwin Differential Revision: https://phabricator.kde.org/D13338
2018-06-01 09:56:33 +00:00
QStringLiteral("ksplashqml ksplashqml"),
QStringLiteral("ksplashsimple ksplashsimple"),
QStringLiteral("ksplashx ksplashx")
};
GlideEffect::GlideEffect()
2011-01-30 14:34:42 +00:00
{
initConfig<GlideConfig>();
2011-01-30 14:34:42 +00:00
reconfigure(ReconfigureAll);
[effects] Rewrite the Glide effect Summary: There are several reasons why I "re-wrote" the Glide effect: * it doesn't work correctly because it suffers from undesired perspective distortions: {F5914378} The worst part is that windows are distorted so much on multiple monitor setups that it's hard to say whether that's glide animation. * window close animation is not quite intuitive: if the close button is located at the top and I click it, I would expect that window is rotated around the bottom edge, not the top; (IMHO) * it's too much distracting when working on something for quite good amount of time: e.g. when editing photos, which involves a big number of different dialogs; * there are issues with deletion of QTimeLine; * windows are not gracefully released if some other effect grabs them; * its code doesn't follow common coding style in KWin. So, the "new" Glide effect is more subtle, it's possible to have different rotation edges for window open/close animations, it doesn't animate special windows(like audio volume feedback), the code is simpler and readable. Yet, there are some issues with QTimeLine, which are common to all effects in KWin anyway. ### Demos {F5889803} //Window Open Animation// {F5889804} //Window Close Animation// {F5889805, layout=center, size=full} //KCM// CCBUG: 394245 Test Plan: * Enabled the Glide effect * Closed System Settings * Opened it again Reviewers: #kwin, #plasma, #vdg, davidedmundson Reviewed By: #kwin, #plasma, #vdg, davidedmundson Subscribers: ngraham, kwin Tags: #kwin Differential Revision: https://phabricator.kde.org/D13338
2018-06-01 09:56:33 +00:00
connect(effects, &EffectsHandler::windowAdded, this, &GlideEffect::windowAdded);
connect(effects, &EffectsHandler::windowClosed, this, &GlideEffect::windowClosed);
connect(effects, &EffectsHandler::windowDeleted, this, &GlideEffect::windowDeleted);
connect(effects, &EffectsHandler::windowDataChanged, this, &GlideEffect::windowDataChanged);
}
GlideEffect::~GlideEffect() = default;
[effects] Rewrite the Glide effect Summary: There are several reasons why I "re-wrote" the Glide effect: * it doesn't work correctly because it suffers from undesired perspective distortions: {F5914378} The worst part is that windows are distorted so much on multiple monitor setups that it's hard to say whether that's glide animation. * window close animation is not quite intuitive: if the close button is located at the top and I click it, I would expect that window is rotated around the bottom edge, not the top; (IMHO) * it's too much distracting when working on something for quite good amount of time: e.g. when editing photos, which involves a big number of different dialogs; * there are issues with deletion of QTimeLine; * windows are not gracefully released if some other effect grabs them; * its code doesn't follow common coding style in KWin. So, the "new" Glide effect is more subtle, it's possible to have different rotation edges for window open/close animations, it doesn't animate special windows(like audio volume feedback), the code is simpler and readable. Yet, there are some issues with QTimeLine, which are common to all effects in KWin anyway. ### Demos {F5889803} //Window Open Animation// {F5889804} //Window Close Animation// {F5889805, layout=center, size=full} //KCM// CCBUG: 394245 Test Plan: * Enabled the Glide effect * Closed System Settings * Opened it again Reviewers: #kwin, #plasma, #vdg, davidedmundson Reviewed By: #kwin, #plasma, #vdg, davidedmundson Subscribers: ngraham, kwin Tags: #kwin Differential Revision: https://phabricator.kde.org/D13338
2018-06-01 09:56:33 +00:00
void GlideEffect::reconfigure(ReconfigureFlags flags)
2011-01-30 14:34:42 +00:00
{
[effects] Rewrite the Glide effect Summary: There are several reasons why I "re-wrote" the Glide effect: * it doesn't work correctly because it suffers from undesired perspective distortions: {F5914378} The worst part is that windows are distorted so much on multiple monitor setups that it's hard to say whether that's glide animation. * window close animation is not quite intuitive: if the close button is located at the top and I click it, I would expect that window is rotated around the bottom edge, not the top; (IMHO) * it's too much distracting when working on something for quite good amount of time: e.g. when editing photos, which involves a big number of different dialogs; * there are issues with deletion of QTimeLine; * windows are not gracefully released if some other effect grabs them; * its code doesn't follow common coding style in KWin. So, the "new" Glide effect is more subtle, it's possible to have different rotation edges for window open/close animations, it doesn't animate special windows(like audio volume feedback), the code is simpler and readable. Yet, there are some issues with QTimeLine, which are common to all effects in KWin anyway. ### Demos {F5889803} //Window Open Animation// {F5889804} //Window Close Animation// {F5889805, layout=center, size=full} //KCM// CCBUG: 394245 Test Plan: * Enabled the Glide effect * Closed System Settings * Opened it again Reviewers: #kwin, #plasma, #vdg, davidedmundson Reviewed By: #kwin, #plasma, #vdg, davidedmundson Subscribers: ngraham, kwin Tags: #kwin Differential Revision: https://phabricator.kde.org/D13338
2018-06-01 09:56:33 +00:00
Q_UNUSED(flags)
GlideConfig::self()->read();
[effects] Rewrite the Glide effect Summary: There are several reasons why I "re-wrote" the Glide effect: * it doesn't work correctly because it suffers from undesired perspective distortions: {F5914378} The worst part is that windows are distorted so much on multiple monitor setups that it's hard to say whether that's glide animation. * window close animation is not quite intuitive: if the close button is located at the top and I click it, I would expect that window is rotated around the bottom edge, not the top; (IMHO) * it's too much distracting when working on something for quite good amount of time: e.g. when editing photos, which involves a big number of different dialogs; * there are issues with deletion of QTimeLine; * windows are not gracefully released if some other effect grabs them; * its code doesn't follow common coding style in KWin. So, the "new" Glide effect is more subtle, it's possible to have different rotation edges for window open/close animations, it doesn't animate special windows(like audio volume feedback), the code is simpler and readable. Yet, there are some issues with QTimeLine, which are common to all effects in KWin anyway. ### Demos {F5889803} //Window Open Animation// {F5889804} //Window Close Animation// {F5889805, layout=center, size=full} //KCM// CCBUG: 394245 Test Plan: * Enabled the Glide effect * Closed System Settings * Opened it again Reviewers: #kwin, #plasma, #vdg, davidedmundson Reviewed By: #kwin, #plasma, #vdg, davidedmundson Subscribers: ngraham, kwin Tags: #kwin Differential Revision: https://phabricator.kde.org/D13338
2018-06-01 09:56:33 +00:00
m_duration = std::chrono::milliseconds(animationTime<GlideConfig>(160));
m_inParams.edge = static_cast<RotationEdge>(GlideConfig::inRotationEdge());
m_inParams.angle.from = GlideConfig::inRotationAngle();
m_inParams.angle.to = 0.0;
m_inParams.distance.from = GlideConfig::inDistance();
m_inParams.distance.to = 0.0;
m_inParams.opacity.from = GlideConfig::inOpacity();
m_inParams.opacity.to = 1.0;
m_outParams.edge = static_cast<RotationEdge>(GlideConfig::outRotationEdge());
m_outParams.angle.from = 0.0;
m_outParams.angle.to = GlideConfig::outRotationAngle();
m_outParams.distance.from = 0.0;
m_outParams.distance.to = GlideConfig::outDistance();
m_outParams.opacity.from = 1.0;
m_outParams.opacity.to = GlideConfig::outOpacity();
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
void GlideEffect::prePaintScreen(ScreenPrePaintData &data, std::chrono::milliseconds presentTime)
2011-01-30 14:34:42 +00:00
{
[effects] Rewrite the Glide effect Summary: There are several reasons why I "re-wrote" the Glide effect: * it doesn't work correctly because it suffers from undesired perspective distortions: {F5914378} The worst part is that windows are distorted so much on multiple monitor setups that it's hard to say whether that's glide animation. * window close animation is not quite intuitive: if the close button is located at the top and I click it, I would expect that window is rotated around the bottom edge, not the top; (IMHO) * it's too much distracting when working on something for quite good amount of time: e.g. when editing photos, which involves a big number of different dialogs; * there are issues with deletion of QTimeLine; * windows are not gracefully released if some other effect grabs them; * its code doesn't follow common coding style in KWin. So, the "new" Glide effect is more subtle, it's possible to have different rotation edges for window open/close animations, it doesn't animate special windows(like audio volume feedback), the code is simpler and readable. Yet, there are some issues with QTimeLine, which are common to all effects in KWin anyway. ### Demos {F5889803} //Window Open Animation// {F5889804} //Window Close Animation// {F5889805, layout=center, size=full} //KCM// CCBUG: 394245 Test Plan: * Enabled the Glide effect * Closed System Settings * Opened it again Reviewers: #kwin, #plasma, #vdg, davidedmundson Reviewed By: #kwin, #plasma, #vdg, davidedmundson Subscribers: ngraham, kwin Tags: #kwin Differential Revision: https://phabricator.kde.org/D13338
2018-06-01 09:56:33 +00:00
auto animationIt = m_animations.begin();
while (animationIt != m_animations.end()) {
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 (animationIt->lastPresentTime.count()) {
delta = presentTime - animationIt->lastPresentTime;
}
animationIt->lastPresentTime = presentTime;
(*animationIt).timeLine.update(delta);
[effects] Rewrite the Glide effect Summary: There are several reasons why I "re-wrote" the Glide effect: * it doesn't work correctly because it suffers from undesired perspective distortions: {F5914378} The worst part is that windows are distorted so much on multiple monitor setups that it's hard to say whether that's glide animation. * window close animation is not quite intuitive: if the close button is located at the top and I click it, I would expect that window is rotated around the bottom edge, not the top; (IMHO) * it's too much distracting when working on something for quite good amount of time: e.g. when editing photos, which involves a big number of different dialogs; * there are issues with deletion of QTimeLine; * windows are not gracefully released if some other effect grabs them; * its code doesn't follow common coding style in KWin. So, the "new" Glide effect is more subtle, it's possible to have different rotation edges for window open/close animations, it doesn't animate special windows(like audio volume feedback), the code is simpler and readable. Yet, there are some issues with QTimeLine, which are common to all effects in KWin anyway. ### Demos {F5889803} //Window Open Animation// {F5889804} //Window Close Animation// {F5889805, layout=center, size=full} //KCM// CCBUG: 394245 Test Plan: * Enabled the Glide effect * Closed System Settings * Opened it again Reviewers: #kwin, #plasma, #vdg, davidedmundson Reviewed By: #kwin, #plasma, #vdg, davidedmundson Subscribers: ngraham, kwin Tags: #kwin Differential Revision: https://phabricator.kde.org/D13338
2018-06-01 09:56:33 +00:00
++animationIt;
}
data.mask |= PAINT_SCREEN_WITH_TRANSFORMED_WINDOWS;
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
}
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 GlideEffect::prePaintWindow(EffectWindow *w, WindowPrePaintData &data, std::chrono::milliseconds presentTime)
2011-01-30 14:34:42 +00:00
{
[effects] Rewrite the Glide effect Summary: There are several reasons why I "re-wrote" the Glide effect: * it doesn't work correctly because it suffers from undesired perspective distortions: {F5914378} The worst part is that windows are distorted so much on multiple monitor setups that it's hard to say whether that's glide animation. * window close animation is not quite intuitive: if the close button is located at the top and I click it, I would expect that window is rotated around the bottom edge, not the top; (IMHO) * it's too much distracting when working on something for quite good amount of time: e.g. when editing photos, which involves a big number of different dialogs; * there are issues with deletion of QTimeLine; * windows are not gracefully released if some other effect grabs them; * its code doesn't follow common coding style in KWin. So, the "new" Glide effect is more subtle, it's possible to have different rotation edges for window open/close animations, it doesn't animate special windows(like audio volume feedback), the code is simpler and readable. Yet, there are some issues with QTimeLine, which are common to all effects in KWin anyway. ### Demos {F5889803} //Window Open Animation// {F5889804} //Window Close Animation// {F5889805, layout=center, size=full} //KCM// CCBUG: 394245 Test Plan: * Enabled the Glide effect * Closed System Settings * Opened it again Reviewers: #kwin, #plasma, #vdg, davidedmundson Reviewed By: #kwin, #plasma, #vdg, davidedmundson Subscribers: ngraham, kwin Tags: #kwin Differential Revision: https://phabricator.kde.org/D13338
2018-06-01 09:56:33 +00:00
if (m_animations.contains(w)) {
data.setTransformed();
[effects] Rewrite the Glide effect Summary: There are several reasons why I "re-wrote" the Glide effect: * it doesn't work correctly because it suffers from undesired perspective distortions: {F5914378} The worst part is that windows are distorted so much on multiple monitor setups that it's hard to say whether that's glide animation. * window close animation is not quite intuitive: if the close button is located at the top and I click it, I would expect that window is rotated around the bottom edge, not the top; (IMHO) * it's too much distracting when working on something for quite good amount of time: e.g. when editing photos, which involves a big number of different dialogs; * there are issues with deletion of QTimeLine; * windows are not gracefully released if some other effect grabs them; * its code doesn't follow common coding style in KWin. So, the "new" Glide effect is more subtle, it's possible to have different rotation edges for window open/close animations, it doesn't animate special windows(like audio volume feedback), the code is simpler and readable. Yet, there are some issues with QTimeLine, which are common to all effects in KWin anyway. ### Demos {F5889803} //Window Open Animation// {F5889804} //Window Close Animation// {F5889805, layout=center, size=full} //KCM// CCBUG: 394245 Test Plan: * Enabled the Glide effect * Closed System Settings * Opened it again Reviewers: #kwin, #plasma, #vdg, davidedmundson Reviewed By: #kwin, #plasma, #vdg, davidedmundson Subscribers: ngraham, kwin Tags: #kwin Differential Revision: https://phabricator.kde.org/D13338
2018-06-01 09:56:33 +00:00
w->enablePainting(EffectWindow::PAINT_DISABLED_BY_DELETE);
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
effects->prePaintWindow(w, data, presentTime);
2011-01-30 14:34:42 +00:00
}
[effects] Rewrite the Glide effect Summary: There are several reasons why I "re-wrote" the Glide effect: * it doesn't work correctly because it suffers from undesired perspective distortions: {F5914378} The worst part is that windows are distorted so much on multiple monitor setups that it's hard to say whether that's glide animation. * window close animation is not quite intuitive: if the close button is located at the top and I click it, I would expect that window is rotated around the bottom edge, not the top; (IMHO) * it's too much distracting when working on something for quite good amount of time: e.g. when editing photos, which involves a big number of different dialogs; * there are issues with deletion of QTimeLine; * windows are not gracefully released if some other effect grabs them; * its code doesn't follow common coding style in KWin. So, the "new" Glide effect is more subtle, it's possible to have different rotation edges for window open/close animations, it doesn't animate special windows(like audio volume feedback), the code is simpler and readable. Yet, there are some issues with QTimeLine, which are common to all effects in KWin anyway. ### Demos {F5889803} //Window Open Animation// {F5889804} //Window Close Animation// {F5889805, layout=center, size=full} //KCM// CCBUG: 394245 Test Plan: * Enabled the Glide effect * Closed System Settings * Opened it again Reviewers: #kwin, #plasma, #vdg, davidedmundson Reviewed By: #kwin, #plasma, #vdg, davidedmundson Subscribers: ngraham, kwin Tags: #kwin Differential Revision: https://phabricator.kde.org/D13338
2018-06-01 09:56:33 +00:00
void GlideEffect::paintWindow(EffectWindow *w, int mask, QRegion region, WindowPaintData &data)
2011-01-30 14:34:42 +00:00
{
[effects] Rewrite the Glide effect Summary: There are several reasons why I "re-wrote" the Glide effect: * it doesn't work correctly because it suffers from undesired perspective distortions: {F5914378} The worst part is that windows are distorted so much on multiple monitor setups that it's hard to say whether that's glide animation. * window close animation is not quite intuitive: if the close button is located at the top and I click it, I would expect that window is rotated around the bottom edge, not the top; (IMHO) * it's too much distracting when working on something for quite good amount of time: e.g. when editing photos, which involves a big number of different dialogs; * there are issues with deletion of QTimeLine; * windows are not gracefully released if some other effect grabs them; * its code doesn't follow common coding style in KWin. So, the "new" Glide effect is more subtle, it's possible to have different rotation edges for window open/close animations, it doesn't animate special windows(like audio volume feedback), the code is simpler and readable. Yet, there are some issues with QTimeLine, which are common to all effects in KWin anyway. ### Demos {F5889803} //Window Open Animation// {F5889804} //Window Close Animation// {F5889805, layout=center, size=full} //KCM// CCBUG: 394245 Test Plan: * Enabled the Glide effect * Closed System Settings * Opened it again Reviewers: #kwin, #plasma, #vdg, davidedmundson Reviewed By: #kwin, #plasma, #vdg, davidedmundson Subscribers: ngraham, kwin Tags: #kwin Differential Revision: https://phabricator.kde.org/D13338
2018-06-01 09:56:33 +00:00
auto animationIt = m_animations.constFind(w);
if (animationIt == m_animations.constEnd()) {
effects->paintWindow(w, mask, region, data);
return;
}
// Perspective projection distorts objects near edges
// of the viewport. This is critical because distortions
// near edges of the viewport are not desired with this effect.
// To fix this, the center of the window will be moved to the origin,
// after applying perspective projection, the center is moved back
// to its "original" projected position. Overall, this is how the window
// will be transformed:
// [move to the origin] -> [rotate] -> [translate] ->
// -> [perspective projection] -> [reverse "move to the origin"]
const QMatrix4x4 oldProjMatrix = data.screenProjectionMatrix();
const QRectF windowGeo = w->geometry();
const QVector3D invOffset = oldProjMatrix.map(QVector3D(windowGeo.center()));
QMatrix4x4 invOffsetMatrix;
invOffsetMatrix.translate(invOffset.x(), invOffset.y());
data.setProjectionMatrix(invOffsetMatrix * oldProjMatrix);
// Move the center of the window to the origin.
const QRectF screenGeo = effects->virtualScreenGeometry();
const QPointF offset = screenGeo.center() - windowGeo.center();
data.translate(offset.x(), offset.y());
const GlideParams params = w->isDeleted() ? m_outParams : m_inParams;
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
const qreal t = (*animationIt).timeLine.value();
[effects] Rewrite the Glide effect Summary: There are several reasons why I "re-wrote" the Glide effect: * it doesn't work correctly because it suffers from undesired perspective distortions: {F5914378} The worst part is that windows are distorted so much on multiple monitor setups that it's hard to say whether that's glide animation. * window close animation is not quite intuitive: if the close button is located at the top and I click it, I would expect that window is rotated around the bottom edge, not the top; (IMHO) * it's too much distracting when working on something for quite good amount of time: e.g. when editing photos, which involves a big number of different dialogs; * there are issues with deletion of QTimeLine; * windows are not gracefully released if some other effect grabs them; * its code doesn't follow common coding style in KWin. So, the "new" Glide effect is more subtle, it's possible to have different rotation edges for window open/close animations, it doesn't animate special windows(like audio volume feedback), the code is simpler and readable. Yet, there are some issues with QTimeLine, which are common to all effects in KWin anyway. ### Demos {F5889803} //Window Open Animation// {F5889804} //Window Close Animation// {F5889805, layout=center, size=full} //KCM// CCBUG: 394245 Test Plan: * Enabled the Glide effect * Closed System Settings * Opened it again Reviewers: #kwin, #plasma, #vdg, davidedmundson Reviewed By: #kwin, #plasma, #vdg, davidedmundson Subscribers: ngraham, kwin Tags: #kwin Differential Revision: https://phabricator.kde.org/D13338
2018-06-01 09:56:33 +00:00
switch (params.edge) {
case RotationEdge::Top:
data.setRotationAxis(Qt::XAxis);
[effects] Rewrite the Glide effect Summary: There are several reasons why I "re-wrote" the Glide effect: * it doesn't work correctly because it suffers from undesired perspective distortions: {F5914378} The worst part is that windows are distorted so much on multiple monitor setups that it's hard to say whether that's glide animation. * window close animation is not quite intuitive: if the close button is located at the top and I click it, I would expect that window is rotated around the bottom edge, not the top; (IMHO) * it's too much distracting when working on something for quite good amount of time: e.g. when editing photos, which involves a big number of different dialogs; * there are issues with deletion of QTimeLine; * windows are not gracefully released if some other effect grabs them; * its code doesn't follow common coding style in KWin. So, the "new" Glide effect is more subtle, it's possible to have different rotation edges for window open/close animations, it doesn't animate special windows(like audio volume feedback), the code is simpler and readable. Yet, there are some issues with QTimeLine, which are common to all effects in KWin anyway. ### Demos {F5889803} //Window Open Animation// {F5889804} //Window Close Animation// {F5889805, layout=center, size=full} //KCM// CCBUG: 394245 Test Plan: * Enabled the Glide effect * Closed System Settings * Opened it again Reviewers: #kwin, #plasma, #vdg, davidedmundson Reviewed By: #kwin, #plasma, #vdg, davidedmundson Subscribers: ngraham, kwin Tags: #kwin Differential Revision: https://phabricator.kde.org/D13338
2018-06-01 09:56:33 +00:00
data.setRotationOrigin(QVector3D(0, 0, 0));
data.setRotationAngle(-interpolate(params.angle.from, params.angle.to, t));
break;
case RotationEdge::Right:
data.setRotationAxis(Qt::YAxis);
data.setRotationOrigin(QVector3D(w->width(), 0, 0));
data.setRotationAngle(-interpolate(params.angle.from, params.angle.to, t));
break;
case RotationEdge::Bottom:
data.setRotationAxis(Qt::XAxis);
data.setRotationOrigin(QVector3D(0, w->height(), 0));
data.setRotationAngle(interpolate(params.angle.from, params.angle.to, t));
break;
case RotationEdge::Left:
data.setRotationAxis(Qt::YAxis);
data.setRotationOrigin(QVector3D(0, 0, 0));
data.setRotationAngle(interpolate(params.angle.from, params.angle.to, t));
break;
default:
// Fallback to Top.
data.setRotationAxis(Qt::XAxis);
data.setRotationOrigin(QVector3D(0, 0, 0));
data.setRotationAngle(-interpolate(params.angle.from, params.angle.to, t));
break;
}
[effects] Rewrite the Glide effect Summary: There are several reasons why I "re-wrote" the Glide effect: * it doesn't work correctly because it suffers from undesired perspective distortions: {F5914378} The worst part is that windows are distorted so much on multiple monitor setups that it's hard to say whether that's glide animation. * window close animation is not quite intuitive: if the close button is located at the top and I click it, I would expect that window is rotated around the bottom edge, not the top; (IMHO) * it's too much distracting when working on something for quite good amount of time: e.g. when editing photos, which involves a big number of different dialogs; * there are issues with deletion of QTimeLine; * windows are not gracefully released if some other effect grabs them; * its code doesn't follow common coding style in KWin. So, the "new" Glide effect is more subtle, it's possible to have different rotation edges for window open/close animations, it doesn't animate special windows(like audio volume feedback), the code is simpler and readable. Yet, there are some issues with QTimeLine, which are common to all effects in KWin anyway. ### Demos {F5889803} //Window Open Animation// {F5889804} //Window Close Animation// {F5889805, layout=center, size=full} //KCM// CCBUG: 394245 Test Plan: * Enabled the Glide effect * Closed System Settings * Opened it again Reviewers: #kwin, #plasma, #vdg, davidedmundson Reviewed By: #kwin, #plasma, #vdg, davidedmundson Subscribers: ngraham, kwin Tags: #kwin Differential Revision: https://phabricator.kde.org/D13338
2018-06-01 09:56:33 +00:00
data.setZTranslation(-interpolate(params.distance.from, params.distance.to, t));
data.multiplyOpacity(interpolate(params.opacity.from, params.opacity.to, t));
2011-01-30 14:34:42 +00:00
effects->paintWindow(w, mask, region, data);
}
[effects] Rewrite the Glide effect Summary: There are several reasons why I "re-wrote" the Glide effect: * it doesn't work correctly because it suffers from undesired perspective distortions: {F5914378} The worst part is that windows are distorted so much on multiple monitor setups that it's hard to say whether that's glide animation. * window close animation is not quite intuitive: if the close button is located at the top and I click it, I would expect that window is rotated around the bottom edge, not the top; (IMHO) * it's too much distracting when working on something for quite good amount of time: e.g. when editing photos, which involves a big number of different dialogs; * there are issues with deletion of QTimeLine; * windows are not gracefully released if some other effect grabs them; * its code doesn't follow common coding style in KWin. So, the "new" Glide effect is more subtle, it's possible to have different rotation edges for window open/close animations, it doesn't animate special windows(like audio volume feedback), the code is simpler and readable. Yet, there are some issues with QTimeLine, which are common to all effects in KWin anyway. ### Demos {F5889803} //Window Open Animation// {F5889804} //Window Close Animation// {F5889805, layout=center, size=full} //KCM// CCBUG: 394245 Test Plan: * Enabled the Glide effect * Closed System Settings * Opened it again Reviewers: #kwin, #plasma, #vdg, davidedmundson Reviewed By: #kwin, #plasma, #vdg, davidedmundson Subscribers: ngraham, kwin Tags: #kwin Differential Revision: https://phabricator.kde.org/D13338
2018-06-01 09:56:33 +00:00
void GlideEffect::postPaintScreen()
2011-01-30 14:34:42 +00:00
{
[effects] Rewrite the Glide effect Summary: There are several reasons why I "re-wrote" the Glide effect: * it doesn't work correctly because it suffers from undesired perspective distortions: {F5914378} The worst part is that windows are distorted so much on multiple monitor setups that it's hard to say whether that's glide animation. * window close animation is not quite intuitive: if the close button is located at the top and I click it, I would expect that window is rotated around the bottom edge, not the top; (IMHO) * it's too much distracting when working on something for quite good amount of time: e.g. when editing photos, which involves a big number of different dialogs; * there are issues with deletion of QTimeLine; * windows are not gracefully released if some other effect grabs them; * its code doesn't follow common coding style in KWin. So, the "new" Glide effect is more subtle, it's possible to have different rotation edges for window open/close animations, it doesn't animate special windows(like audio volume feedback), the code is simpler and readable. Yet, there are some issues with QTimeLine, which are common to all effects in KWin anyway. ### Demos {F5889803} //Window Open Animation// {F5889804} //Window Close Animation// {F5889805, layout=center, size=full} //KCM// CCBUG: 394245 Test Plan: * Enabled the Glide effect * Closed System Settings * Opened it again Reviewers: #kwin, #plasma, #vdg, davidedmundson Reviewed By: #kwin, #plasma, #vdg, davidedmundson Subscribers: ngraham, kwin Tags: #kwin Differential Revision: https://phabricator.kde.org/D13338
2018-06-01 09:56:33 +00:00
auto animationIt = m_animations.begin();
while (animationIt != m_animations.end()) {
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
if ((*animationIt).timeLine.done()) {
[effects] Rewrite the Glide effect Summary: There are several reasons why I "re-wrote" the Glide effect: * it doesn't work correctly because it suffers from undesired perspective distortions: {F5914378} The worst part is that windows are distorted so much on multiple monitor setups that it's hard to say whether that's glide animation. * window close animation is not quite intuitive: if the close button is located at the top and I click it, I would expect that window is rotated around the bottom edge, not the top; (IMHO) * it's too much distracting when working on something for quite good amount of time: e.g. when editing photos, which involves a big number of different dialogs; * there are issues with deletion of QTimeLine; * windows are not gracefully released if some other effect grabs them; * its code doesn't follow common coding style in KWin. So, the "new" Glide effect is more subtle, it's possible to have different rotation edges for window open/close animations, it doesn't animate special windows(like audio volume feedback), the code is simpler and readable. Yet, there are some issues with QTimeLine, which are common to all effects in KWin anyway. ### Demos {F5889803} //Window Open Animation// {F5889804} //Window Close Animation// {F5889805, layout=center, size=full} //KCM// CCBUG: 394245 Test Plan: * Enabled the Glide effect * Closed System Settings * Opened it again Reviewers: #kwin, #plasma, #vdg, davidedmundson Reviewed By: #kwin, #plasma, #vdg, davidedmundson Subscribers: ngraham, kwin Tags: #kwin Differential Revision: https://phabricator.kde.org/D13338
2018-06-01 09:56:33 +00:00
EffectWindow *w = animationIt.key();
if (w->isDeleted()) {
w->unrefWindow();
}
animationIt = m_animations.erase(animationIt);
} else {
++animationIt;
}
}
effects->addRepaintFull();
effects->postPaintScreen();
2011-01-30 14:34:42 +00:00
}
[effects] Rewrite the Glide effect Summary: There are several reasons why I "re-wrote" the Glide effect: * it doesn't work correctly because it suffers from undesired perspective distortions: {F5914378} The worst part is that windows are distorted so much on multiple monitor setups that it's hard to say whether that's glide animation. * window close animation is not quite intuitive: if the close button is located at the top and I click it, I would expect that window is rotated around the bottom edge, not the top; (IMHO) * it's too much distracting when working on something for quite good amount of time: e.g. when editing photos, which involves a big number of different dialogs; * there are issues with deletion of QTimeLine; * windows are not gracefully released if some other effect grabs them; * its code doesn't follow common coding style in KWin. So, the "new" Glide effect is more subtle, it's possible to have different rotation edges for window open/close animations, it doesn't animate special windows(like audio volume feedback), the code is simpler and readable. Yet, there are some issues with QTimeLine, which are common to all effects in KWin anyway. ### Demos {F5889803} //Window Open Animation// {F5889804} //Window Close Animation// {F5889805, layout=center, size=full} //KCM// CCBUG: 394245 Test Plan: * Enabled the Glide effect * Closed System Settings * Opened it again Reviewers: #kwin, #plasma, #vdg, davidedmundson Reviewed By: #kwin, #plasma, #vdg, davidedmundson Subscribers: ngraham, kwin Tags: #kwin Differential Revision: https://phabricator.kde.org/D13338
2018-06-01 09:56:33 +00:00
bool GlideEffect::isActive() const
2011-01-30 14:34:42 +00:00
{
[effects] Rewrite the Glide effect Summary: There are several reasons why I "re-wrote" the Glide effect: * it doesn't work correctly because it suffers from undesired perspective distortions: {F5914378} The worst part is that windows are distorted so much on multiple monitor setups that it's hard to say whether that's glide animation. * window close animation is not quite intuitive: if the close button is located at the top and I click it, I would expect that window is rotated around the bottom edge, not the top; (IMHO) * it's too much distracting when working on something for quite good amount of time: e.g. when editing photos, which involves a big number of different dialogs; * there are issues with deletion of QTimeLine; * windows are not gracefully released if some other effect grabs them; * its code doesn't follow common coding style in KWin. So, the "new" Glide effect is more subtle, it's possible to have different rotation edges for window open/close animations, it doesn't animate special windows(like audio volume feedback), the code is simpler and readable. Yet, there are some issues with QTimeLine, which are common to all effects in KWin anyway. ### Demos {F5889803} //Window Open Animation// {F5889804} //Window Close Animation// {F5889805, layout=center, size=full} //KCM// CCBUG: 394245 Test Plan: * Enabled the Glide effect * Closed System Settings * Opened it again Reviewers: #kwin, #plasma, #vdg, davidedmundson Reviewed By: #kwin, #plasma, #vdg, davidedmundson Subscribers: ngraham, kwin Tags: #kwin Differential Revision: https://phabricator.kde.org/D13338
2018-06-01 09:56:33 +00:00
return !m_animations.isEmpty();
2011-01-30 14:34:42 +00:00
}
[effects] Rewrite the Glide effect Summary: There are several reasons why I "re-wrote" the Glide effect: * it doesn't work correctly because it suffers from undesired perspective distortions: {F5914378} The worst part is that windows are distorted so much on multiple monitor setups that it's hard to say whether that's glide animation. * window close animation is not quite intuitive: if the close button is located at the top and I click it, I would expect that window is rotated around the bottom edge, not the top; (IMHO) * it's too much distracting when working on something for quite good amount of time: e.g. when editing photos, which involves a big number of different dialogs; * there are issues with deletion of QTimeLine; * windows are not gracefully released if some other effect grabs them; * its code doesn't follow common coding style in KWin. So, the "new" Glide effect is more subtle, it's possible to have different rotation edges for window open/close animations, it doesn't animate special windows(like audio volume feedback), the code is simpler and readable. Yet, there are some issues with QTimeLine, which are common to all effects in KWin anyway. ### Demos {F5889803} //Window Open Animation// {F5889804} //Window Close Animation// {F5889805, layout=center, size=full} //KCM// CCBUG: 394245 Test Plan: * Enabled the Glide effect * Closed System Settings * Opened it again Reviewers: #kwin, #plasma, #vdg, davidedmundson Reviewed By: #kwin, #plasma, #vdg, davidedmundson Subscribers: ngraham, kwin Tags: #kwin Differential Revision: https://phabricator.kde.org/D13338
2018-06-01 09:56:33 +00:00
bool GlideEffect::supported()
2011-01-30 14:34:42 +00:00
{
[effects] Rewrite the Glide effect Summary: There are several reasons why I "re-wrote" the Glide effect: * it doesn't work correctly because it suffers from undesired perspective distortions: {F5914378} The worst part is that windows are distorted so much on multiple monitor setups that it's hard to say whether that's glide animation. * window close animation is not quite intuitive: if the close button is located at the top and I click it, I would expect that window is rotated around the bottom edge, not the top; (IMHO) * it's too much distracting when working on something for quite good amount of time: e.g. when editing photos, which involves a big number of different dialogs; * there are issues with deletion of QTimeLine; * windows are not gracefully released if some other effect grabs them; * its code doesn't follow common coding style in KWin. So, the "new" Glide effect is more subtle, it's possible to have different rotation edges for window open/close animations, it doesn't animate special windows(like audio volume feedback), the code is simpler and readable. Yet, there are some issues with QTimeLine, which are common to all effects in KWin anyway. ### Demos {F5889803} //Window Open Animation// {F5889804} //Window Close Animation// {F5889805, layout=center, size=full} //KCM// CCBUG: 394245 Test Plan: * Enabled the Glide effect * Closed System Settings * Opened it again Reviewers: #kwin, #plasma, #vdg, davidedmundson Reviewed By: #kwin, #plasma, #vdg, davidedmundson Subscribers: ngraham, kwin Tags: #kwin Differential Revision: https://phabricator.kde.org/D13338
2018-06-01 09:56:33 +00:00
return effects->isOpenGLCompositing()
&& effects->animationsSupported();
2011-01-30 14:34:42 +00:00
}
[effects] Rewrite the Glide effect Summary: There are several reasons why I "re-wrote" the Glide effect: * it doesn't work correctly because it suffers from undesired perspective distortions: {F5914378} The worst part is that windows are distorted so much on multiple monitor setups that it's hard to say whether that's glide animation. * window close animation is not quite intuitive: if the close button is located at the top and I click it, I would expect that window is rotated around the bottom edge, not the top; (IMHO) * it's too much distracting when working on something for quite good amount of time: e.g. when editing photos, which involves a big number of different dialogs; * there are issues with deletion of QTimeLine; * windows are not gracefully released if some other effect grabs them; * its code doesn't follow common coding style in KWin. So, the "new" Glide effect is more subtle, it's possible to have different rotation edges for window open/close animations, it doesn't animate special windows(like audio volume feedback), the code is simpler and readable. Yet, there are some issues with QTimeLine, which are common to all effects in KWin anyway. ### Demos {F5889803} //Window Open Animation// {F5889804} //Window Close Animation// {F5889805, layout=center, size=full} //KCM// CCBUG: 394245 Test Plan: * Enabled the Glide effect * Closed System Settings * Opened it again Reviewers: #kwin, #plasma, #vdg, davidedmundson Reviewed By: #kwin, #plasma, #vdg, davidedmundson Subscribers: ngraham, kwin Tags: #kwin Differential Revision: https://phabricator.kde.org/D13338
2018-06-01 09:56:33 +00:00
void GlideEffect::windowAdded(EffectWindow *w)
2011-01-30 14:34:42 +00:00
{
[effects] Rewrite the Glide effect Summary: There are several reasons why I "re-wrote" the Glide effect: * it doesn't work correctly because it suffers from undesired perspective distortions: {F5914378} The worst part is that windows are distorted so much on multiple monitor setups that it's hard to say whether that's glide animation. * window close animation is not quite intuitive: if the close button is located at the top and I click it, I would expect that window is rotated around the bottom edge, not the top; (IMHO) * it's too much distracting when working on something for quite good amount of time: e.g. when editing photos, which involves a big number of different dialogs; * there are issues with deletion of QTimeLine; * windows are not gracefully released if some other effect grabs them; * its code doesn't follow common coding style in KWin. So, the "new" Glide effect is more subtle, it's possible to have different rotation edges for window open/close animations, it doesn't animate special windows(like audio volume feedback), the code is simpler and readable. Yet, there are some issues with QTimeLine, which are common to all effects in KWin anyway. ### Demos {F5889803} //Window Open Animation// {F5889804} //Window Close Animation// {F5889805, layout=center, size=full} //KCM// CCBUG: 394245 Test Plan: * Enabled the Glide effect * Closed System Settings * Opened it again Reviewers: #kwin, #plasma, #vdg, davidedmundson Reviewed By: #kwin, #plasma, #vdg, davidedmundson Subscribers: ngraham, kwin Tags: #kwin Differential Revision: https://phabricator.kde.org/D13338
2018-06-01 09:56:33 +00:00
if (effects->activeFullScreenEffect()) {
return;
}
if (!isGlideWindow(w)) {
return;
[effects] Rewrite the Glide effect Summary: There are several reasons why I "re-wrote" the Glide effect: * it doesn't work correctly because it suffers from undesired perspective distortions: {F5914378} The worst part is that windows are distorted so much on multiple monitor setups that it's hard to say whether that's glide animation. * window close animation is not quite intuitive: if the close button is located at the top and I click it, I would expect that window is rotated around the bottom edge, not the top; (IMHO) * it's too much distracting when working on something for quite good amount of time: e.g. when editing photos, which involves a big number of different dialogs; * there are issues with deletion of QTimeLine; * windows are not gracefully released if some other effect grabs them; * its code doesn't follow common coding style in KWin. So, the "new" Glide effect is more subtle, it's possible to have different rotation edges for window open/close animations, it doesn't animate special windows(like audio volume feedback), the code is simpler and readable. Yet, there are some issues with QTimeLine, which are common to all effects in KWin anyway. ### Demos {F5889803} //Window Open Animation// {F5889804} //Window Close Animation// {F5889805, layout=center, size=full} //KCM// CCBUG: 394245 Test Plan: * Enabled the Glide effect * Closed System Settings * Opened it again Reviewers: #kwin, #plasma, #vdg, davidedmundson Reviewed By: #kwin, #plasma, #vdg, davidedmundson Subscribers: ngraham, kwin Tags: #kwin Differential Revision: https://phabricator.kde.org/D13338
2018-06-01 09:56:33 +00:00
}
if (!w->isVisible()) {
return;
}
2011-01-30 14:34:42 +00:00
const void *addGrab = w->data(WindowAddedGrabRole).value<void*>();
[effects] Rewrite the Glide effect Summary: There are several reasons why I "re-wrote" the Glide effect: * it doesn't work correctly because it suffers from undesired perspective distortions: {F5914378} The worst part is that windows are distorted so much on multiple monitor setups that it's hard to say whether that's glide animation. * window close animation is not quite intuitive: if the close button is located at the top and I click it, I would expect that window is rotated around the bottom edge, not the top; (IMHO) * it's too much distracting when working on something for quite good amount of time: e.g. when editing photos, which involves a big number of different dialogs; * there are issues with deletion of QTimeLine; * windows are not gracefully released if some other effect grabs them; * its code doesn't follow common coding style in KWin. So, the "new" Glide effect is more subtle, it's possible to have different rotation edges for window open/close animations, it doesn't animate special windows(like audio volume feedback), the code is simpler and readable. Yet, there are some issues with QTimeLine, which are common to all effects in KWin anyway. ### Demos {F5889803} //Window Open Animation// {F5889804} //Window Close Animation// {F5889805, layout=center, size=full} //KCM// CCBUG: 394245 Test Plan: * Enabled the Glide effect * Closed System Settings * Opened it again Reviewers: #kwin, #plasma, #vdg, davidedmundson Reviewed By: #kwin, #plasma, #vdg, davidedmundson Subscribers: ngraham, kwin Tags: #kwin Differential Revision: https://phabricator.kde.org/D13338
2018-06-01 09:56:33 +00:00
if (addGrab && addGrab != this) {
return;
[effects] Rewrite the Glide effect Summary: There are several reasons why I "re-wrote" the Glide effect: * it doesn't work correctly because it suffers from undesired perspective distortions: {F5914378} The worst part is that windows are distorted so much on multiple monitor setups that it's hard to say whether that's glide animation. * window close animation is not quite intuitive: if the close button is located at the top and I click it, I would expect that window is rotated around the bottom edge, not the top; (IMHO) * it's too much distracting when working on something for quite good amount of time: e.g. when editing photos, which involves a big number of different dialogs; * there are issues with deletion of QTimeLine; * windows are not gracefully released if some other effect grabs them; * its code doesn't follow common coding style in KWin. So, the "new" Glide effect is more subtle, it's possible to have different rotation edges for window open/close animations, it doesn't animate special windows(like audio volume feedback), the code is simpler and readable. Yet, there are some issues with QTimeLine, which are common to all effects in KWin anyway. ### Demos {F5889803} //Window Open Animation// {F5889804} //Window Close Animation// {F5889805, layout=center, size=full} //KCM// CCBUG: 394245 Test Plan: * Enabled the Glide effect * Closed System Settings * Opened it again Reviewers: #kwin, #plasma, #vdg, davidedmundson Reviewed By: #kwin, #plasma, #vdg, davidedmundson Subscribers: ngraham, kwin Tags: #kwin Differential Revision: https://phabricator.kde.org/D13338
2018-06-01 09:56:33 +00:00
}
2011-01-30 14:34:42 +00:00
w->setData(WindowAddedGrabRole, QVariant::fromValue(static_cast<void*>(this)));
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
GlideAnimation &animation = m_animations[w];
animation.timeLine.reset();
animation.timeLine.setDirection(TimeLine::Forward);
animation.timeLine.setDuration(m_duration);
animation.timeLine.setEasingCurve(QEasingCurve::InCurve);
[effects] Rewrite the Glide effect Summary: There are several reasons why I "re-wrote" the Glide effect: * it doesn't work correctly because it suffers from undesired perspective distortions: {F5914378} The worst part is that windows are distorted so much on multiple monitor setups that it's hard to say whether that's glide animation. * window close animation is not quite intuitive: if the close button is located at the top and I click it, I would expect that window is rotated around the bottom edge, not the top; (IMHO) * it's too much distracting when working on something for quite good amount of time: e.g. when editing photos, which involves a big number of different dialogs; * there are issues with deletion of QTimeLine; * windows are not gracefully released if some other effect grabs them; * its code doesn't follow common coding style in KWin. So, the "new" Glide effect is more subtle, it's possible to have different rotation edges for window open/close animations, it doesn't animate special windows(like audio volume feedback), the code is simpler and readable. Yet, there are some issues with QTimeLine, which are common to all effects in KWin anyway. ### Demos {F5889803} //Window Open Animation// {F5889804} //Window Close Animation// {F5889805, layout=center, size=full} //KCM// CCBUG: 394245 Test Plan: * Enabled the Glide effect * Closed System Settings * Opened it again Reviewers: #kwin, #plasma, #vdg, davidedmundson Reviewed By: #kwin, #plasma, #vdg, davidedmundson Subscribers: ngraham, kwin Tags: #kwin Differential Revision: https://phabricator.kde.org/D13338
2018-06-01 09:56:33 +00:00
effects->addRepaintFull();
2011-01-30 14:34:42 +00:00
}
[effects] Rewrite the Glide effect Summary: There are several reasons why I "re-wrote" the Glide effect: * it doesn't work correctly because it suffers from undesired perspective distortions: {F5914378} The worst part is that windows are distorted so much on multiple monitor setups that it's hard to say whether that's glide animation. * window close animation is not quite intuitive: if the close button is located at the top and I click it, I would expect that window is rotated around the bottom edge, not the top; (IMHO) * it's too much distracting when working on something for quite good amount of time: e.g. when editing photos, which involves a big number of different dialogs; * there are issues with deletion of QTimeLine; * windows are not gracefully released if some other effect grabs them; * its code doesn't follow common coding style in KWin. So, the "new" Glide effect is more subtle, it's possible to have different rotation edges for window open/close animations, it doesn't animate special windows(like audio volume feedback), the code is simpler and readable. Yet, there are some issues with QTimeLine, which are common to all effects in KWin anyway. ### Demos {F5889803} //Window Open Animation// {F5889804} //Window Close Animation// {F5889805, layout=center, size=full} //KCM// CCBUG: 394245 Test Plan: * Enabled the Glide effect * Closed System Settings * Opened it again Reviewers: #kwin, #plasma, #vdg, davidedmundson Reviewed By: #kwin, #plasma, #vdg, davidedmundson Subscribers: ngraham, kwin Tags: #kwin Differential Revision: https://phabricator.kde.org/D13338
2018-06-01 09:56:33 +00:00
void GlideEffect::windowClosed(EffectWindow *w)
2011-01-30 14:34:42 +00:00
{
[effects] Rewrite the Glide effect Summary: There are several reasons why I "re-wrote" the Glide effect: * it doesn't work correctly because it suffers from undesired perspective distortions: {F5914378} The worst part is that windows are distorted so much on multiple monitor setups that it's hard to say whether that's glide animation. * window close animation is not quite intuitive: if the close button is located at the top and I click it, I would expect that window is rotated around the bottom edge, not the top; (IMHO) * it's too much distracting when working on something for quite good amount of time: e.g. when editing photos, which involves a big number of different dialogs; * there are issues with deletion of QTimeLine; * windows are not gracefully released if some other effect grabs them; * its code doesn't follow common coding style in KWin. So, the "new" Glide effect is more subtle, it's possible to have different rotation edges for window open/close animations, it doesn't animate special windows(like audio volume feedback), the code is simpler and readable. Yet, there are some issues with QTimeLine, which are common to all effects in KWin anyway. ### Demos {F5889803} //Window Open Animation// {F5889804} //Window Close Animation// {F5889805, layout=center, size=full} //KCM// CCBUG: 394245 Test Plan: * Enabled the Glide effect * Closed System Settings * Opened it again Reviewers: #kwin, #plasma, #vdg, davidedmundson Reviewed By: #kwin, #plasma, #vdg, davidedmundson Subscribers: ngraham, kwin Tags: #kwin Differential Revision: https://phabricator.kde.org/D13338
2018-06-01 09:56:33 +00:00
if (effects->activeFullScreenEffect()) {
return;
}
if (!isGlideWindow(w)) {
return;
}
if (!w->isVisible()) {
return;
[effects] Rewrite the Glide effect Summary: There are several reasons why I "re-wrote" the Glide effect: * it doesn't work correctly because it suffers from undesired perspective distortions: {F5914378} The worst part is that windows are distorted so much on multiple monitor setups that it's hard to say whether that's glide animation. * window close animation is not quite intuitive: if the close button is located at the top and I click it, I would expect that window is rotated around the bottom edge, not the top; (IMHO) * it's too much distracting when working on something for quite good amount of time: e.g. when editing photos, which involves a big number of different dialogs; * there are issues with deletion of QTimeLine; * windows are not gracefully released if some other effect grabs them; * its code doesn't follow common coding style in KWin. So, the "new" Glide effect is more subtle, it's possible to have different rotation edges for window open/close animations, it doesn't animate special windows(like audio volume feedback), the code is simpler and readable. Yet, there are some issues with QTimeLine, which are common to all effects in KWin anyway. ### Demos {F5889803} //Window Open Animation// {F5889804} //Window Close Animation// {F5889805, layout=center, size=full} //KCM// CCBUG: 394245 Test Plan: * Enabled the Glide effect * Closed System Settings * Opened it again Reviewers: #kwin, #plasma, #vdg, davidedmundson Reviewed By: #kwin, #plasma, #vdg, davidedmundson Subscribers: ngraham, kwin Tags: #kwin Differential Revision: https://phabricator.kde.org/D13338
2018-06-01 09:56:33 +00:00
}
2011-01-30 14:34:42 +00:00
const void *closeGrab = w->data(WindowClosedGrabRole).value<void*>();
[effects] Rewrite the Glide effect Summary: There are several reasons why I "re-wrote" the Glide effect: * it doesn't work correctly because it suffers from undesired perspective distortions: {F5914378} The worst part is that windows are distorted so much on multiple monitor setups that it's hard to say whether that's glide animation. * window close animation is not quite intuitive: if the close button is located at the top and I click it, I would expect that window is rotated around the bottom edge, not the top; (IMHO) * it's too much distracting when working on something for quite good amount of time: e.g. when editing photos, which involves a big number of different dialogs; * there are issues with deletion of QTimeLine; * windows are not gracefully released if some other effect grabs them; * its code doesn't follow common coding style in KWin. So, the "new" Glide effect is more subtle, it's possible to have different rotation edges for window open/close animations, it doesn't animate special windows(like audio volume feedback), the code is simpler and readable. Yet, there are some issues with QTimeLine, which are common to all effects in KWin anyway. ### Demos {F5889803} //Window Open Animation// {F5889804} //Window Close Animation// {F5889805, layout=center, size=full} //KCM// CCBUG: 394245 Test Plan: * Enabled the Glide effect * Closed System Settings * Opened it again Reviewers: #kwin, #plasma, #vdg, davidedmundson Reviewed By: #kwin, #plasma, #vdg, davidedmundson Subscribers: ngraham, kwin Tags: #kwin Differential Revision: https://phabricator.kde.org/D13338
2018-06-01 09:56:33 +00:00
if (closeGrab && closeGrab != this) {
return;
[effects] Rewrite the Glide effect Summary: There are several reasons why I "re-wrote" the Glide effect: * it doesn't work correctly because it suffers from undesired perspective distortions: {F5914378} The worst part is that windows are distorted so much on multiple monitor setups that it's hard to say whether that's glide animation. * window close animation is not quite intuitive: if the close button is located at the top and I click it, I would expect that window is rotated around the bottom edge, not the top; (IMHO) * it's too much distracting when working on something for quite good amount of time: e.g. when editing photos, which involves a big number of different dialogs; * there are issues with deletion of QTimeLine; * windows are not gracefully released if some other effect grabs them; * its code doesn't follow common coding style in KWin. So, the "new" Glide effect is more subtle, it's possible to have different rotation edges for window open/close animations, it doesn't animate special windows(like audio volume feedback), the code is simpler and readable. Yet, there are some issues with QTimeLine, which are common to all effects in KWin anyway. ### Demos {F5889803} //Window Open Animation// {F5889804} //Window Close Animation// {F5889805, layout=center, size=full} //KCM// CCBUG: 394245 Test Plan: * Enabled the Glide effect * Closed System Settings * Opened it again Reviewers: #kwin, #plasma, #vdg, davidedmundson Reviewed By: #kwin, #plasma, #vdg, davidedmundson Subscribers: ngraham, kwin Tags: #kwin Differential Revision: https://phabricator.kde.org/D13338
2018-06-01 09:56:33 +00:00
}
w->refWindow();
2011-01-30 14:34:42 +00:00
w->setData(WindowClosedGrabRole, QVariant::fromValue(static_cast<void*>(this)));
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
GlideAnimation &animation = m_animations[w];
animation.timeLine.reset();
animation.timeLine.setDirection(TimeLine::Forward);
animation.timeLine.setDuration(m_duration);
animation.timeLine.setEasingCurve(QEasingCurve::OutCurve);
[effects] Rewrite the Glide effect Summary: There are several reasons why I "re-wrote" the Glide effect: * it doesn't work correctly because it suffers from undesired perspective distortions: {F5914378} The worst part is that windows are distorted so much on multiple monitor setups that it's hard to say whether that's glide animation. * window close animation is not quite intuitive: if the close button is located at the top and I click it, I would expect that window is rotated around the bottom edge, not the top; (IMHO) * it's too much distracting when working on something for quite good amount of time: e.g. when editing photos, which involves a big number of different dialogs; * there are issues with deletion of QTimeLine; * windows are not gracefully released if some other effect grabs them; * its code doesn't follow common coding style in KWin. So, the "new" Glide effect is more subtle, it's possible to have different rotation edges for window open/close animations, it doesn't animate special windows(like audio volume feedback), the code is simpler and readable. Yet, there are some issues with QTimeLine, which are common to all effects in KWin anyway. ### Demos {F5889803} //Window Open Animation// {F5889804} //Window Close Animation// {F5889805, layout=center, size=full} //KCM// CCBUG: 394245 Test Plan: * Enabled the Glide effect * Closed System Settings * Opened it again Reviewers: #kwin, #plasma, #vdg, davidedmundson Reviewed By: #kwin, #plasma, #vdg, davidedmundson Subscribers: ngraham, kwin Tags: #kwin Differential Revision: https://phabricator.kde.org/D13338
2018-06-01 09:56:33 +00:00
effects->addRepaintFull();
2011-01-30 14:34:42 +00:00
}
[effects] Rewrite the Glide effect Summary: There are several reasons why I "re-wrote" the Glide effect: * it doesn't work correctly because it suffers from undesired perspective distortions: {F5914378} The worst part is that windows are distorted so much on multiple monitor setups that it's hard to say whether that's glide animation. * window close animation is not quite intuitive: if the close button is located at the top and I click it, I would expect that window is rotated around the bottom edge, not the top; (IMHO) * it's too much distracting when working on something for quite good amount of time: e.g. when editing photos, which involves a big number of different dialogs; * there are issues with deletion of QTimeLine; * windows are not gracefully released if some other effect grabs them; * its code doesn't follow common coding style in KWin. So, the "new" Glide effect is more subtle, it's possible to have different rotation edges for window open/close animations, it doesn't animate special windows(like audio volume feedback), the code is simpler and readable. Yet, there are some issues with QTimeLine, which are common to all effects in KWin anyway. ### Demos {F5889803} //Window Open Animation// {F5889804} //Window Close Animation// {F5889805, layout=center, size=full} //KCM// CCBUG: 394245 Test Plan: * Enabled the Glide effect * Closed System Settings * Opened it again Reviewers: #kwin, #plasma, #vdg, davidedmundson Reviewed By: #kwin, #plasma, #vdg, davidedmundson Subscribers: ngraham, kwin Tags: #kwin Differential Revision: https://phabricator.kde.org/D13338
2018-06-01 09:56:33 +00:00
void GlideEffect::windowDeleted(EffectWindow *w)
2011-01-30 14:34:42 +00:00
{
[effects] Rewrite the Glide effect Summary: There are several reasons why I "re-wrote" the Glide effect: * it doesn't work correctly because it suffers from undesired perspective distortions: {F5914378} The worst part is that windows are distorted so much on multiple monitor setups that it's hard to say whether that's glide animation. * window close animation is not quite intuitive: if the close button is located at the top and I click it, I would expect that window is rotated around the bottom edge, not the top; (IMHO) * it's too much distracting when working on something for quite good amount of time: e.g. when editing photos, which involves a big number of different dialogs; * there are issues with deletion of QTimeLine; * windows are not gracefully released if some other effect grabs them; * its code doesn't follow common coding style in KWin. So, the "new" Glide effect is more subtle, it's possible to have different rotation edges for window open/close animations, it doesn't animate special windows(like audio volume feedback), the code is simpler and readable. Yet, there are some issues with QTimeLine, which are common to all effects in KWin anyway. ### Demos {F5889803} //Window Open Animation// {F5889804} //Window Close Animation// {F5889805, layout=center, size=full} //KCM// CCBUG: 394245 Test Plan: * Enabled the Glide effect * Closed System Settings * Opened it again Reviewers: #kwin, #plasma, #vdg, davidedmundson Reviewed By: #kwin, #plasma, #vdg, davidedmundson Subscribers: ngraham, kwin Tags: #kwin Differential Revision: https://phabricator.kde.org/D13338
2018-06-01 09:56:33 +00:00
m_animations.remove(w);
2011-01-30 14:34:42 +00:00
}
[effects] Rewrite the Glide effect Summary: There are several reasons why I "re-wrote" the Glide effect: * it doesn't work correctly because it suffers from undesired perspective distortions: {F5914378} The worst part is that windows are distorted so much on multiple monitor setups that it's hard to say whether that's glide animation. * window close animation is not quite intuitive: if the close button is located at the top and I click it, I would expect that window is rotated around the bottom edge, not the top; (IMHO) * it's too much distracting when working on something for quite good amount of time: e.g. when editing photos, which involves a big number of different dialogs; * there are issues with deletion of QTimeLine; * windows are not gracefully released if some other effect grabs them; * its code doesn't follow common coding style in KWin. So, the "new" Glide effect is more subtle, it's possible to have different rotation edges for window open/close animations, it doesn't animate special windows(like audio volume feedback), the code is simpler and readable. Yet, there are some issues with QTimeLine, which are common to all effects in KWin anyway. ### Demos {F5889803} //Window Open Animation// {F5889804} //Window Close Animation// {F5889805, layout=center, size=full} //KCM// CCBUG: 394245 Test Plan: * Enabled the Glide effect * Closed System Settings * Opened it again Reviewers: #kwin, #plasma, #vdg, davidedmundson Reviewed By: #kwin, #plasma, #vdg, davidedmundson Subscribers: ngraham, kwin Tags: #kwin Differential Revision: https://phabricator.kde.org/D13338
2018-06-01 09:56:33 +00:00
void GlideEffect::windowDataChanged(EffectWindow *w, int role)
{
[effects] Rewrite the Glide effect Summary: There are several reasons why I "re-wrote" the Glide effect: * it doesn't work correctly because it suffers from undesired perspective distortions: {F5914378} The worst part is that windows are distorted so much on multiple monitor setups that it's hard to say whether that's glide animation. * window close animation is not quite intuitive: if the close button is located at the top and I click it, I would expect that window is rotated around the bottom edge, not the top; (IMHO) * it's too much distracting when working on something for quite good amount of time: e.g. when editing photos, which involves a big number of different dialogs; * there are issues with deletion of QTimeLine; * windows are not gracefully released if some other effect grabs them; * its code doesn't follow common coding style in KWin. So, the "new" Glide effect is more subtle, it's possible to have different rotation edges for window open/close animations, it doesn't animate special windows(like audio volume feedback), the code is simpler and readable. Yet, there are some issues with QTimeLine, which are common to all effects in KWin anyway. ### Demos {F5889803} //Window Open Animation// {F5889804} //Window Close Animation// {F5889805, layout=center, size=full} //KCM// CCBUG: 394245 Test Plan: * Enabled the Glide effect * Closed System Settings * Opened it again Reviewers: #kwin, #plasma, #vdg, davidedmundson Reviewed By: #kwin, #plasma, #vdg, davidedmundson Subscribers: ngraham, kwin Tags: #kwin Differential Revision: https://phabricator.kde.org/D13338
2018-06-01 09:56:33 +00:00
if (role != WindowAddedGrabRole && role != WindowClosedGrabRole) {
return;
}
[effects] Rewrite the Glide effect Summary: There are several reasons why I "re-wrote" the Glide effect: * it doesn't work correctly because it suffers from undesired perspective distortions: {F5914378} The worst part is that windows are distorted so much on multiple monitor setups that it's hard to say whether that's glide animation. * window close animation is not quite intuitive: if the close button is located at the top and I click it, I would expect that window is rotated around the bottom edge, not the top; (IMHO) * it's too much distracting when working on something for quite good amount of time: e.g. when editing photos, which involves a big number of different dialogs; * there are issues with deletion of QTimeLine; * windows are not gracefully released if some other effect grabs them; * its code doesn't follow common coding style in KWin. So, the "new" Glide effect is more subtle, it's possible to have different rotation edges for window open/close animations, it doesn't animate special windows(like audio volume feedback), the code is simpler and readable. Yet, there are some issues with QTimeLine, which are common to all effects in KWin anyway. ### Demos {F5889803} //Window Open Animation// {F5889804} //Window Close Animation// {F5889805, layout=center, size=full} //KCM// CCBUG: 394245 Test Plan: * Enabled the Glide effect * Closed System Settings * Opened it again Reviewers: #kwin, #plasma, #vdg, davidedmundson Reviewed By: #kwin, #plasma, #vdg, davidedmundson Subscribers: ngraham, kwin Tags: #kwin Differential Revision: https://phabricator.kde.org/D13338
2018-06-01 09:56:33 +00:00
if (w->data(role).value<void*>() == this) {
return;
}
[effects] Rewrite the Glide effect Summary: There are several reasons why I "re-wrote" the Glide effect: * it doesn't work correctly because it suffers from undesired perspective distortions: {F5914378} The worst part is that windows are distorted so much on multiple monitor setups that it's hard to say whether that's glide animation. * window close animation is not quite intuitive: if the close button is located at the top and I click it, I would expect that window is rotated around the bottom edge, not the top; (IMHO) * it's too much distracting when working on something for quite good amount of time: e.g. when editing photos, which involves a big number of different dialogs; * there are issues with deletion of QTimeLine; * windows are not gracefully released if some other effect grabs them; * its code doesn't follow common coding style in KWin. So, the "new" Glide effect is more subtle, it's possible to have different rotation edges for window open/close animations, it doesn't animate special windows(like audio volume feedback), the code is simpler and readable. Yet, there are some issues with QTimeLine, which are common to all effects in KWin anyway. ### Demos {F5889803} //Window Open Animation// {F5889804} //Window Close Animation// {F5889805, layout=center, size=full} //KCM// CCBUG: 394245 Test Plan: * Enabled the Glide effect * Closed System Settings * Opened it again Reviewers: #kwin, #plasma, #vdg, davidedmundson Reviewed By: #kwin, #plasma, #vdg, davidedmundson Subscribers: ngraham, kwin Tags: #kwin Differential Revision: https://phabricator.kde.org/D13338
2018-06-01 09:56:33 +00:00
auto animationIt = m_animations.find(w);
if (animationIt == m_animations.end()) {
return;
}
[effects] Rewrite the Glide effect Summary: There are several reasons why I "re-wrote" the Glide effect: * it doesn't work correctly because it suffers from undesired perspective distortions: {F5914378} The worst part is that windows are distorted so much on multiple monitor setups that it's hard to say whether that's glide animation. * window close animation is not quite intuitive: if the close button is located at the top and I click it, I would expect that window is rotated around the bottom edge, not the top; (IMHO) * it's too much distracting when working on something for quite good amount of time: e.g. when editing photos, which involves a big number of different dialogs; * there are issues with deletion of QTimeLine; * windows are not gracefully released if some other effect grabs them; * its code doesn't follow common coding style in KWin. So, the "new" Glide effect is more subtle, it's possible to have different rotation edges for window open/close animations, it doesn't animate special windows(like audio volume feedback), the code is simpler and readable. Yet, there are some issues with QTimeLine, which are common to all effects in KWin anyway. ### Demos {F5889803} //Window Open Animation// {F5889804} //Window Close Animation// {F5889805, layout=center, size=full} //KCM// CCBUG: 394245 Test Plan: * Enabled the Glide effect * Closed System Settings * Opened it again Reviewers: #kwin, #plasma, #vdg, davidedmundson Reviewed By: #kwin, #plasma, #vdg, davidedmundson Subscribers: ngraham, kwin Tags: #kwin Differential Revision: https://phabricator.kde.org/D13338
2018-06-01 09:56:33 +00:00
if (w->isDeleted() && role == WindowClosedGrabRole) {
w->unrefWindow();
}
[effects] Rewrite the Glide effect Summary: There are several reasons why I "re-wrote" the Glide effect: * it doesn't work correctly because it suffers from undesired perspective distortions: {F5914378} The worst part is that windows are distorted so much on multiple monitor setups that it's hard to say whether that's glide animation. * window close animation is not quite intuitive: if the close button is located at the top and I click it, I would expect that window is rotated around the bottom edge, not the top; (IMHO) * it's too much distracting when working on something for quite good amount of time: e.g. when editing photos, which involves a big number of different dialogs; * there are issues with deletion of QTimeLine; * windows are not gracefully released if some other effect grabs them; * its code doesn't follow common coding style in KWin. So, the "new" Glide effect is more subtle, it's possible to have different rotation edges for window open/close animations, it doesn't animate special windows(like audio volume feedback), the code is simpler and readable. Yet, there are some issues with QTimeLine, which are common to all effects in KWin anyway. ### Demos {F5889803} //Window Open Animation// {F5889804} //Window Close Animation// {F5889805, layout=center, size=full} //KCM// CCBUG: 394245 Test Plan: * Enabled the Glide effect * Closed System Settings * Opened it again Reviewers: #kwin, #plasma, #vdg, davidedmundson Reviewed By: #kwin, #plasma, #vdg, davidedmundson Subscribers: ngraham, kwin Tags: #kwin Differential Revision: https://phabricator.kde.org/D13338
2018-06-01 09:56:33 +00:00
m_animations.erase(animationIt);
}
[effects] Rewrite the Glide effect Summary: There are several reasons why I "re-wrote" the Glide effect: * it doesn't work correctly because it suffers from undesired perspective distortions: {F5914378} The worst part is that windows are distorted so much on multiple monitor setups that it's hard to say whether that's glide animation. * window close animation is not quite intuitive: if the close button is located at the top and I click it, I would expect that window is rotated around the bottom edge, not the top; (IMHO) * it's too much distracting when working on something for quite good amount of time: e.g. when editing photos, which involves a big number of different dialogs; * there are issues with deletion of QTimeLine; * windows are not gracefully released if some other effect grabs them; * its code doesn't follow common coding style in KWin. So, the "new" Glide effect is more subtle, it's possible to have different rotation edges for window open/close animations, it doesn't animate special windows(like audio volume feedback), the code is simpler and readable. Yet, there are some issues with QTimeLine, which are common to all effects in KWin anyway. ### Demos {F5889803} //Window Open Animation// {F5889804} //Window Close Animation// {F5889805, layout=center, size=full} //KCM// CCBUG: 394245 Test Plan: * Enabled the Glide effect * Closed System Settings * Opened it again Reviewers: #kwin, #plasma, #vdg, davidedmundson Reviewed By: #kwin, #plasma, #vdg, davidedmundson Subscribers: ngraham, kwin Tags: #kwin Differential Revision: https://phabricator.kde.org/D13338
2018-06-01 09:56:33 +00:00
bool GlideEffect::isGlideWindow(EffectWindow *w) const
{
// We don't want to animate most of plasmashell's windows, yet, some
// of them we want to, for example, Task Manager Settings window.
// The problem is that all those window share single window class.
// So, the only way to decide whether a window should be animated is
// to use a heuristic: if a window has decoration, then it's most
// likely a dialog or a settings window so we have to animate it.
if (w->windowClass() == QLatin1String("plasmashell plasmashell")
|| w->windowClass() == QLatin1String("plasmashell org.kde.plasmashell")) {
return w->hasDecoration();
}
[effects] Rewrite the Glide effect Summary: There are several reasons why I "re-wrote" the Glide effect: * it doesn't work correctly because it suffers from undesired perspective distortions: {F5914378} The worst part is that windows are distorted so much on multiple monitor setups that it's hard to say whether that's glide animation. * window close animation is not quite intuitive: if the close button is located at the top and I click it, I would expect that window is rotated around the bottom edge, not the top; (IMHO) * it's too much distracting when working on something for quite good amount of time: e.g. when editing photos, which involves a big number of different dialogs; * there are issues with deletion of QTimeLine; * windows are not gracefully released if some other effect grabs them; * its code doesn't follow common coding style in KWin. So, the "new" Glide effect is more subtle, it's possible to have different rotation edges for window open/close animations, it doesn't animate special windows(like audio volume feedback), the code is simpler and readable. Yet, there are some issues with QTimeLine, which are common to all effects in KWin anyway. ### Demos {F5889803} //Window Open Animation// {F5889804} //Window Close Animation// {F5889805, layout=center, size=full} //KCM// CCBUG: 394245 Test Plan: * Enabled the Glide effect * Closed System Settings * Opened it again Reviewers: #kwin, #plasma, #vdg, davidedmundson Reviewed By: #kwin, #plasma, #vdg, davidedmundson Subscribers: ngraham, kwin Tags: #kwin Differential Revision: https://phabricator.kde.org/D13338
2018-06-01 09:56:33 +00:00
if (s_blacklist.contains(w->windowClass())) {
return false;
}
if (w->hasDecoration()) {
return true;
}
// Don't animate combobox popups, tooltips, popup menus, etc.
if (w->isPopupWindow()) {
return false;
}
2019-11-26 17:48:29 +00:00
// Don't animate the outline because it looks very sick.
if (w->isOutline()) {
return false;
}
// Override-redirect windows are usually used for user interface
// concepts that are not expected to be animated by this effect.
if (w->isX11Client() && !w->isManaged()) {
[effects] Rewrite the Glide effect Summary: There are several reasons why I "re-wrote" the Glide effect: * it doesn't work correctly because it suffers from undesired perspective distortions: {F5914378} The worst part is that windows are distorted so much on multiple monitor setups that it's hard to say whether that's glide animation. * window close animation is not quite intuitive: if the close button is located at the top and I click it, I would expect that window is rotated around the bottom edge, not the top; (IMHO) * it's too much distracting when working on something for quite good amount of time: e.g. when editing photos, which involves a big number of different dialogs; * there are issues with deletion of QTimeLine; * windows are not gracefully released if some other effect grabs them; * its code doesn't follow common coding style in KWin. So, the "new" Glide effect is more subtle, it's possible to have different rotation edges for window open/close animations, it doesn't animate special windows(like audio volume feedback), the code is simpler and readable. Yet, there are some issues with QTimeLine, which are common to all effects in KWin anyway. ### Demos {F5889803} //Window Open Animation// {F5889804} //Window Close Animation// {F5889805, layout=center, size=full} //KCM// CCBUG: 394245 Test Plan: * Enabled the Glide effect * Closed System Settings * Opened it again Reviewers: #kwin, #plasma, #vdg, davidedmundson Reviewed By: #kwin, #plasma, #vdg, davidedmundson Subscribers: ngraham, kwin Tags: #kwin Differential Revision: https://phabricator.kde.org/D13338
2018-06-01 09:56:33 +00:00
return false;
}
return w->isNormalWindow()
|| w->isDialog();
}
[effects] Rewrite the Glide effect Summary: There are several reasons why I "re-wrote" the Glide effect: * it doesn't work correctly because it suffers from undesired perspective distortions: {F5914378} The worst part is that windows are distorted so much on multiple monitor setups that it's hard to say whether that's glide animation. * window close animation is not quite intuitive: if the close button is located at the top and I click it, I would expect that window is rotated around the bottom edge, not the top; (IMHO) * it's too much distracting when working on something for quite good amount of time: e.g. when editing photos, which involves a big number of different dialogs; * there are issues with deletion of QTimeLine; * windows are not gracefully released if some other effect grabs them; * its code doesn't follow common coding style in KWin. So, the "new" Glide effect is more subtle, it's possible to have different rotation edges for window open/close animations, it doesn't animate special windows(like audio volume feedback), the code is simpler and readable. Yet, there are some issues with QTimeLine, which are common to all effects in KWin anyway. ### Demos {F5889803} //Window Open Animation// {F5889804} //Window Close Animation// {F5889805, layout=center, size=full} //KCM// CCBUG: 394245 Test Plan: * Enabled the Glide effect * Closed System Settings * Opened it again Reviewers: #kwin, #plasma, #vdg, davidedmundson Reviewed By: #kwin, #plasma, #vdg, davidedmundson Subscribers: ngraham, kwin Tags: #kwin Differential Revision: https://phabricator.kde.org/D13338
2018-06-01 09:56:33 +00:00
} // namespace KWin