/usr/include/compiz/animation/animeffect.h is in compiz-dev 1:0.9.12.2+16.04.20160415-0ubuntu1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 | #ifndef ANIMATION_ANIMEFFECT_H
#define ANIMATION_ANIMEFFECT_H
#include "animation.h"
typedef Animation *(*CreateAnimFunc) (CompWindow *w,
WindowEvent curWindowEvent,
float duration,
const AnimEffect info,
const CompRect &icon);
class AnimEffectUsedFor
{
public:
static AnimEffectUsedFor all();
static AnimEffectUsedFor none();
AnimEffectUsedFor& exclude(AnimEvent event);
AnimEffectUsedFor& include(AnimEvent event);
bool open;
bool close;
bool minimize;
bool shade;
bool unminimize;
bool focus;
};
/// Animation info class that holds the name, the list of supported events, and
/// the creator function for a subclass of Animation.
/// A pointer to this class is used as an identifier for each implemented
/// animation.
class AnimEffectInfo
{
public:
AnimEffectInfo (const char *name,
AnimEffectUsedFor usedFor,
CreateAnimFunc create, bool isRestackAnim = false);
~AnimEffectInfo () {}
bool matchesEffectName (const CompString &animName);
bool matchesPluginName (const CompString &pluginName);
const char *name; ///< Name of the animation effect, e.g. "animationpack:Implode".
/// To be set to true for the window event animation list(s) that
/// the new animation (value) should be added to
/// (0: open, 1: close, 2: minimize, 3: shade, 4: unminimize, 5: focus)
bool usedForEvents[AnimEventNum];
/// Creates an instance of the Animation subclass and returns it as an
/// Animation instance.
CreateAnimFunc create;
/// Is it a complex focus animation? (i.e. restacking-related,
/// like FocusFade/Dodge)
bool isRestackAnim;
};
template<class T>
Animation *createAnimation (CompWindow *w,
WindowEvent curWindowEvent,
float duration,
const AnimEffect info,
const CompRect &icon)
{
return new T (w, curWindowEvent, duration, info, icon);
}
/** The base class for all animations.
A n*imations should derive from the closest animation class
to override as few methods as possible. Also, an animation
method should call ancestors' methods instead of duplicating
their code.
*/
class Animation
{
protected:
CompWindow *mWindow;
AnimWindow *mAWindow;
float mTotalTime;
float mRemainingTime;
float mTimestep; ///< to store anim. timestep at anim. start
float mTimeElapsedWithinTimeStep;
int mTimeSinceLastPaint; ///< in milliseconds
int mOverrideProgressDir; ///< 0: default dir, 1: forward, 2: backward
GLWindowPaintAttrib mCurPaintAttrib;
GLushort mStoredOpacity;
WindowEvent mCurWindowEvent;
bool mInitialized; ///< whether the animation is initialized (in preparePaint)
AnimEffect mInfo; ///< information about the animation class
CompRect mIcon;
int mDecorTopHeight;
int mDecorBottomHeight;
CompOption::Value &optVal (unsigned int optionId);
inline bool optValB (unsigned int optionId) { return optVal (optionId).b (); }
inline int optValI (unsigned int optionId) { return optVal (optionId).i (); }
inline float optValF (unsigned int optionId) { return optVal (optionId).f (); }
inline CompString optValS (unsigned int optionId) { return optVal (optionId).s (); }
inline unsigned short *optValC (unsigned int optionId) { return optVal (optionId).c (); }
public:
Animation (CompWindow *w,
WindowEvent curWindowEvent,
float duration,
const AnimEffect info,
const CompRect &icon);
virtual ~Animation ();
inline AnimEffect info () { return mInfo; }
// Overridable animation methods.
/// Needed since virtual method calls can't be done in the constructor.
virtual void init () {}
/// To be called during post-animation clean up.
virtual void cleanUp (bool closing,
bool destructing) {}
/// Returns true if frame should be skipped (e.g. due to
/// higher timestep values). In that case no drawing is
/// needed for that window in current frame.
virtual bool shouldSkipFrame (int msSinceLastPaintActual);
/// Advances the animation time by the given time amount.
/// Returns true if more animation time is left.
virtual bool advanceTime (int msSinceLastPaint);
/// Computes new animation state based on remaining time.
virtual void step () {}
virtual void updateAttrib (GLWindowPaintAttrib &) {}
virtual void updateTransform (GLMatrix &) {}
virtual void prePaintWindow () {}
virtual void postPaintWindow () {}
virtual bool postPaintWindowUsed () { return false; }
/// Returns true if the animation is still in progress.
virtual bool prePreparePaint (int msSinceLastPaint) { return false; }
virtual void postPreparePaint () {}
/// Updates the bounding box of damaged region. Should be implemented for
/// any animation that doesn't update the whole screen.
virtual void updateBB (CompOutput &) {}
virtual bool updateBBUsed () { return false; }
/// Should return true for effects that make use of a region
/// instead of just a bounding box for damaged area.
virtual bool stepRegionUsed () { return false; }
virtual bool shouldDamageWindowOnStart ();
virtual bool shouldDamageWindowOnEnd ();
/// Should return false if the animation should be stopped on move
virtual bool moveUpdate (int dx, int dy) { return true; }
/// Should return false if the animation should be stopped on resize
virtual bool resizeUpdate (int dx, int dy,
int dwidth, int dheight) { return true; }
virtual void adjustPointerIconSize () {}
virtual void addGeometry (const GLTexture::MatrixList &matrix,
const CompRegion ®ion,
const CompRegion &clip,
unsigned int maxGridWidth,
unsigned int maxGridHeight);
virtual void drawGeometry ();
virtual bool paintWindowUsed () { return false; }
virtual bool paintWindow (GLWindow *gWindow,
const GLWindowPaintAttrib &attrib,
const GLMatrix &transform,
const CompRegion ®ion,
unsigned int mask)
{
return gWindow->glPaint (attrib, transform, region, mask);
}
virtual bool requiresTransformedWindow () const { return true; }
/// Gets info about the (extension) plugin that implements this animation.
/// Should be overriden by a base animation class in every extension plugin.
virtual ExtensionPluginInfo *getExtensionPluginInfo ();
void drawTexture (GLTexture *texture,
const GLWindowPaintAttrib &attrib,
unsigned int mask);
// Utility methods
void reverse ();
inline bool inProgress () { return (mRemainingTime > 0); }
inline WindowEvent curWindowEvent () { return mCurWindowEvent; }
inline float totalTime () { return mTotalTime; }
inline float remainingTime () { return mRemainingTime; }
float progressLinear ();
float progressEaseInEaseOut ();
float progressDecelerateCustom (float progress,
float minx, float maxx);
float progressDecelerate (float progress);
AnimDirection getActualAnimDirection (AnimDirection dir,
bool openDir);
void perspectiveDistortAndResetZ (GLMatrix &transform);
static void prepareTransform (CompOutput &output,
GLMatrix &resultTransform,
GLMatrix &transform);
void setInitialized () { mInitialized = true; }
inline bool initialized () { return mInitialized; }
inline void setCurPaintAttrib (const GLWindowPaintAttrib &newAttrib)
{ mCurPaintAttrib = newAttrib; }
};
#endif
|