- fixes calculation of WindowMotionManager in case a new destination is set when the window is not at its original position and provide a function to check if windows
are currently moving (by Thomas Lübking) - make use of new function and bugfix in SlideBack effect
This commit is contained in:
parent
2f10503ee5
commit
e1bf590a1c
3 changed files with 18 additions and 8 deletions
|
@ -214,9 +214,7 @@ void SlideBackEffect::postPaintWindow(EffectWindow* w)
|
||||||
{
|
{
|
||||||
if (motionManager.isManaging(w)) {
|
if (motionManager.isManaging(w)) {
|
||||||
if (destinationList.contains(w)) {
|
if (destinationList.contains(w)) {
|
||||||
// has window reched its destination?
|
if (!motionManager.isWindowMoving(w)) { // has window reched its destination?
|
||||||
if ((qAbs(motionManager.transformedGeometry(w).x() - destinationList[w].x()) < 1) &&
|
|
||||||
(qAbs(motionManager.transformedGeometry(w).y() - destinationList[w].y()) < 1)) {
|
|
||||||
// If we are still intersecting with the activeWindow it is moving. slide to somewhere else
|
// If we are still intersecting with the activeWindow it is moving. slide to somewhere else
|
||||||
// restore the stacking order of all windows not intersecting any more except panels
|
// restore the stacking order of all windows not intersecting any more except panels
|
||||||
if (coveringWindows.contains(w)) {
|
if (coveringWindows.contains(w)) {
|
||||||
|
@ -258,8 +256,7 @@ void SlideBackEffect::postPaintWindow(EffectWindow* w)
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// is window back at its original position?
|
// is window back at its original position?
|
||||||
if ((qAbs(motionManager.transformedGeometry(w).x() - w->geometry().x()) < 1) &&
|
if (!motionManager.isWindowMoving(w)) {
|
||||||
(qAbs(motionManager.transformedGeometry(w).y() - w->geometry().y()) < 1)) {
|
|
||||||
motionManager.unmanage(w);
|
motionManager.unmanage(w);
|
||||||
effects->addRepaintFull();
|
effects->addRepaintFull();
|
||||||
}
|
}
|
||||||
|
|
|
@ -905,8 +905,8 @@ void WindowMotionManager::calculate(int time)
|
||||||
else {
|
else {
|
||||||
// Still moving
|
// Still moving
|
||||||
trans->calculate(time);
|
trans->calculate(time);
|
||||||
const short fx = trans->target().x() <= window->x() ? -1 : 1;
|
const short fx = trans->target().x() <= trans->startValue().x() ? -1 : 1;
|
||||||
const short fy = trans->target().y() <= window->y() ? -1 : 1;
|
const short fy = trans->target().y() <= trans->startValue().y() ? -1 : 1;
|
||||||
if (trans->distance().x()*fx/0.5 < 1.0 && trans->velocity().x()*fx/0.2 < 1.0 &&
|
if (trans->distance().x()*fx/0.5 < 1.0 && trans->velocity().x()*fx/0.2 < 1.0 &&
|
||||||
trans->distance().y()*fy/0.5 < 1.0 && trans->velocity().y()*fy/0.2 < 1.0) {
|
trans->distance().y()*fy/0.5 < 1.0 && trans->velocity().y()*fy/0.2 < 1.0) {
|
||||||
// Hide tiny oscillations
|
// Hide tiny oscillations
|
||||||
|
|
|
@ -1534,6 +1534,7 @@ public:
|
||||||
return m_target;
|
return m_target;
|
||||||
}
|
}
|
||||||
inline void setTarget(const T target) {
|
inline void setTarget(const T target) {
|
||||||
|
m_start = m_value;
|
||||||
m_target = target;
|
m_target = target;
|
||||||
}
|
}
|
||||||
inline T velocity() const {
|
inline T velocity() const {
|
||||||
|
@ -1555,6 +1556,9 @@ public:
|
||||||
inline void setSmoothness(const double smoothness) {
|
inline void setSmoothness(const double smoothness) {
|
||||||
m_smoothness = smoothness;
|
m_smoothness = smoothness;
|
||||||
}
|
}
|
||||||
|
inline T startValue() {
|
||||||
|
return m_start;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The distance between the current position and the target.
|
* The distance between the current position and the target.
|
||||||
|
@ -1576,7 +1580,7 @@ public:
|
||||||
|
|
||||||
private:
|
private:
|
||||||
T m_value;
|
T m_value;
|
||||||
|
T m_start;
|
||||||
T m_target;
|
T m_target;
|
||||||
T m_velocity;
|
T m_velocity;
|
||||||
double m_strength;
|
double m_strength;
|
||||||
|
@ -1753,6 +1757,13 @@ public:
|
||||||
inline bool areWindowsMoving() {
|
inline bool areWindowsMoving() {
|
||||||
return !m_movingWindowsSet.isEmpty();
|
return !m_movingWindowsSet.isEmpty();
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* Returns whether a window has reached its targets yet
|
||||||
|
* or not.
|
||||||
|
*/
|
||||||
|
inline bool isWindowMoving(EffectWindow *w) {
|
||||||
|
return m_movingWindowsSet.contains(w);
|
||||||
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
bool m_useGlobalAnimationModifier;
|
bool m_useGlobalAnimationModifier;
|
||||||
|
@ -2067,6 +2078,7 @@ double WindowQuad::originalBottom() const
|
||||||
template <typename T>
|
template <typename T>
|
||||||
Motion<T>::Motion(T initial, double strength, double smoothness)
|
Motion<T>::Motion(T initial, double strength, double smoothness)
|
||||||
: m_value(initial)
|
: m_value(initial)
|
||||||
|
, m_start(initial)
|
||||||
, m_target(initial)
|
, m_target(initial)
|
||||||
, m_velocity()
|
, m_velocity()
|
||||||
, m_strength(strength)
|
, m_strength(strength)
|
||||||
|
@ -2077,6 +2089,7 @@ Motion<T>::Motion(T initial, double strength, double smoothness)
|
||||||
template <typename T>
|
template <typename T>
|
||||||
Motion<T>::Motion(const Motion &other)
|
Motion<T>::Motion(const Motion &other)
|
||||||
: m_value(other.value())
|
: m_value(other.value())
|
||||||
|
, m_start(other.target())
|
||||||
, m_target(other.target())
|
, m_target(other.target())
|
||||||
, m_velocity(other.velocity())
|
, m_velocity(other.velocity())
|
||||||
, m_strength(other.strength())
|
, m_strength(other.strength())
|
||||||
|
|
Loading…
Reference in a new issue