1 /*****************************************************************
2 KWin - the KDE window manager
3 This file is part of the KDE project.
5 Copyright (C) 2008 Cédric Borgese <cedric.borgese@gmail.com>
7 You can Freely distribute this program under the GNU General Public
8 License. See the file "COPYING" for the exact licensing terms.
9 ******************************************************************/
11 #ifndef WOBBLYWINDOWS_H
12 #define WOBBLYWINDOWS_H
14 // Include with base class for effects.
15 #include <kwineffects.h>
23 * Effect which wobble windows
25 class WobblyWindowsEffect
: public Effect
29 WobblyWindowsEffect();
30 virtual ~WobblyWindowsEffect();
32 virtual void reconfigure( ReconfigureFlags
);
33 virtual void prePaintScreen( ScreenPrePaintData
& data
, int time
);
34 virtual void prePaintWindow( EffectWindow
* w
, WindowPrePaintData
& data
, int time
);
35 virtual void paintWindow( EffectWindow
* w
, int mask
, QRegion region
, WindowPaintData
& data
);
36 virtual void postPaintScreen();
37 virtual void windowUserMovedResized( EffectWindow
* c
, bool first
, bool last
);
38 virtual void windowAdded( EffectWindow
* w
);
39 virtual void windowClosed( EffectWindow
* w
);
41 // Wobbly model parameters
42 void setStiffness(qreal stiffness
);
43 void setDrag(qreal drag
);
44 void setVelocityThreshold(qreal velocityThreshold
);
45 void setMoveFactor(qreal factor
);
63 bool updateWindowWobblyDatas(EffectWindow
* w
, qreal time
);
65 struct WindowWobblyInfos
73 // if true, the physics system moves this point based only on it "normal" destination
74 // given by the window position, ignoring neighbour points.
77 // if true, the point is locked to its normal destination position.
85 unsigned int bezierWidth
;
86 unsigned int bezierHeight
;
87 unsigned int bezierCount
;
95 QHash
< const EffectWindow
*, WindowWobblyInfos
> windows
;
103 // the default tesselation for windows
104 // use qreal instead of int as I really often need
105 // these values as real to do divisions.
106 qreal m_xTesselation
;
107 qreal m_yTesselation
;
111 qreal m_stopVelocity
;
112 qreal m_minAcceleration
;
113 qreal m_maxAcceleration
;
114 qreal m_stopAcceleration
;
116 bool m_moveEffectEnabled
;
117 bool m_openEffectEnabled
;
118 bool m_closeEffectEnabled
;
120 bool m_moveWobble
; // Expands m_moveEffectEnabled
123 void initWobblyInfo(WindowWobblyInfos
& wwi
, QRect geometry
) const;
124 void freeWobblyInfo(WindowWobblyInfos
& wwi
) const;
125 void wobblyOpenInit(WindowWobblyInfos
& wwi
) const;
126 void wobblyCloseInit(WindowWobblyInfos
& wwi
, EffectWindow
* w
) const;
128 WobblyWindowsEffect::Pair
computeBezierPoint(const WindowWobblyInfos
& wwi
, Pair point
) const;
130 static void heightRingLinearMean(Pair
** datas
, WindowWobblyInfos
& wwi
);
132 void setParameterSet(const ParameterSet
& pset
);
137 #endif // WOBBLYWINDOWS_H