19 :
Motion<double>(initial, strength, smoothness)
37 :
Motion<QPointF>(initial, strength, smoothness)
55 : m_useGlobalAnimationModifier(useGlobalAnimationModifier)
67 if (m_managedWindows.contains(w)) {
71 double strength = 0.08;
72 double smoothness = 4.0;
79 WindowMotion &motion = m_managedWindows[w];
86 motion.scale.
setValue(QPointF(1.0, 1.0));
91 m_movingWindowsSet.remove(w);
92 m_managedWindows.remove(w);
97 m_managedWindows.clear();
98 m_movingWindowsSet.clear();
105 m_movingWindowsSet.clear();
106 QHash<EffectWindow *, WindowMotion>::iterator it = m_managedWindows.begin();
107 for (; it != m_managedWindows.end(); ++it) {
108 WindowMotion *motion = &it.value();
109 motion->translation.
finish();
114 QHash<EffectWindow *, WindowMotion>::iterator it = m_managedWindows.begin();
115 for (; it != m_managedWindows.end(); ++it) {
116 WindowMotion *motion = &it.value();
122 Motion2D *trans = &motion->translation;
130 if (trans->
distance().x() * fx / 0.5 < 1.0 && trans->
velocity().x() * fx / 0.2 < 1.0
131 && trans->
distance().y() * fy / 0.5 < 1.0 && trans->
velocity().y() * fy / 0.2 < 1.0) {
133 motion->translation.
finish();
144 const short fx = scale->
target().x() < 1.0 ? -1 : 1;
145 const short fy = scale->
target().y() < 1.0 ? -1 : 1;
146 if (scale->
distance().x() * fx / 0.001 < 1.0 && scale->
velocity().x() * fx / 0.05 < 1.0
147 && scale->
distance().y() * fy / 0.001 < 1.0 && scale->
velocity().y() * fy / 0.05 < 1.0) {
156 m_movingWindowsSet.remove(it.key());
163 QHash<EffectWindow *, WindowMotion>::iterator it = m_managedWindows.begin();
164 for (; it != m_managedWindows.end(); ++it) {
165 WindowMotion *motion = &it.value();
168 motion->translation.
finish();
169 motion->scale.
setTarget(QPointF(1.0, 1.0));
176 QHash<EffectWindow *, WindowMotion>::iterator it = m_managedWindows.find(w);
177 if (it == m_managedWindows.end()) {
181 WindowMotion *motion = &it.value();
183 motion->translation.
finish();
184 motion->scale.
setTarget(QPointF(1.0, 1.0));
190 QHash<EffectWindow *, WindowMotion>::iterator it = m_managedWindows.find(w);
191 if (it == m_managedWindows.end()) {
196 WindowMotion *motion = &it.value();
197 data += (motion->translation.
value() - QPointF(w->
x(), w->
y()));
198 data *= QVector2D(motion->scale.
value());
203 QHash<EffectWindow *, WindowMotion>::iterator it = m_managedWindows.find(w);
204 Q_ASSERT(it != m_managedWindows.end());
206 WindowMotion *motion = &it.value();
211 QPointF scalePoint(scale, yScale);
213 if (motion->translation.
value() == target && motion->scale.
value() == scalePoint) {
220 m_movingWindowsSet << w;
225 QHash<EffectWindow *, WindowMotion>::const_iterator it = m_managedWindows.constFind(w);
226 if (it == m_managedWindows.end()) {
230 const WindowMotion *motion = &it.value();
234 geometry.moveTo(motion->translation.
value());
235 geometry.setWidth(geometry.width() * motion->scale.
value().x());
236 geometry.setHeight(geometry.height() * motion->scale.
value().y());
243 QHash<EffectWindow *, WindowMotion>::iterator it = m_managedWindows.find(w);
244 if (it == m_managedWindows.end()) {
247 WindowMotion *motion = &it.value();
248 motion->translation.
setValue(geometry.topLeft());
249 motion->scale.
setValue(QPointF(geometry.width() / qreal(w->
width()), geometry.height() / qreal(w->
height())));
254 QHash<EffectWindow *, WindowMotion>::const_iterator it = m_managedWindows.constFind(w);
255 if (it == m_managedWindows.end()) {
259 const WindowMotion *motion = &it.value();
263 geometry.moveTo(motion->translation.
target());
264 geometry.setWidth(geometry.width() * motion->scale.
target().x());
265 geometry.setHeight(geometry.height() * motion->scale.
target().y());
273 QHash<EffectWindow *, WindowMotion>::ConstIterator it = m_managedWindows.constBegin();
274 while (it != m_managedWindows.constEnd()) {
Representation of a window used by/for Effect classes.
QRectF frameGeometry() const
qreal animationTimeFactor
A single 1D motion dynamics object.
Motion1D(double initial=0.0, double strength=0.08, double smoothness=4.0)
A single 2D motion dynamics object.
Motion2D(QPointF initial=QPointF(), double strength=0.08, double smoothness=4.0)
void setTarget(const T target)
void setSmoothness(const double smoothness)
void calculate(const int msec)
void setStrength(const double strength)
void setValue(const T value)
EffectWindow * windowAtPoint(QPoint point, bool useStackingOrder=true) const
WindowMotionManager(bool useGlobalAnimationModifier=true)
void unmanage(EffectWindow *w)
void manage(EffectWindow *w)
QRectF targetGeometry(EffectWindow *w) const
void apply(EffectWindow *w, WindowPaintData &data)
void moveWindow(EffectWindow *w, QPoint target, double scale=1.0, double yScale=0.0)
QRectF transformedGeometry(EffectWindow *w) const
void setTransformedGeometry(EffectWindow *w, const QRectF &geometry)