29 explicit Motion(T initial,
double strength,
double smoothness);
60 m_velocity = velocity;
69 m_strength = strength;
77 m_smoothness = smoothness;
89 return m_target - m_value;
122 explicit Motion1D(
double initial = 0.0,
double strength = 0.08,
double smoothness = 4.0);
137 explicit Motion2D(QPointF initial = QPointF(),
double strength = 0.08,
double smoothness = 4.0);
170 inline void manage(
const QList<EffectWindow *> &list)
172 for (
int i = 0; i < list.size(); i++) {
192 void calculate(
int time);
219 void moveWindow(
EffectWindow *w, QPoint target,
double scale = 1.0,
double yScale = 0.0);
229 moveWindow(w, target.topLeft(),
230 target.width() /
double(w->
width()), target.height() /
double(w->
height()));
243 void setTransformedGeometry(
EffectWindow *w,
const QRectF &geometry);
255 EffectWindow *windowAtPoint(QPoint point,
bool useStackingOrder =
true)
const;
262 return m_managedWindows.keys();
270 return m_managedWindows.contains(w);
278 return !m_managedWindows.empty();
287 return !m_movingWindowsSet.isEmpty();
295 return m_movingWindowsSet.contains(w);
299 bool m_useGlobalAnimationModifier;
306 QHash<EffectWindow *, WindowMotion> m_managedWindows;
307 QSet<EffectWindow *> m_movingWindowsSet;
316 , m_strength(strength)
317 , m_smoothness(smoothness)
323 : m_value(other.value())
324 , m_start(other.target())
325 , m_target(other.target())
326 , m_velocity(other.velocity())
327 , m_strength(other.strength())
328 , m_smoothness(other.smoothness())
340 if (m_value == m_target && m_velocity == T()) {
345 int steps = std::max(1, msec / 5);
346 for (
int i = 0; i < steps; i++) {
347 T diff = m_target - m_value;
348 T strength = diff * m_strength;
349 m_velocity = (m_smoothness * m_velocity + strength) / (m_smoothness + 1.0);
350 m_value += m_velocity;
Representation of a window used by/for Effect classes.
A single 1D motion dynamics object.
A single 2D motion dynamics object.
double smoothness() const
void setTarget(const T target)
void setSmoothness(const double smoothness)
void calculate(const int msec)
Motion(T initial, double strength, double smoothness)
void setStrength(const double strength)
void setValue(const T value)
void setVelocity(const T velocity)
Motion(const Motion< T > &other)
Helper class for motion dynamics in KWin effects.
bool managingWindows() const
void manage(const QList< EffectWindow * > &list)
bool isWindowMoving(EffectWindow *w) const
QList< EffectWindow * > managedWindows() const
bool areWindowsMoving() const
void moveWindow(EffectWindow *w, QRect target)
bool isManaging(EffectWindow *w) const