[fusion-commits] Animation plugin: Changes to 'master' (27a49ffcc5087fa1e741dcfe5609d4565c78c6aa)
cornelius at server.beryl-project.org
cornelius at server.beryl-project.org
Wed Jul 25 04:40:47 CEST 2007
New commits:
commit 27a49ffcc5087fa1e741dcfe5609d4565c78c6aa
Author: Erkin Bahceci <erkinbah at gmail.com>
Date: Tue Jul 24 22:40:04 2007 -0400
Implement options string for anim selection lists.
These are comma separated lists of option value assignments to
override effect settings, such as:
fire_color=#0080ffff, fire_particles=700, fire_smoke=1
Only the options in the "Effect Settings" group can be used here.
An html documentation of all options can be generated with optionDocGen.xslt
under the Documentation project in git by doing
xsltproc -o animationDoc.html optionDocGen.xslt /usr/share/compiz/animation.xml
animation-internal.h | 85 +++++++++++--
animation.c | 247 ++++++++++++++++++++---------------
animation.xml.in | 20 ++--
beamup.c | 51 ++++---
burn.c | 104 ++++++++-------
curvedfold.c | 17 +--
domino.c | 4 +-
dream.c | 6 +-
explode3d.c | 14 +-
glide.c | 24 ++--
horizontalfold.c | 17 +--
magiclamp.c | 19 ++--
options.c | 359 ++++++++++++++++++++++++++++++++++++++++++++++++++
polygon.c | 45 +++----
rollup.c | 22 ++--
wave.c | 4 +-
zoomside.c | 18 ++--
17 files changed, 760 insertions(+), 296 deletions(-)
create mode 100644 options.c
Modified: fusion/plugins/animation/animation-internal.h
===================================================================
--- fusion/plugins/animation/animation-internal.h
+++ fusion/plugins/animation/animation-internal.h
@@ -158,14 +158,15 @@ typedef struct _WaveParam
typedef enum
{
WindowEventNone = 0,
+ WindowEventOpen,
+ WindowEventClose,
WindowEventMinimize,
WindowEventUnminimize,
- WindowEventClose,
- WindowEventOpen,
WindowEventFocus,
WindowEventShade,
WindowEventUnshade
} WindowEvent;
+#define NUM_EVENTS 7
typedef struct _Object
{
@@ -331,13 +332,32 @@ typedef enum
#define LAST_SHADE_EFFECT 4
#define LAST_RANDOM_SHADE_EFFECT 2
+#define NUM_NONEFFECT_OPTIONS 27
-typedef struct RestackInfo
+typedef struct _RestackInfo
{
CompWindow *wRestacked, *wStart, *wEnd, *wOldAbove;
Bool raised;
} RestackInfo;
+typedef struct _IdValuePair
+{
+ int id;
+ CompOptionValue value;
+} IdValuePair;
+
+typedef struct _OptionSet
+{
+ int nPairs;
+ IdValuePair *pairs;
+} OptionSet;
+
+typedef struct _OptionSets
+{
+ int nSets;
+ OptionSet *sets;
+} OptionSets;
+
extern int animDisplayPrivateIndex;
extern CompMetadata animMetadata;
@@ -356,21 +376,26 @@ typedef enum
ANIM_SCREEN_OPTION_OPEN_EFFECTS,
ANIM_SCREEN_OPTION_OPEN_DURATIONS,
ANIM_SCREEN_OPTION_OPEN_MATCHES,
+ ANIM_SCREEN_OPTION_OPEN_OPTIONS,
ANIM_SCREEN_OPTION_OPEN_RANDOM_EFFECTS,
ANIM_SCREEN_OPTION_CLOSE_EFFECTS,
ANIM_SCREEN_OPTION_CLOSE_DURATIONS,
ANIM_SCREEN_OPTION_CLOSE_MATCHES,
+ ANIM_SCREEN_OPTION_CLOSE_OPTIONS,
ANIM_SCREEN_OPTION_CLOSE_RANDOM_EFFECTS,
ANIM_SCREEN_OPTION_MINIMIZE_EFFECTS,
ANIM_SCREEN_OPTION_MINIMIZE_DURATIONS,
ANIM_SCREEN_OPTION_MINIMIZE_MATCHES,
+ ANIM_SCREEN_OPTION_MINIMIZE_OPTIONS,
ANIM_SCREEN_OPTION_MINIMIZE_RANDOM_EFFECTS,
ANIM_SCREEN_OPTION_FOCUS_EFFECTS,
ANIM_SCREEN_OPTION_FOCUS_DURATIONS,
ANIM_SCREEN_OPTION_FOCUS_MATCHES,
+ ANIM_SCREEN_OPTION_FOCUS_OPTIONS,
ANIM_SCREEN_OPTION_SHADE_EFFECTS,
ANIM_SCREEN_OPTION_SHADE_DURATIONS,
ANIM_SCREEN_OPTION_SHADE_MATCHES,
+ ANIM_SCREEN_OPTION_SHADE_OPTIONS,
ANIM_SCREEN_OPTION_SHADE_RANDOM_EFFECTS,
// Misc. settings
ANIM_SCREEN_OPTION_ALL_RANDOM,
@@ -478,6 +503,8 @@ typedef struct _AnimScreen
unsigned int nOpenRandomEffects;
unsigned int nMinimizeRandomEffects;
unsigned int nShadeRandomEffects;
+
+ OptionSets *eventOptionSets[NUM_EVENTS];
} AnimScreen;
typedef struct _AnimWindow
@@ -535,6 +562,8 @@ typedef struct _AnimWindow
int animFireDirection;
Bool deceleratingMotion; // For effects that have decel. motion
+ int curAnimSelectionRow;
+
// for magic lamp
Bool minimizeToTop;
@@ -573,7 +602,7 @@ typedef struct _AnimEffectProperties
void (*postPaintWindowFunc) (CompScreen *, CompWindow *);
Bool (*animStepFunc) (CompScreen *, CompWindow *, float time);
void (*initFunc) (CompScreen *, CompWindow *);
- void (*initGridFunc) (AnimScreen *, WindowEvent, int *, int *);
+ void (*initGridFunc) (AnimScreen *, AnimWindow *, int *, int *);
void (*addCustomGeometryFunc) (CompScreen *, CompWindow *, int, Box *,
int, CompMatrix *);
void (*drawCustomGeometryFunc) (CompScreen *, CompWindow *);
@@ -699,7 +728,6 @@ animDrawWindowGeometry(CompWindow * w);
Bool
getMousePointerXY(CompScreen * s, short *x, short *y);
-
/* beamup.c */
void
@@ -848,7 +876,7 @@ fxHorizontalFoldsModelStep (CompScreen *s,
void
fxHorizontalFoldsInitGrid (AnimScreen *as,
- WindowEvent forWindowEvent,
+ AnimWindow *aw,
int *gridWidth,
int *gridHeight);
@@ -864,13 +892,13 @@ fxLeafSpread3DInit (CompScreen *s,
void
fxMagicLampInitGrid(AnimScreen * as,
- WindowEvent forWindowEvent,
+ AnimWindow *aw,
int *gridWidth,
int *gridHeight);
void
fxVacuumInitGrid (AnimScreen * as,
- WindowEvent forWindowEvent,
+ AnimWindow *aw,
int *gridWidth,
int *gridHeight);
@@ -883,6 +911,45 @@ fxMagicLampModelStep (CompScreen * s,
CompWindow * w,
float time);
+/* options.c */
+
+void
+updateOptionSets(CompScreen *s,
+ OptionSets *oss,
+ CompListValue *listVal);
+
+void
+freeAllOptionSets(OptionSets **eventsOss);
+
+CompOptionValue *
+animGetOptVal(AnimScreen *as,
+ AnimWindow *aw,
+ int optionId);
+
+inline Bool
+animGetB(AnimScreen *as,
+ AnimWindow *aw,
+ int optionId);
+
+inline int
+animGetI(AnimScreen *as,
+ AnimWindow *aw,
+ int optionId);
+
+inline float
+animGetF(AnimScreen *as,
+ AnimWindow *aw,
+ int optionId);
+
+inline char *
+animGetS(AnimScreen *as,
+ AnimWindow *aw,
+ int optionId);
+
+inline unsigned short *
+animGetC(AnimScreen *as,
+ AnimWindow *aw,
+ int optionId);
/* particle.c */
@@ -958,7 +1025,7 @@ fxRollUpModelStep (CompScreen *s,
float time);
void fxRollUpInitGrid (AnimScreen *as,
- WindowEvent forWindowEvent,
+ AnimWindow *aw,
int *gridWidth,
int *gridHeight);
Modified: fusion/plugins/animation/animation.c
===================================================================
--- fusion/plugins/animation/animation.c
+++ fusion/plugins/animation/animation.c
@@ -168,28 +168,29 @@ void defaultAnimInit(CompScreen * s, CompWindow * w)
as->opt[ANIM_SCREEN_OPTION_TIME_STEP].value.i);
}
-void defaultMinimizeAnimInit(CompScreen * s, CompWindow * w)
+Bool animZoomToIcon(AnimScreen *as, AnimWindow *aw)
{
- ANIM_SCREEN(s);
- ANIM_WINDOW(w);
-
- if ((aw->curWindowEvent == WindowEventMinimize ||
+ return
+ (aw->curWindowEvent == WindowEventMinimize ||
aw->curWindowEvent == WindowEventUnminimize) &&
((aw->curAnimEffect == AnimEffectCurvedFold &&
- as->opt[ANIM_SCREEN_OPTION_CURVED_FOLD_Z2TOM].
- value.b) ||
+ animGetB(as, aw, ANIM_SCREEN_OPTION_CURVED_FOLD_Z2TOM)) ||
(aw->curAnimEffect == AnimEffectDream &&
- as->opt[ANIM_SCREEN_OPTION_DREAM_Z2TOM].
- value.b) ||
+ animGetB(as, aw, ANIM_SCREEN_OPTION_DREAM_Z2TOM)) ||
(aw->curAnimEffect == AnimEffectGlide3D1 &&
- as->opt[ANIM_SCREEN_OPTION_GLIDE1_Z2TOM].
- value.b) ||
+ animGetB(as, aw, ANIM_SCREEN_OPTION_GLIDE1_Z2TOM)) ||
(aw->curAnimEffect == AnimEffectGlide3D2 &&
- as->opt[ANIM_SCREEN_OPTION_GLIDE2_Z2TOM].
- value.b) ||
+ animGetB(as, aw, ANIM_SCREEN_OPTION_GLIDE2_Z2TOM)) ||
(aw->curAnimEffect == AnimEffectHorizontalFolds &&
- as->opt[ANIM_SCREEN_OPTION_HORIZONTAL_FOLDS_Z2TOM].
- value.b)))
+ animGetB(as, aw, ANIM_SCREEN_OPTION_HORIZONTAL_FOLDS_Z2TOM)));
+}
+
+void defaultMinimizeAnimInit(CompScreen * s, CompWindow * w)
+{
+ ANIM_SCREEN(s);
+ ANIM_WINDOW(w);
+
+ if (animZoomToIcon(as, aw))
{
aw->animTotalTime /= ZOOM_PERCEIVED_T;
aw->animRemainingTime = aw->animTotalTime;
@@ -240,7 +241,6 @@ animStoreRandomEffectList (CompOptionValue *value,
*targetCount = count;
}
-
static Bool
matchWithString(CompWindow *w, const char *matchStr)
{
@@ -323,6 +323,7 @@ getMatchingAnimSelection (CompWindow *w,
int *duration)
{
ANIM_SCREEN(w->screen);
+ ANIM_WINDOW(w);
if (duration == NULL)
return AnimEffectNone;
@@ -367,6 +368,7 @@ getMatchingAnimSelection (CompWindow *w,
valDuration = &as->opt[ANIM_SCREEN_OPTION_SHADE_DURATIONS].value;
break;
case WindowEventNone:
+ default:
return AnimEffectNone;
}
@@ -387,6 +389,8 @@ getMatchingAnimSelection (CompWindow *w,
if (!matchEvalProxy (&valMatch->list.value[i].match, w))
continue;
+ aw->curAnimSelectionRow = i;
+
*duration = valDuration->list.value[i].i;
return effects[valEffect->list.value[i].i];
@@ -582,26 +586,8 @@ defaultMinimizeUpdateWindowAttrib(AnimScreen * as,
{
ANIM_WINDOW(w);
- if ((aw->curWindowEvent == WindowEventMinimize ||
- aw->curWindowEvent == WindowEventUnminimize) &&
- ((aw->curAnimEffect == AnimEffectCurvedFold &&
- as->opt[ANIM_SCREEN_OPTION_CURVED_FOLD_Z2TOM].
- value.b) ||
- (aw->curAnimEffect == AnimEffectDream &&
- as->opt[ANIM_SCREEN_OPTION_DREAM_Z2TOM].
- value.b) ||
- (aw->curAnimEffect == AnimEffectGlide3D1 &&
- as->opt[ANIM_SCREEN_OPTION_GLIDE1_Z2TOM].
- value.b) ||
- (aw->curAnimEffect == AnimEffectGlide3D2 &&
- as->opt[ANIM_SCREEN_OPTION_GLIDE2_Z2TOM].
- value.b) ||
- (aw->curAnimEffect == AnimEffectHorizontalFolds &&
- as->opt[ANIM_SCREEN_OPTION_HORIZONTAL_FOLDS_Z2TOM].
- value.b)))
- {
+ if (animZoomToIcon(as, aw))
fxZoomUpdateWindowAttrib(as, w, wAttrib);
- }
}
void
@@ -612,27 +598,8 @@ defaultMinimizeUpdateWindowTransform(CompScreen *s,
ANIM_SCREEN(s);
ANIM_WINDOW(w);
- if ((aw->curWindowEvent == WindowEventMinimize ||
- aw->curWindowEvent == WindowEventUnminimize) &&
- ((aw->curAnimEffect == AnimEffectCurvedFold &&
- as->opt[ANIM_SCREEN_OPTION_CURVED_FOLD_Z2TOM].
- value.b) ||
- (aw->curAnimEffect == AnimEffectDream &&
- as->opt[ANIM_SCREEN_OPTION_DREAM_Z2TOM].
- value.b) ||
- (aw->curAnimEffect == AnimEffectGlide3D1 &&
- as->opt[ANIM_SCREEN_OPTION_GLIDE1_Z2TOM].
- value.b) ||
- (aw->curAnimEffect == AnimEffectGlide3D2 &&
- as->opt[ANIM_SCREEN_OPTION_GLIDE2_Z2TOM].
- value.b) ||
- (aw->curAnimEffect == AnimEffectHorizontalFolds &&
- as->opt[ANIM_SCREEN_OPTION_HORIZONTAL_FOLDS_Z2TOM].
- value.b)))
- {
- // Zoom to icon
+ if (animZoomToIcon(as, aw))
fxZoomUpdateWindowTransform(s, w, wTransform);
- }
}
@@ -790,6 +757,41 @@ animSetScreenOptions(CompPlugin *plugin,
matchUpdate (screen->display, &o->value.list.value[i].match);
}
break;
+ case ANIM_SCREEN_OPTION_OPEN_OPTIONS:
+ if (compSetOptionList(o, value))
+ {
+ updateOptionSets
+ (screen, as->eventOptionSets[WindowEventOpen], &o->value.list);
+ }
+ break;
+ case ANIM_SCREEN_OPTION_CLOSE_OPTIONS:
+ if (compSetOptionList(o, value))
+ {
+ updateOptionSets
+ (screen, as->eventOptionSets[WindowEventClose], &o->value.list);
+ }
+ break;
+ case ANIM_SCREEN_OPTION_MINIMIZE_OPTIONS:
+ if (compSetOptionList(o, value))
+ {
+ updateOptionSets
+ (screen, as->eventOptionSets[WindowEventMinimize], &o->value.list);
+ }
+ break;
+ case ANIM_SCREEN_OPTION_FOCUS_OPTIONS:
+ if (compSetOptionList(o, value))
+ {
+ updateOptionSets
+ (screen, as->eventOptionSets[WindowEventFocus], &o->value.list);
+ }
+ break;
+ case ANIM_SCREEN_OPTION_SHADE_OPTIONS:
+ if (compSetOptionList(o, value))
+ {
+ updateOptionSets
+ (screen, as->eventOptionSets[WindowEventShade], &o->value.list);
+ }
+ break;
case ANIM_SCREEN_OPTION_OPEN_RANDOM_EFFECTS:
if (compSetOptionList(o, value))
{
@@ -847,21 +849,26 @@ static const CompMetadataOptionInfo animScreenOptionInfo[] = {
{ "open_effects", "list", "<type>int</type>" RESTOSTRING (0, LAST_CLOSE_EFFECT), 0, 0 },
{ "open_durations", "list", "<type>int</type><min>50</min>", 0, 0 },
{ "open_matches", "list", "<type>match</type>", 0, 0 },
+ { "open_options", "list", "<type>string</type>", 0, 0 },
{ "open_random_effects", "list", "<type>int</type>" RESTOSTRING (0, LAST_RANDOM_CLOSE_EFFECT), 0, 0 },
{ "close_effects", "list", "<type>int</type>" RESTOSTRING (0, LAST_CLOSE_EFFECT), 0, 0 },
{ "close_durations", "list", "<type>int</type><min>50</min>", 0, 0 },
{ "close_matches", "list", "<type>match</type>", 0, 0 },
+ { "close_options", "list", "<type>string</type>", 0, 0 },
{ "close_random_effects", "list", "<type>int</type>" RESTOSTRING (0, LAST_RANDOM_CLOSE_EFFECT), 0, 0 },
{ "minimize_effects", "list", "<type>int</type>" RESTOSTRING (0, LAST_MINIMIZE_EFFECT), 0, 0 },
{ "minimize_durations", "list", "<type>int</type><min>50</min>", 0, 0 },
{ "minimize_matches", "list", "<type>match</type>", 0, 0 },
+ { "minimize_options", "list", "<type>string</type>", 0, 0 },
{ "minimize_random_effects", "list", "<type>int</type>" RESTOSTRING (0, LAST_RANDOM_MINIMIZE_EFFECT), 0, 0 },
{ "focus_effects", "list", "<type>int</type>" RESTOSTRING (0, LAST_FOCUS_EFFECT), 0, 0 },
{ "focus_durations", "list", "<type>int</type><min>50</min>", 0, 0 },
{ "focus_matches", "list", "<type>match</type>", 0, 0 },
+ { "focus_options", "list", "<type>string</type>", 0, 0 },
{ "shade_effects", "list", "<type>int</type>" RESTOSTRING (0, LAST_SHADE_EFFECT), 0, 0 },
{ "shade_durations", "list", "<type>int</type><min>50</min>", 0, 0 },
{ "shade_matches", "list", "<type>match</type>", 0, 0 },
+ { "shade_options", "list", "<type>string</type>", 0, 0 },
{ "shade_random_effects", "list", "<type>int</type>" RESTOSTRING (0, LAST_RANDOM_SHADE_EFFECT), 0, 0 },
// Misc. settings
{ "all_random", "bool", 0, 0, 0 },
@@ -1067,8 +1074,7 @@ static Model *createModel(CompWindow * w,
if (!model)
{
compLogMessage (w->screen->display, "animation", CompLogLevelError,
- "%s: Not enough memory at line %d!",
- __FILE__, __LINE__);
+ "Not enough memory");
return 0;
}
model->magicLampWaveCount = 0;
@@ -1081,8 +1087,7 @@ static Model *createModel(CompWindow * w,
if (!model->objects)
{
compLogMessage (w->screen->display, "animation", CompLogLevelError,
- "%s: Not enough memory at line %d!",
- __FILE__, __LINE__);
+ "Not enough memory");
free(model);
return 0;
}
@@ -1124,20 +1129,20 @@ animFreeModel(AnimWindow *aw)
}
static Bool
-animEnsureModel(CompWindow * w,
- WindowEvent forWindowEvent, AnimEffect forAnimEffect)
+animEnsureModel(CompWindow * w)
{
ANIM_WINDOW(w);
ANIM_SCREEN(w->screen);
+ WindowEvent forWindowEvent = aw->curWindowEvent;
+ AnimEffect forAnimEffect = aw->curAnimEffect;
+
int gridWidth = 2;
int gridHeight = 2;
if (animEffectProperties[forAnimEffect].initGridFunc)
- animEffectProperties[forAnimEffect].initGridFunc(as,
- forWindowEvent,
- &gridWidth,
- &gridHeight);
+ animEffectProperties[forAnimEffect].initGridFunc
+ (as, aw, &gridWidth, &gridHeight);
Bool isShadeUnshadeEvent =
(forWindowEvent == WindowEventShade ||
@@ -1193,9 +1198,10 @@ static void cleanUpParentChildChainItem(AnimScreen *as, AnimWindow *aw)
aw->skipPostPrepareScreen = FALSE;
}
-void postAnimationCleanupClosing(CompWindow * w,
- Bool resetAnimation,
- Bool closing)
+void postAnimationCleanupCustom(CompWindow * w,
+ Bool resetAnimation,
+ Bool closing,
+ Bool clearMatchingRow)
{
ANIM_WINDOW(w);
ANIM_SCREEN(w->screen);
@@ -1265,6 +1271,9 @@ void postAnimationCleanupClosing(CompWindow * w,
aw->state = aw->newState;
+ if (clearMatchingRow)
+ aw->curAnimSelectionRow = -1;
+
if (aw->drawRegion)
XDestroyRegion(aw->drawRegion);
aw->drawRegion = NULL;
@@ -1318,9 +1327,14 @@ void postAnimationCleanupClosing(CompWindow * w,
}
}
+void postAnimationCleanupClosing(CompWindow * w, Bool resetAnimation, Bool closing)
+{
+ postAnimationCleanupCustom(w, resetAnimation, closing, TRUE);
+}
+
void postAnimationCleanup(CompWindow * w, Bool resetAnimation)
{
- postAnimationCleanupClosing(w, resetAnimation, FALSE);
+ postAnimationCleanupCustom(w, resetAnimation, FALSE, TRUE);
}
static void
@@ -1394,8 +1408,7 @@ initiateFocusAnimation(CompWindow *w)
// When this happens and minimize is in progress,
// don't prevent rewinding of minimize when unminimize is fired
// right after this focus event.
- aw->curWindowEvent != WindowEventMinimize &&
- animEnsureModel(w, WindowEventFocus, chosenEffect))
+ aw->curWindowEvent != WindowEventMinimize)
{
CompWindow *wStart = NULL;
CompWindow *wEnd = NULL;
@@ -1414,6 +1427,9 @@ initiateFocusAnimation(CompWindow *w)
// FOCUS event!
+ aw->curWindowEvent = WindowEventFocus;
+ aw->curAnimEffect = chosenEffect;
+
if (chosenEffect == AnimEffectFocusFade ||
chosenEffect == AnimEffectDodge)
{
@@ -1485,7 +1501,7 @@ initiateFocusAnimation(CompWindow *w)
float dodgeMaxStartProgress =
numDodgingWins *
- as->opt[ANIM_SCREEN_OPTION_DODGE_GAP_RATIO].value.f *
+ animGetF(as, aw, ANIM_SCREEN_OPTION_DODGE_GAP_RATIO) *
duration / 1000.0f;
if (chosenEffect == AnimEffectDodge)
@@ -1608,14 +1624,19 @@ initiateFocusAnimation(CompWindow *w)
}
}
- if (aw->curWindowEvent != WindowEventNone)
+ animEnsureModel(w);
+ /*
+ if (chosenEffect != AnimEffectFocusFade &&
+ chosenEffect != AnimEffectDodge &&
+ !animEnsureModel(w))
{
postAnimationCleanup(w, TRUE);
- }
+ return;
+ }*/
+
animActivateEvent(s, TRUE);
- aw->curWindowEvent = WindowEventFocus;
- aw->curAnimEffect = chosenEffect;
+
if (chosenEffect != AnimEffectDodge)
aw->animTotalTime = duration;
aw->animRemainingTime = aw->animTotalTime;
@@ -1809,8 +1830,7 @@ static void animPreparePaintScreen(CompScreen * s, int msSinceLastPaint)
{
compLogMessage (w->screen->display,
"animation", CompLogLevelError,
- "%s: Not enough memory at line %d!",
- __FILE__, __LINE__);
+ "Not enough memory");
return;
}
aw->polygonSet->allFadeDuration = -1.0f;
@@ -1841,8 +1861,7 @@ static void animPreparePaintScreen(CompScreen * s, int msSinceLastPaint)
{
// model needs update
// re-create model
- if (!animEnsureModel
- (w, aw->curWindowEvent, aw->curAnimEffect))
+ if (!animEnsureModel (w))
continue; // skip this window
}
}
@@ -2931,8 +2950,7 @@ static void animHandleEvent(CompDisplay * d, XEvent * event)
aw->lastKnownCoords.x = w->attrib.x;
aw->lastKnownCoords.y = w->attrib.y;
- if (!animEnsureModel
- (w, WindowEventShade, aw->curAnimEffect))
+ if (!animEnsureModel(w))
{
postAnimationCleanup(w, TRUE);
}
@@ -2961,7 +2979,7 @@ static void animHandleEvent(CompDisplay * d, XEvent * event)
{
if (aw->curWindowEvent != WindowEventUnminimize)
{
- postAnimationCleanup(w, TRUE);
+ postAnimationCleanupCustom(w, TRUE, FALSE, FALSE);
}
else
{
@@ -3008,8 +3026,7 @@ static void animHandleEvent(CompDisplay * d, XEvent * event)
aw->lastKnownCoords.x = w->attrib.x;
aw->lastKnownCoords.y = w->attrib.y;
- if (!animEnsureModel
- (w, WindowEventMinimize, aw->curAnimEffect))
+ if (!animEnsureModel(w))
{
postAnimationCleanup(w, TRUE);
}
@@ -3092,7 +3109,7 @@ static void animHandleEvent(CompDisplay * d, XEvent * event)
}
else
{
- postAnimationCleanupClosing(w, TRUE, TRUE);
+ postAnimationCleanupCustom(w, TRUE, TRUE, FALSE);
}
}
@@ -3121,8 +3138,7 @@ static void animHandleEvent(CompDisplay * d, XEvent * event)
aw->lastKnownCoords.x = w->attrib.x;
aw->lastKnownCoords.y = w->attrib.y;
- if (!animEnsureModel
- (w, WindowEventClose, aw->curAnimEffect))
+ if (!animEnsureModel(w))
{
postAnimationCleanup(w, TRUE);
}
@@ -3135,11 +3151,11 @@ static void animHandleEvent(CompDisplay * d, XEvent * event)
if (aw->curAnimEffect == AnimEffectMagicLamp)
aw->icon.width =
MAX(aw->icon.width,
- as->opt[ANIM_SCREEN_OPTION_MAGIC_LAMP_OPEN_START_WIDTH].value.i);
+ animGetI(as, aw, ANIM_SCREEN_OPTION_MAGIC_LAMP_OPEN_START_WIDTH));
else if (aw->curAnimEffect == AnimEffectVacuum)
aw->icon.width =
MAX(aw->icon.width,
- as->opt[ANIM_SCREEN_OPTION_VACUUM_OPEN_START_WIDTH].value.i);
+ animGetI(as, aw, ANIM_SCREEN_OPTION_VACUUM_OPEN_START_WIDTH));
aw->unmapCnt++;
w->unmapRefCnt++;
@@ -3407,7 +3423,7 @@ static Bool animDamageWindowRect(CompWindow * w, Bool initial, BoxPtr rect)
{
if (aw->curWindowEvent != WindowEventMinimize)
{
- postAnimationCleanup(w, TRUE);
+ postAnimationCleanupCustom(w, TRUE, FALSE, FALSE);
}
else
{
@@ -3460,8 +3476,7 @@ static Bool animDamageWindowRect(CompWindow * w, Bool initial, BoxPtr rect)
aw->lastKnownCoords.x = w->attrib.x;
aw->lastKnownCoords.y = w->attrib.y;
- if (animEnsureModel
- (w, WindowEventUnminimize, aw->curAnimEffect))
+ if (animEnsureModel(w))
{
if (!animGetWindowIconGeometry(w, &aw->icon))
{
@@ -3550,12 +3565,10 @@ static Bool animDamageWindowRect(CompWindow * w, Bool initial, BoxPtr rect)
aw->lastKnownCoords.x = w->attrib.x;
aw->lastKnownCoords.y = w->attrib.y;
- if (animEnsureModel(w, WindowEventUnshade, aw->curAnimEffect))
+ if (animEnsureModel(w))
addWindowDamage(w);
else
- {
postAnimationCleanup(w, TRUE);
- }
}
}
}
@@ -3584,7 +3597,7 @@ static Bool animDamageWindowRect(CompWindow * w, Bool initial, BoxPtr rect)
{
if (aw->curWindowEvent != WindowEventClose)
{
- postAnimationCleanup(w, TRUE);
+ postAnimationCleanupCustom(w, TRUE, FALSE, FALSE);
}
else
{
@@ -3638,11 +3651,11 @@ static Bool animDamageWindowRect(CompWindow * w, Bool initial, BoxPtr rect)
if (aw->curAnimEffect == AnimEffectMagicLamp)
aw->icon.width =
MAX(aw->icon.width,
- as->opt[ANIM_SCREEN_OPTION_MAGIC_LAMP_OPEN_START_WIDTH].value.i);
+ animGetI(as, aw, ANIM_SCREEN_OPTION_MAGIC_LAMP_OPEN_START_WIDTH));
else if (aw->curAnimEffect == AnimEffectVacuum)
aw->icon.width =
MAX(aw->icon.width,
- as->opt[ANIM_SCREEN_OPTION_VACUUM_OPEN_START_WIDTH].value.i);
+ animGetI(as, aw, ANIM_SCREEN_OPTION_VACUUM_OPEN_START_WIDTH));
aw->icon.x -= aw->icon.width / 2;
aw->icon.y -= aw->icon.height / 2;
@@ -3654,14 +3667,10 @@ static Bool animDamageWindowRect(CompWindow * w, Bool initial, BoxPtr rect)
aw->lastKnownCoords.x = w->attrib.x;
aw->lastKnownCoords.y = w->attrib.y;
}
- if (animEnsureModel(w, WindowEventOpen, aw->curAnimEffect))
- {
+ if (animEnsureModel(w))
addWindowDamage(w);
- }
else
- {
postAnimationCleanup(w, TRUE);
- }
}
}
else if (as->switcherActive && !as->switcherWinOpeningSuppressed)
@@ -3965,6 +3974,32 @@ static Bool animInitScreen(CompPlugin * p, CompScreen * s)
as->shadeRandomEffects,
&as->nShadeRandomEffects);
+ as->eventOptionSets[WindowEventOpen] = calloc(1, sizeof(OptionSets));
+ as->eventOptionSets[WindowEventClose] = calloc(1, sizeof(OptionSets));
+ as->eventOptionSets[WindowEventMinimize] = calloc(1, sizeof(OptionSets));
+ as->eventOptionSets[WindowEventUnminimize] =
+ as->eventOptionSets[WindowEventMinimize];
+ as->eventOptionSets[WindowEventFocus] = calloc(1, sizeof(OptionSets));
+ as->eventOptionSets[WindowEventShade] = calloc(1, sizeof(OptionSets));
+ as->eventOptionSets[WindowEventUnshade] =
+ as->eventOptionSets[WindowEventShade];
+
+ updateOptionSets
+ (s, as->eventOptionSets[WindowEventOpen],
+ &as->opt[ANIM_SCREEN_OPTION_OPEN_OPTIONS].value.list);
+ updateOptionSets
+ (s, as->eventOptionSets[WindowEventClose],
+ &as->opt[ANIM_SCREEN_OPTION_CLOSE_OPTIONS].value.list);
+ updateOptionSets
+ (s, as->eventOptionSets[WindowEventMinimize],
+ &as->opt[ANIM_SCREEN_OPTION_MINIMIZE_OPTIONS].value.list);
+ updateOptionSets
+ (s, as->eventOptionSets[WindowEventFocus],
+ &as->opt[ANIM_SCREEN_OPTION_FOCUS_OPTIONS].value.list);
+ updateOptionSets
+ (s, as->eventOptionSets[WindowEventShade],
+ &as->opt[ANIM_SCREEN_OPTION_SHADE_OPTIONS].value.list);
+
as->switcherActive = FALSE;
as->groupTabChangeActive = FALSE;
as->scaleActive = FALSE;
@@ -4004,6 +4039,8 @@ static void animFiniScreen(CompPlugin * p, CompScreen * s)
if (as->lastClientListStacking)
free(as->lastClientListStacking);
+ freeAllOptionSets(as->eventOptionSets);
+
UNWRAP(as, s, preparePaintScreen);
UNWRAP(as, s, donePaintScreen);
UNWRAP(as, s, paintOutput);
@@ -4038,6 +4075,8 @@ static Bool animInitWindow(CompPlugin * p, CompWindow * w)
aw->curAnimEffect = AnimEffectNone;
aw->curWindowEvent = WindowEventNone;
aw->animOverrideProgressDir = 0;
+ aw->curAnimSelectionRow = -1;
+
w->indexCount = 0;
aw->polygonSet = NULL;
Modified: fusion/plugins/animation/animation.xml.in
===================================================================
--- fusion/plugins/animation/animation.xml.in
+++ fusion/plugins/animation/animation.xml.in
@@ -132,8 +132,8 @@
</default>
</option>
<option name="close_options" type="list">
- <_short>-</_short>
- <_long>(This part will be used in the near future. This place-holder is here now to prevent problems when it starts being used.)</_long>
+ <_short>Options</_short>
+ <_long>Comma separated list of option value assignments to override effect settings, e.g.: fire_color=#0080ffff, fire_particles=700, fire_smoke=1</_long>
<type>string</type>
<default>
<value></value>
@@ -359,8 +359,8 @@
</default>
</option>
<option name="open_options" type="list">
- <_short>-</_short>
- <_long>(This part will be used in the near future. This place-holder is here now to prevent problems when it starts being used.)</_long>
+ <_short>Options</_short>
+ <_long>Comma separated list of option value assignments to override effect settings, e.g.: fire_color=#0080ffff, fire_particles=700, fire_smoke=1</_long>
<type>string</type>
<default>
<value></value>
@@ -572,8 +572,8 @@
</default>
</option>
<option name="minimize_options" type="list">
- <_short>-</_short>
- <_long>(This part will be used in the near future. This place-holder is here now to prevent problems when it starts being used.)</_long>
+ <_short>Options</_short>
+ <_long>Comma separated list of option value assignments to override effect settings, e.g.: fire_color=#0080ffff, fire_particles=700, fire_smoke=1</_long>
<type>string</type>
<default>
<value></value>
@@ -725,8 +725,8 @@
</default>
</option>
<option name="shade_options" type="list">
- <_short>-</_short>
- <_long>(This part will be used in the near future. This place-holder is here now to prevent problems when it starts being used.)</_long>
+ <_short>Options</_short>
+ <_long>Comma separated list of option value assignments to override effect settings, e.g.: fire_color=#0080ffff, fire_particles=700, fire_smoke=1</_long>
<type>string</type>
<default>
<value></value>
@@ -813,8 +813,8 @@
</default>
</option>
<option name="focus_options" type="list">
- <_short>-</_short>
- <_long>(This part will be used in the near future. This place-holder is here now to prevent problems when it starts being used.)</_long>
+ <_short>Options</_short>
+ <_long>Comma separated list of option value assignments to override effect settings, e.g.: fire_color=#0080ffff, fire_particles=700, fire_smoke=1</_long>
<type>string</type>
<default>
<value></value>
Modified: fusion/plugins/animation/beamup.c
===================================================================
--- fusion/plugins/animation/beamup.c
+++ fusion/plugins/animation/beamup.c
@@ -58,12 +58,12 @@ void fxBeamUpInit(CompScreen * s, CompWindow * w)
}
initParticles(particles / 10, &aw->ps[0]);
initParticles(particles, &aw->ps[1]);
- aw->ps[1].slowdown = as->opt[ANIM_SCREEN_OPTION_BEAMUP_SLOWDOWN].value.f;
+ aw->ps[1].slowdown = animGetF(as, aw, ANIM_SCREEN_OPTION_BEAMUP_SLOWDOWN);
aw->ps[1].darken = 0.5;
aw->ps[1].blendMode = GL_ONE;
aw->ps[0].slowdown =
- as->opt[ANIM_SCREEN_OPTION_BEAMUP_SLOWDOWN].value.f / 2.0;
+ animGetF(as, aw, ANIM_SCREEN_OPTION_BEAMUP_SLOWDOWN) / 2.0;
aw->ps[0].darken = 0.0;
aw->ps[0].blendMode = GL_ONE_MINUS_SRC_ALPHA;
@@ -92,19 +92,24 @@ void fxBeamUpInit(CompScreen * s, CompWindow * w)
}
static void
-fxBeamUpGenNewFire(CompScreen * s, ParticleSystem * ps, int x, int y,
- int width, int height, float size, float time)
+fxBeamUpGenNewFire(CompScreen * s,
+ CompWindow * w,
+ ParticleSystem * ps,
+ int x,
+ int y,
+ int width,
+ int height,
+ float size,
+ float time)
{
ANIM_SCREEN(s);
+ ANIM_WINDOW(w);
ps->numParticles =
- width / as->opt[ANIM_SCREEN_OPTION_BEAMUP_SPACING].value.i;
+ width / animGetI(as, aw, ANIM_SCREEN_OPTION_BEAMUP_SPACING);
float max_new =
- ps->numParticles * (time / 50) * (1.05 -
- as->
- opt
- [ANIM_SCREEN_OPTION_BEAMUP_LIFE].
- value.f);
+ ps->numParticles * (time / 50) *
+ (1.05 - animGetF(as, aw, ANIM_SCREEN_OPTION_BEAMUP_LIFE));
int i;
Particle *part;
float rVal;
@@ -117,11 +122,11 @@ fxBeamUpGenNewFire(CompScreen * s, ParticleSystem * ps, int x, int y,
// give gt new life
rVal = (float)(random() & 0xff) / 255.0;
part->life = 1.0f;
- part->fade = (rVal * (1 - as->opt[ANIM_SCREEN_OPTION_BEAMUP_LIFE].value.f)) +
- (0.2f * (1.01 - as->opt[ANIM_SCREEN_OPTION_BEAMUP_LIFE].value.f)); // Random Fade Value
+ part->fade = (rVal * (1 - animGetF(as, aw, ANIM_SCREEN_OPTION_BEAMUP_LIFE))) +
+ (0.2f * (1.01 - animGetF(as, aw, ANIM_SCREEN_OPTION_BEAMUP_LIFE))); // Random Fade Value
// set size
- part->width = 2.5 * as->opt[ANIM_SCREEN_OPTION_BEAMUP_SIZE].value.f;
+ part->width = 2.5 * animGetF(as, aw, ANIM_SCREEN_OPTION_BEAMUP_SIZE);
part->height = height;
part->w_mod = size * 0.2;
part->h_mod = size * 0.02;
@@ -140,14 +145,16 @@ fxBeamUpGenNewFire(CompScreen * s, ParticleSystem * ps, int x, int y,
part->yi = 0.0f;
part->zi = 0.0f;
- // set color ABAB as->opt[ANIM_SCREEN_OPTION_BEAMUP_COLOR].value.f
- part->r = (float)as->opt[ANIM_SCREEN_OPTION_BEAMUP_COLOR].value.c[0] / 0xffff -
- (rVal / 1.7 * (float)as->opt[ANIM_SCREEN_OPTION_BEAMUP_COLOR].value.c[0] / 0xffff);
- part->g = (float)as->opt[ANIM_SCREEN_OPTION_BEAMUP_COLOR].value.c[1] / 0xffff -
- (rVal / 1.7 * (float)as->opt[ANIM_SCREEN_OPTION_BEAMUP_COLOR].value.c[1] / 0xffff);
- part->b = (float)as->opt[ANIM_SCREEN_OPTION_BEAMUP_COLOR].value.c[2] / 0xffff -
- (rVal / 1.7 * (float)as->opt[ANIM_SCREEN_OPTION_BEAMUP_COLOR].value.c[2] / 0xffff);
- part->a = (float)as->opt[ANIM_SCREEN_OPTION_BEAMUP_COLOR].value.c[3] / 0xffff;
+ // set color ABAB ANIM_SCREEN_OPTION_BEAMUP_COLOR
+ unsigned short *c =
+ animGetC(as, aw, ANIM_SCREEN_OPTION_BEAMUP_COLOR);
+ part->r = (float)c[0] / 0xffff -
+ (rVal / 1.7 * (float)c[0] / 0xffff);
+ part->g = (float)c[1] / 0xffff -
+ (rVal / 1.7 * (float)c[1] / 0xffff);
+ part->b = (float)c[2] / 0xffff -
+ (rVal / 1.7 * (float)c[2] / 0xffff);
+ part->a = (float)c[3] / 0xffff;
// set gravity
part->xg = 0.0f;
@@ -228,7 +235,7 @@ Bool fxBeamUpModelStep(CompScreen * s, CompWindow * w, float time)
if (aw->animRemainingTime > 0 && aw->numPs)
{
- fxBeamUpGenNewFire(s, &aw->ps[1],
+ fxBeamUpGenNewFire(s, w, &aw->ps[1],
WIN_X(w), WIN_Y(w) + (WIN_H(w) / 2), WIN_W(w),
creating ? WIN_H(w) - (old / 2 * WIN_H(w)) :
(WIN_H(w) - (old * WIN_H(w))),
Modified: fusion/plugins/animation/burn.c
===================================================================
--- fusion/plugins/animation/burn.c
+++ fusion/plugins/animation/burn.c
@@ -55,16 +55,16 @@ void fxBurnInit(CompScreen * s, CompWindow * w)
}
aw->numPs = 2;
}
- initParticles(as->opt[ANIM_SCREEN_OPTION_FIRE_PARTICLES].value.i /
+ initParticles(animGetI(as, aw, ANIM_SCREEN_OPTION_FIRE_PARTICLES)/
10, &aw->ps[0]);
- initParticles(as->opt[ANIM_SCREEN_OPTION_FIRE_PARTICLES].value.i,
+ initParticles(animGetI(as, aw, ANIM_SCREEN_OPTION_FIRE_PARTICLES),
&aw->ps[1]);
- aw->ps[1].slowdown = as->opt[ANIM_SCREEN_OPTION_FIRE_SLOWDOWN].value.f;
+ aw->ps[1].slowdown = animGetF(as, aw, ANIM_SCREEN_OPTION_FIRE_SLOWDOWN);
aw->ps[1].darken = 0.5;
aw->ps[1].blendMode = GL_ONE;
aw->ps[0].slowdown =
- as->opt[ANIM_SCREEN_OPTION_FIRE_SLOWDOWN].value.f / 2.0;
+ animGetF(as, aw, ANIM_SCREEN_OPTION_FIRE_SLOWDOWN) / 2.0;
aw->ps[0].darken = 0.0;
aw->ps[0].blendMode = GL_ONE_MINUS_SRC_ALPHA;
@@ -91,9 +91,9 @@ void fxBurnInit(CompScreen * s, CompWindow * w)
glBindTexture(GL_TEXTURE_2D, 0);
aw->animFireDirection = getAnimationDirection
- (w, &as->opt[ANIM_SCREEN_OPTION_FIRE_DIRECTION].value, FALSE);
+ (w, animGetOptVal(as, aw, ANIM_SCREEN_OPTION_FIRE_DIRECTION), FALSE);
- if (as->opt[ANIM_SCREEN_OPTION_FIRE_CONSTANT_SPEED].value.b)
+ if (animGetB(as, aw, ANIM_SCREEN_OPTION_FIRE_CONSTANT_SPEED))
{
aw->animTotalTime *= WIN_H(w) / 500.0;
aw->animRemainingTime *= WIN_H(w) / 500.0;
@@ -101,17 +101,22 @@ void fxBurnInit(CompScreen * s, CompWindow * w)
}
static void
-fxBurnGenNewFire(CompScreen * s, ParticleSystem * ps, int x, int y,
- int width, int height, float size, float time)
+fxBurnGenNewFire(CompScreen * s,
+ CompWindow * w,
+ ParticleSystem * ps,
+ int x,
+ int y,
+ int width,
+ int height,
+ float size,
+ float time)
{
ANIM_SCREEN(s);
+ ANIM_WINDOW(w);
float max_new =
- ps->numParticles * (time / 50) * (1.05 -
- as->
- opt
- [ANIM_SCREEN_OPTION_FIRE_LIFE].
- value.f);
+ ps->numParticles * (time / 50) *
+ (1.05 - animGetF(as, aw, ANIM_SCREEN_OPTION_FIRE_LIFE));
int i;
Particle *part;
float rVal;
@@ -124,12 +129,12 @@ fxBurnGenNewFire(CompScreen * s, ParticleSystem * ps, int x, int y,
// give gt new life
rVal = (float)(random() & 0xff) / 255.0;
part->life = 1.0f;
- part->fade = (rVal * (1 - as->opt[ANIM_SCREEN_OPTION_FIRE_LIFE].value.f)) +
- (0.2f * (1.01 - as->opt[ANIM_SCREEN_OPTION_FIRE_LIFE].value.f)); // Random Fade Value
+ part->fade = (rVal * (1 - animGetF(as, aw, ANIM_SCREEN_OPTION_FIRE_LIFE))) +
+ (0.2f * (1.01 - animGetF(as, aw, ANIM_SCREEN_OPTION_FIRE_LIFE))); // Random Fade Value
// set size
- part->width = as->opt[ANIM_SCREEN_OPTION_FIRE_SIZE].value.f;
- part->height = as->opt[ANIM_SCREEN_OPTION_FIRE_SIZE].value.f * 1.5;
+ part->width = animGetF(as, aw, ANIM_SCREEN_OPTION_FIRE_SIZE);
+ part->height = animGetF(as, aw, ANIM_SCREEN_OPTION_FIRE_SIZE) * 1.5;
rVal = (float)(random() & 0xff) / 255.0;
part->w_mod = size * rVal;
part->h_mod = size * rVal;
@@ -152,7 +157,10 @@ fxBurnGenNewFire(CompScreen * s, ParticleSystem * ps, int x, int y,
part->zi = 0.0f;
rVal = (float)(random() & 0xff) / 255.0;
- if (as->opt[ANIM_SCREEN_OPTION_FIRE_MYSTICAL].value.b)
+ // set color ABAB ANIM_SCREEN_OPTION_FIRE_COLOR
+ unsigned short *c =
+ animGetC(as, aw, ANIM_SCREEN_OPTION_FIRE_COLOR);
+ if (animGetB(as, aw, ANIM_SCREEN_OPTION_FIRE_MYSTICAL))
{
// Random colors! (aka Mystical Fire)
rVal = (float)(random() & 0xff) / 255.0;
@@ -164,16 +172,15 @@ fxBurnGenNewFire(CompScreen * s, ParticleSystem * ps, int x, int y,
}
else
{
- // set color ABAB as->opt[ANIM_SCREEN_OPTION_FIRE_COLOR].value.f
- part->r = (float)as->opt[ANIM_SCREEN_OPTION_FIRE_COLOR].value.c[0] / 0xffff -
- (rVal / 1.7 * (float)as->opt[ANIM_SCREEN_OPTION_FIRE_COLOR].value.c[0] / 0xffff);
- part->g = (float)as->opt[ANIM_SCREEN_OPTION_FIRE_COLOR].value.c[1] / 0xffff -
- (rVal / 1.7 * (float)as->opt[ANIM_SCREEN_OPTION_FIRE_COLOR].value.c[1] / 0xffff);
- part->b = (float)as->opt[ANIM_SCREEN_OPTION_FIRE_COLOR].value.c[2] / 0xffff -
- (rVal / 1.7 * (float)as->opt[ANIM_SCREEN_OPTION_FIRE_COLOR].value.c[2] / 0xffff);
+ part->r = (float)c[0] / 0xffff -
+ (rVal / 1.7 * (float)c[0] / 0xffff);
+ part->g = (float)c[1] / 0xffff -
+ (rVal / 1.7 * (float)c[1] / 0xffff);
+ part->b = (float)c[2] / 0xffff -
+ (rVal / 1.7 * (float)c[2] / 0xffff);
}
// set transparancy
- part->a = (float)as->opt[ANIM_SCREEN_OPTION_FIRE_COLOR].value.c[3] / 0xffff;
+ part->a = (float)c[3] / 0xffff;
// set gravity
part->xg = (part->x < part->xo) ? 1.0 : -1.0;
@@ -192,17 +199,22 @@ fxBurnGenNewFire(CompScreen * s, ParticleSystem * ps, int x, int y,
}
static void
-fxBurnGenNewSmoke(CompScreen * s, ParticleSystem * ps, int x, int y,
- int width, int height, float size, float time)
+fxBurnGenNewSmoke(CompScreen * s,
+ CompWindow * w,
+ ParticleSystem * ps,
+ int x,
+ int y,
+ int width,
+ int height,
+ float size,
+ float time)
{
ANIM_SCREEN(s);
+ ANIM_WINDOW(w);
float max_new =
- ps->numParticles * (time / 50) * (1.05 -
- as->
- opt
- [ANIM_SCREEN_OPTION_FIRE_LIFE].
- value.f);
+ ps->numParticles * (time / 50) *
+ (1.05 - animGetF(as, aw, ANIM_SCREEN_OPTION_FIRE_LIFE));
int i;
Particle *part;
float rVal;
@@ -215,12 +227,12 @@ fxBurnGenNewSmoke(CompScreen * s, ParticleSystem * ps, int x, int y,
// give gt new life
rVal = (float)(random() & 0xff) / 255.0;
part->life = 1.0f;
- part->fade = (rVal * (1 - as->opt[ANIM_SCREEN_OPTION_FIRE_LIFE].value.f)) +
- (0.2f * (1.01 - as->opt[ANIM_SCREEN_OPTION_FIRE_LIFE].value.f)); // Random Fade Value
+ part->fade = (rVal * (1 - animGetF(as, aw, ANIM_SCREEN_OPTION_FIRE_LIFE))) +
+ (0.2f * (1.01 - animGetF(as, aw, ANIM_SCREEN_OPTION_FIRE_LIFE))); // Random Fade Value
// set size
- part->width = as->opt[ANIM_SCREEN_OPTION_FIRE_SIZE].value.f * size * 5;
- part->height = as->opt[ANIM_SCREEN_OPTION_FIRE_SIZE].value.f * size * 5;
+ part->width = animGetF(as, aw, ANIM_SCREEN_OPTION_FIRE_SIZE) * size * 5;
+ part->height = animGetF(as, aw, ANIM_SCREEN_OPTION_FIRE_SIZE) * size * 5;
rVal = (float)(random() & 0xff) / 255.0;
part->w_mod = -0.8;
part->h_mod = -0.8;
@@ -275,7 +287,7 @@ Bool fxBurnModelStep(CompScreen * s, CompWindow * w, float time)
Model *model = aw->model;
- Bool smoke = as->opt[ANIM_SCREEN_OPTION_FIRE_SMOKE].value.b;
+ Bool smoke = animGetB(as, aw, ANIM_SCREEN_OPTION_FIRE_SMOKE);
float timestep = (s->slowAnimations ? 2 : // For smooth slow-mo (refer to display.c)
as->opt[ANIM_SCREEN_OPTION_TIME_STEP_INTENSE].value.i);
@@ -354,34 +366,34 @@ Bool fxBurnModelStep(CompScreen * s, CompWindow * w, float time)
{
case AnimDirectionUp:
if (smoke)
- fxBurnGenNewSmoke(s, &aw->ps[0], WIN_X(w),
+ fxBurnGenNewSmoke(s, w, &aw->ps[0], WIN_X(w),
WIN_Y(w) + ((1 - old) * WIN_H(w)),
WIN_W(w), 1, WIN_W(w) / 40.0, time);
- fxBurnGenNewFire(s, &aw->ps[1], WIN_X(w),
+ fxBurnGenNewFire(s, w, &aw->ps[1], WIN_X(w),
WIN_Y(w) + ((1 - old) * WIN_H(w)),
WIN_W(w), (stepSize) * WIN_H(w),
WIN_W(w) / 40.0, time);
break;
case AnimDirectionLeft:
if (smoke)
- fxBurnGenNewSmoke(s, &aw->ps[0],
+ fxBurnGenNewSmoke(s, w, &aw->ps[0],
WIN_X(w) + ((1 - old) * WIN_W(w)),
WIN_Y(w),
(stepSize) * WIN_W(w),
WIN_H(w), WIN_H(w) / 40.0, time);
- fxBurnGenNewFire(s, &aw->ps[1],
+ fxBurnGenNewFire(s, w, &aw->ps[1],
WIN_X(w) + ((1 - old) * WIN_W(w)),
WIN_Y(w), (stepSize) * WIN_W(w),
WIN_H(w), WIN_H(w) / 40.0, time);
break;
case AnimDirectionRight:
if (smoke)
- fxBurnGenNewSmoke(s, &aw->ps[0],
+ fxBurnGenNewSmoke(s, w, &aw->ps[0],
WIN_X(w) + (old * WIN_W(w)),
WIN_Y(w),
(stepSize) * WIN_W(w),
WIN_H(w), WIN_H(w) / 40.0, time);
- fxBurnGenNewFire(s, &aw->ps[1],
+ fxBurnGenNewFire(s, w, &aw->ps[1],
WIN_X(w) + (old * WIN_W(w)),
WIN_Y(w), (stepSize) * WIN_W(w),
WIN_H(w), WIN_H(w) / 40.0, time);
@@ -389,10 +401,10 @@ Bool fxBurnModelStep(CompScreen * s, CompWindow * w, float time)
case AnimDirectionDown:
default:
if (smoke)
- fxBurnGenNewSmoke(s, &aw->ps[0], WIN_X(w),
+ fxBurnGenNewSmoke(s, w, &aw->ps[0], WIN_X(w),
WIN_Y(w) + (old * WIN_H(w)),
WIN_W(w), 1, WIN_W(w) / 40.0, time);
- fxBurnGenNewFire(s, &aw->ps[1], WIN_X(w),
+ fxBurnGenNewFire(s, w, &aw->ps[1], WIN_X(w),
WIN_Y(w) + (old * WIN_H(w)),
WIN_W(w), (stepSize) * WIN_H(w),
WIN_W(w) / 40.0, time);
Modified: fusion/plugins/animation/curvedfold.c
===================================================================
--- fusion/plugins/animation/curvedfold.c
+++ fusion/plugins/animation/curvedfold.c
@@ -127,8 +127,7 @@ Bool fxCurvedFoldModelStep(CompScreen * s, CompWindow * w, float time)
float forwardProgress;
if ((aw->curWindowEvent == WindowEventMinimize ||
aw->curWindowEvent == WindowEventUnminimize) &&
- as->opt[ANIM_SCREEN_OPTION_CURVED_FOLD_Z2TOM].
- value.b)
+ animGetB(as, aw, ANIM_SCREEN_OPTION_CURVED_FOLD_Z2TOM))
{
float dummy;
fxZoomAnimProgress(as, aw, &forwardProgress, &dummy, TRUE);
@@ -137,7 +136,7 @@ Bool fxCurvedFoldModelStep(CompScreen * s, CompWindow * w, float time)
forwardProgress = defaultAnimProgress(aw);
float curveMaxAmp =
- as->opt[ANIM_SCREEN_OPTION_CURVED_FOLD_AMP].value.f * WIN_W(w) *
+ animGetF(as, aw, ANIM_SCREEN_OPTION_CURVED_FOLD_AMP) * WIN_W(w) *
pow(WIN_H(w) / (s->height * 1.2f), 0.7);
int i;
for (i = 0; i < model->numObjects; i++)
@@ -163,11 +162,9 @@ fxFoldUpdateWindowAttrib(AnimScreen * as,
((aw->curWindowEvent == WindowEventMinimize ||
aw->curWindowEvent == WindowEventUnminimize) &&
((aw->curAnimEffect == AnimEffectCurvedFold &&
- !as->opt[ANIM_SCREEN_OPTION_CURVED_FOLD_Z2TOM].
- value.b) ||
+ !animGetB(as, aw, ANIM_SCREEN_OPTION_CURVED_FOLD_Z2TOM)) ||
(aw->curAnimEffect == AnimEffectHorizontalFolds &&
- !as->opt[ANIM_SCREEN_OPTION_HORIZONTAL_FOLDS_Z2TOM].
- value.b))))
+ !animGetB(as, aw, ANIM_SCREEN_OPTION_HORIZONTAL_FOLDS_Z2TOM)))))
{
float forwardProgress = defaultAnimProgress(aw);
@@ -177,11 +174,9 @@ fxFoldUpdateWindowAttrib(AnimScreen * as,
else if ((aw->curWindowEvent == WindowEventMinimize ||
aw->curWindowEvent == WindowEventUnminimize) &&
((aw->curAnimEffect == AnimEffectCurvedFold &&
- as->opt[ANIM_SCREEN_OPTION_CURVED_FOLD_Z2TOM].
- value.b) ||
+ animGetB(as, aw, ANIM_SCREEN_OPTION_CURVED_FOLD_Z2TOM)) ||
(aw->curAnimEffect == AnimEffectHorizontalFolds &&
- as->opt[ANIM_SCREEN_OPTION_HORIZONTAL_FOLDS_Z2TOM].
- value.b)))
+ animGetB(as, aw, ANIM_SCREEN_OPTION_HORIZONTAL_FOLDS_Z2TOM))))
{
fxZoomUpdateWindowAttrib(as, w, wAttrib);
}
Modified: fusion/plugins/animation/domino.c
===================================================================
--- fusion/plugins/animation/domino.c
+++ fusion/plugins/animation/domino.c
@@ -47,10 +47,10 @@ void fxDomino3DInit(CompScreen * s, CompWindow * w)
if (isRazr)
fallDir = getAnimationDirection
- (w, &as->opt[ANIM_SCREEN_OPTION_RAZR_DIRECTION].value, TRUE);
+ (w, animGetOptVal(as, aw, ANIM_SCREEN_OPTION_RAZR_DIRECTION), TRUE);
else
fallDir = getAnimationDirection
- (w, &as->opt[ANIM_SCREEN_OPTION_DOMINO_DIRECTION].value,
+ (w, animGetOptVal(as, aw, ANIM_SCREEN_OPTION_DOMINO_DIRECTION),
TRUE);
int defaultGridSize = 20;
Modified: fusion/plugins/animation/dream.c
===================================================================
--- fusion/plugins/animation/dream.c
+++ fusion/plugins/animation/dream.c
@@ -71,8 +71,7 @@ Bool fxDreamModelStep(CompScreen * s, CompWindow * w, float time)
float forwardProgress;
if ((aw->curWindowEvent == WindowEventMinimize ||
aw->curWindowEvent == WindowEventUnminimize) &&
- as->opt[ANIM_SCREEN_OPTION_DREAM_Z2TOM].
- value.b)
+ animGetB(as, aw, ANIM_SCREEN_OPTION_DREAM_Z2TOM))
{
float dummy;
fxZoomAnimProgress(as, aw, &forwardProgress, &dummy, TRUE);
@@ -98,8 +97,7 @@ fxDreamUpdateWindowAttrib(AnimScreen * as,
if ((aw->curWindowEvent == WindowEventMinimize ||
aw->curWindowEvent == WindowEventUnminimize) &&
- as->opt[ANIM_SCREEN_OPTION_DREAM_Z2TOM].
- value.b)
+ animGetB(as, aw, ANIM_SCREEN_OPTION_DREAM_Z2TOM))
{
fxZoomUpdateWindowAttrib(as, w, wAttrib);
return;
Modified: fusion/plugins/animation/explode3d.c
===================================================================
--- fusion/plugins/animation/explode3d.c
+++ fusion/plugins/animation/explode3d.c
@@ -41,20 +41,20 @@ void fxExplode3DInit(CompScreen * s, CompWindow * w)
ANIM_WINDOW(w);
ANIM_SCREEN(s);
- switch (as->opt[ANIM_SCREEN_OPTION_EXPLODE3D_TESS].value.i)
+ switch (animGetI(as, aw, ANIM_SCREEN_OPTION_EXPLODE3D_TESS))
{
case PolygonTessRect:
if (!tessellateIntoRectangles(w,
- as->opt[ANIM_SCREEN_OPTION_EXPLODE3D_GRIDSIZE_X].value.i,
- as->opt[ANIM_SCREEN_OPTION_EXPLODE3D_GRIDSIZE_Y].value.i,
- as->opt[ANIM_SCREEN_OPTION_EXPLODE3D_THICKNESS].value.f))
+ animGetI(as, aw, ANIM_SCREEN_OPTION_EXPLODE3D_GRIDSIZE_X),
+ animGetI(as, aw, ANIM_SCREEN_OPTION_EXPLODE3D_GRIDSIZE_Y),
+ animGetF(as, aw, ANIM_SCREEN_OPTION_EXPLODE3D_THICKNESS)))
return;
break;
case PolygonTessHex:
if (!tessellateIntoHexagons(w,
- as->opt[ANIM_SCREEN_OPTION_EXPLODE3D_GRIDSIZE_X].value.i,
- as->opt[ANIM_SCREEN_OPTION_EXPLODE3D_GRIDSIZE_Y].value.i,
- as->opt[ANIM_SCREEN_OPTION_EXPLODE3D_THICKNESS].value.f))
+ animGetI(as, aw, ANIM_SCREEN_OPTION_EXPLODE3D_GRIDSIZE_X),
+ animGetI(as, aw, ANIM_SCREEN_OPTION_EXPLODE3D_GRIDSIZE_Y),
+ animGetF(as, aw, ANIM_SCREEN_OPTION_EXPLODE3D_THICKNESS)))
return;
break;
default:
Modified: fusion/plugins/animation/glide.c
===================================================================
--- fusion/plugins/animation/glide.c
+++ fusion/plugins/animation/glide.c
@@ -45,15 +45,15 @@ fxGlideGetParams
{
if (aw->curAnimEffect == AnimEffectGlide3D1)
{
- *finalDistFac = as->opt[ANIM_SCREEN_OPTION_GLIDE1_AWAY_POS].value.f;
- *finalRotAng = as->opt[ANIM_SCREEN_OPTION_GLIDE1_AWAY_ANGLE].value.f;
- *thickness = as->opt[ANIM_SCREEN_OPTION_GLIDE1_THICKNESS].value.f;
+ *finalDistFac = animGetF(as, aw, ANIM_SCREEN_OPTION_GLIDE1_AWAY_POS);
+ *finalRotAng = animGetF(as, aw, ANIM_SCREEN_OPTION_GLIDE1_AWAY_ANGLE);
+ *thickness = animGetF(as, aw, ANIM_SCREEN_OPTION_GLIDE1_THICKNESS);
}
else
{
- *finalDistFac = as->opt[ANIM_SCREEN_OPTION_GLIDE2_AWAY_POS].value.f;
- *finalRotAng = as->opt[ANIM_SCREEN_OPTION_GLIDE2_AWAY_ANGLE].value.f;
- *thickness = as->opt[ANIM_SCREEN_OPTION_GLIDE2_THICKNESS].value.f;
+ *finalDistFac = animGetF(as, aw, ANIM_SCREEN_OPTION_GLIDE2_AWAY_POS);
+ *finalRotAng = animGetF(as, aw, ANIM_SCREEN_OPTION_GLIDE2_AWAY_ANGLE);
+ *thickness = animGetF(as, aw, ANIM_SCREEN_OPTION_GLIDE2_THICKNESS);
}
}
@@ -61,9 +61,9 @@ Bool
fxGlideIsPolygonBased (AnimScreen *as, AnimWindow *aw)
{
if (aw->curAnimEffect == AnimEffectGlide3D1)
- return (as->opt[ANIM_SCREEN_OPTION_GLIDE1_THICKNESS].value.f > 1e-5);
+ return (animGetF(as, aw, ANIM_SCREEN_OPTION_GLIDE1_THICKNESS) > 1e-5);
else
- return (as->opt[ANIM_SCREEN_OPTION_GLIDE2_THICKNESS].value.f > 1e-5);
+ return (animGetF(as, aw, ANIM_SCREEN_OPTION_GLIDE2_THICKNESS) > 1e-5);
}
static inline Bool
@@ -73,11 +73,9 @@ fxGlideZoomToTaskBar (AnimScreen *as, AnimWindow *aw)
(aw->curWindowEvent == WindowEventMinimize ||
aw->curWindowEvent == WindowEventUnminimize) &&
((aw->curAnimEffect == AnimEffectGlide3D1 &&
- as->opt[ANIM_SCREEN_OPTION_GLIDE1_Z2TOM].
- value.b) ||
+ animGetB(as, aw, ANIM_SCREEN_OPTION_GLIDE1_Z2TOM)) ||
(aw->curAnimEffect == AnimEffectGlide3D2 &&
- as->opt[ANIM_SCREEN_OPTION_GLIDE2_Z2TOM].
- value.b));
+ animGetB(as, aw, ANIM_SCREEN_OPTION_GLIDE2_Z2TOM)));
}
Bool
@@ -229,7 +227,7 @@ void fxGlideInit(CompScreen * s, CompWindow * w)
// store window opacity
aw->storedOpacity = w->paint.opacity;
aw->timestep = (s->slowAnimations ? 2 : // For smooth slow-mo
- as->opt[ANIM_SCREEN_OPTION_TIME_STEP].value.i);
+ animGetI(as, aw, ANIM_SCREEN_OPTION_TIME_STEP));
return; // we're done with CompTransform-based glide initialization
}
Modified: fusion/plugins/animation/horizontalfold.c
===================================================================
--- fusion/plugins/animation/horizontalfold.c
+++ fusion/plugins/animation/horizontalfold.c
@@ -40,18 +40,18 @@
void
-fxHorizontalFoldsInitGrid(AnimScreen * as,
- WindowEvent forWindowEvent,
+fxHorizontalFoldsInitGrid(AnimScreen *as,
+ AnimWindow *aw,
int *gridWidth, int *gridHeight)
{
*gridWidth = 2;
- if (forWindowEvent == WindowEventShade ||
- forWindowEvent == WindowEventUnshade)
+ if (aw->curWindowEvent == WindowEventShade ||
+ aw->curWindowEvent == WindowEventUnshade)
*gridHeight = 3 + 2 *
- as->opt[ANIM_SCREEN_OPTION_HORIZONTAL_FOLDS_NUM_FOLDS].value.i;
+ animGetI(as, aw, ANIM_SCREEN_OPTION_HORIZONTAL_FOLDS_NUM_FOLDS);
else
*gridHeight = 1 + 2 *
- as->opt[ANIM_SCREEN_OPTION_HORIZONTAL_FOLDS_NUM_FOLDS].value.i;
+ animGetI(as, aw, ANIM_SCREEN_OPTION_HORIZONTAL_FOLDS_NUM_FOLDS);
}
static void
@@ -134,8 +134,7 @@ fxHorizontalFoldsModelStep(CompScreen * s, CompWindow * w, float time)
float forwardProgress;
if ((aw->curWindowEvent == WindowEventMinimize ||
aw->curWindowEvent == WindowEventUnminimize) &&
- as->opt[ANIM_SCREEN_OPTION_HORIZONTAL_FOLDS_Z2TOM].
- value.b)
+ animGetB(as, aw, ANIM_SCREEN_OPTION_HORIZONTAL_FOLDS_Z2TOM))
{
float dummy;
fxZoomAnimProgress(as, aw, &forwardProgress, &dummy, TRUE);
@@ -149,7 +148,7 @@ fxHorizontalFoldsModelStep(CompScreen * s, CompWindow * w, float time)
model,
&model->objects[i],
forwardProgress,
- as->opt[ANIM_SCREEN_OPTION_HORIZONTAL_FOLDS_AMP].value.f *
+ animGetF(as, aw, ANIM_SCREEN_OPTION_HORIZONTAL_FOLDS_AMP) *
WIN_W(w),
i / model->gridWidth);
modelCalcBounds(model);
Modified: fusion/plugins/animation/magiclamp.c
===================================================================
--- fusion/plugins/animation/magiclamp.c
+++ fusion/plugins/animation/magiclamp.c
@@ -37,19 +37,18 @@
#include "animation-internal.h"
void
-fxMagicLampInitGrid(AnimScreen * as,
- WindowEvent forWindowEvent,
+fxMagicLampInitGrid(AnimScreen *as, AnimWindow *aw,
int *gridWidth, int *gridHeight)
{
*gridWidth = 2;
- *gridHeight = as->opt[ANIM_SCREEN_OPTION_MAGIC_LAMP_GRID_RES].value.i;
+ *gridHeight = animGetI(as, aw, ANIM_SCREEN_OPTION_MAGIC_LAMP_GRID_RES);
}
void
-fxVacuumInitGrid(AnimScreen * as, WindowEvent forWindowEvent,
+fxVacuumInitGrid(AnimScreen * as, AnimWindow *aw,
int *gridWidth, int *gridHeight)
{
*gridWidth = 2;
- *gridHeight = as->opt[ANIM_SCREEN_OPTION_VACUUM_GRID_RES].value.i;
+ *gridHeight = animGetI(as, aw, ANIM_SCREEN_OPTION_VACUUM_GRID_RES);
}
void fxMagicLampInit(CompScreen * s, CompWindow * w)
@@ -67,11 +66,11 @@ void fxMagicLampInit(CompScreen * s, CompWindow * w)
if (aw->curAnimEffect == AnimEffectMagicLamp)
{
- maxWaves = as->opt[ANIM_SCREEN_OPTION_MAGIC_LAMP_MAX_WAVES].value.i;
+ maxWaves = animGetI(as, aw, ANIM_SCREEN_OPTION_MAGIC_LAMP_MAX_WAVES);
waveAmpMin =
- as->opt[ANIM_SCREEN_OPTION_MAGIC_LAMP_WAVE_AMP_MIN].value.f;
+ animGetF(as, aw, ANIM_SCREEN_OPTION_MAGIC_LAMP_WAVE_AMP_MIN);
waveAmpMax =
- as->opt[ANIM_SCREEN_OPTION_MAGIC_LAMP_WAVE_AMP_MAX].value.f;
+ animGetF(as, aw, ANIM_SCREEN_OPTION_MAGIC_LAMP_WAVE_AMP_MAX);
}
else
{
@@ -299,9 +298,9 @@ Bool fxMagicLampModelStep(CompScreen * s, CompWindow * w, float time)
if ((aw->curWindowEvent == WindowEventOpen ||
aw->curWindowEvent == WindowEventClose) &&
((aw->curAnimEffect == AnimEffectMagicLamp &&
- as->opt[ANIM_SCREEN_OPTION_MAGIC_LAMP_MOVING_END].value.b) ||
+ animGetB(as, aw, ANIM_SCREEN_OPTION_MAGIC_LAMP_MOVING_END)) ||
(aw->curAnimEffect == AnimEffectVacuum &&
- as->opt[ANIM_SCREEN_OPTION_VACUUM_MOVING_END].value.b)))
+ animGetB(as, aw, ANIM_SCREEN_OPTION_VACUUM_MOVING_END))))
{
// Update icon position
getMousePointerXY(s, &aw->icon.x, &aw->icon.y);
Modified: fusion/plugins/animation/options.c
new file mode 100644
===================================================================
--- /dev/null
+++ fusion/plugins/animation/options.c
@@ -0,0 +1,359 @@
+/*
+ * Animation plugin for compiz/beryl
+ *
+ * animation.c
+ *
+ * Copyright : (C) 2006 Erkin Bahceci
+ * E-mail : erkinbah at gmail.com
+ *
+ * Based on Wobbly and Minimize plugins by
+ * : David Reveman
+ * E-mail : davidr at novell.com>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+#include "animation-internal.h"
+
+// ================= Option Related Functions =================
+
+CompOptionValue *
+animGetOptVal(AnimScreen *as,
+ AnimWindow *aw,
+ int optionId)
+{
+ OptionSet *os =
+ &as->eventOptionSets[aw->curWindowEvent]->sets[aw->curAnimSelectionRow];
+ IdValuePair *pair = os->pairs;
+
+ int i;
+ for (i = 0; i < os->nPairs; i++, pair++)
+ if (pair->id == optionId)
+ return &pair->value;
+ return &as->opt[optionId].value;
+}
+
+inline Bool
+animGetB(AnimScreen *as,
+ AnimWindow *aw,
+ int optionId)
+{
+ return animGetOptVal(as, aw, optionId)->b;
+}
+
+inline int
+animGetI(AnimScreen *as,
+ AnimWindow *aw,
+ int optionId)
+{
+ return animGetOptVal(as, aw, optionId)->i;
+}
+
+inline float
+animGetF(AnimScreen *as,
+ AnimWindow *aw,
+ int optionId)
+{
+ return animGetOptVal(as, aw, optionId)->f;
+}
+
+inline char *
+animGetS(AnimScreen *as,
+ AnimWindow *aw,
+ int optionId)
+{
+ return animGetOptVal(as, aw, optionId)->s;
+}
+
+inline unsigned short *
+animGetC(AnimScreen *as,
+ AnimWindow *aw,
+ int optionId)
+{
+ return animGetOptVal(as, aw, optionId)->c;
+}
+
+static
+void freeSingleEventOptionSets(OptionSets *oss)
+{
+ int j;
+ for (j = 0; j < oss->nSets; j++)
+ if (oss->sets[j].pairs)
+ free(oss->sets[j].pairs);
+ free (oss->sets);
+ oss->sets = NULL;
+}
+
+void
+freeAllOptionSets(OptionSets **eventsOss)
+{
+ int i;
+ for (i = 1; i < NUM_EVENTS; i++)
+ {
+ OptionSets *oss = eventsOss[i];
+ if (!oss->sets)
+ continue;
+ freeSingleEventOptionSets(oss);
+ }
+ free (eventsOss[WindowEventOpen]);
+ free (eventsOss[WindowEventClose]);
+ free (eventsOss[WindowEventMinimize]);
+ free (eventsOss[WindowEventFocus]);
+ free (eventsOss[WindowEventShade]);
+
+ for (i = 1; i < NUM_EVENTS; i++)
+ eventsOss[i] = NULL;
+}
+
+static void
+updateOptionSet(CompScreen *s, OptionSet *os, char *optNamesValuesOrig)
+{
+ ANIM_SCREEN(s);
+ int len = strlen(optNamesValuesOrig);
+ char *optNamesValues = calloc(len + 1, 1);
+
+ // Find the first substring with no spaces in it
+ sscanf(optNamesValuesOrig, " %s ", optNamesValues);
+ if (strlen(optNamesValues) == 0)
+ {
+ free(optNamesValues);
+ return;
+ }
+ // Backup original, since strtok is destructive
+ strcpy(optNamesValues, optNamesValuesOrig);
+
+ char *name;
+ char *nameTrimmed = calloc(len + 1, 1);
+ char *valueStr;
+ char *betweenPairs = ",";
+ char *betweenOptVal = "=";
+
+ // Count number of pairs
+ char *pairToken = optNamesValuesOrig;
+ int nPairs = 1;
+
+ while ((pairToken = strchr(pairToken, betweenPairs[0])))
+ {
+ pairToken++; // skip delimiter
+ nPairs++;
+ }
+
+ if (os->pairs)
+ free(os->pairs);
+ os->pairs = calloc(nPairs, sizeof(IdValuePair));
+ if (!os->pairs)
+ {
+ os->nPairs = 0;
+ compLogMessage (s->display, "animation", CompLogLevelError,
+ "Not enough memory");
+ return;
+ }
+ os->nPairs = nPairs;
+
+ // Tokenize pairs
+ name = strtok(optNamesValues, betweenOptVal);
+ int errorNo = -1;
+ int i;
+ for (i = 0; name && i < nPairs; i++)
+ {
+ errorNo = 0;
+ if (strchr(name, betweenPairs[0])) // handle "a, b=4" case
+ {
+ errorNo = 1;
+ break;
+ }
+
+ sscanf(name, " %s ", nameTrimmed);
+ if (strlen(nameTrimmed) == 0)
+ {
+ errorNo = 2;
+ break;
+ }
+ valueStr = strtok(NULL, betweenPairs);
+ if (!valueStr)
+ {
+ errorNo = 3;
+ break;
+ }
+
+ CompOption *o;
+ int j;
+
+ // Skip non-effect options
+ for (j = 0; j < ANIM_SCREEN_OPTION_NUM; j++)
+ {
+ o = &as->opt[j];
+ if (strcasecmp(nameTrimmed, o->name) == 0)
+ break;
+ }
+ if (j == ANIM_SCREEN_OPTION_NUM) // no match
+ {
+ errorNo = 4;
+ break;
+ }
+ else if (j < NUM_NONEFFECT_OPTIONS)
+ {
+ errorNo = 5;
+ break;
+ }
+
+ CompOptionValue v;
+
+ os->pairs[i].id = j;
+ int valueRead = -1;
+ switch (o->type)
+ {
+ case CompOptionTypeBool:
+ valueRead = sscanf(valueStr, " %d ", &os->pairs[i].value.b);
+ break;
+ case CompOptionTypeInt:
+ valueRead = sscanf(valueStr, " %d ", &v.i);
+ if (valueRead > 0)
+ {
+ // Store option's original value
+ int backup = o->value.i;
+ if (compSetIntOption (o, &v))
+ os->pairs[i].value = v;
+ else
+ errorNo = 7;
+ // Restore value
+ o->value.i = backup;
+ }
+ break;
+ case CompOptionTypeFloat:
+ valueRead = sscanf(valueStr, " %f ", &v.f);
+ if (valueRead > 0)
+ {
+ // Store option's original value
+ float backup = o->value.f;
+ if (compSetFloatOption (o, &v))
+ os->pairs[i].value = v;
+ else
+ errorNo = 7;
+ // Restore value
+ o->value.f = backup;
+ }
+ break;
+ case CompOptionTypeString:
+ v.s = calloc (strlen(valueStr) + 1, 1); // TODO: not freed
+ if (!v.s)
+ {
+ compLogMessage (s->display, "animation", CompLogLevelError,
+ "Not enough memory");
+ return;
+ }
+ strcpy(v.s, valueStr);
+ valueRead = 1;
+ break;
+ case CompOptionTypeColor:
+ {
+ unsigned int c[4];
+ valueRead = sscanf (valueStr, " #%2x%2x%2x%2x ",
+ &c[0], &c[1], &c[2], &c[3]);
+ if (valueRead == 4)
+ {
+ CompOptionValue * pv = &os->pairs[i].value;
+ int j;
+ for (j = 0; j < 4; j++)
+ pv->c[j] = c[j] << 8 | c[j];
+ }
+ else
+ errorNo = 6;
+ break;
+ }
+ default:
+ break;
+ }
+ if (valueRead == 0)
+ errorNo = 6;
+ if (errorNo > 0)
+ break;
+ // If valueRead is -1 here, then it must be a
+ // non-(int/float/string) option, which is not supported yet.
+ // Such an option doesn't currently exist anyway.
+
+ errorNo = -1;
+ name = strtok(NULL, betweenOptVal);
+ }
+
+ if (i < nPairs)
+ {
+ switch (errorNo)
+ {
+ case -1:
+ case 2:
+ compLogMessage (s->display, "animation", CompLogLevelError,
+ "Option name missing in \"%s\"",
+ optNamesValuesOrig);
+ break;
+ case 1:
+ case 3:
+ compLogMessage (s->display, "animation", CompLogLevelError,
+ "Option value missing in \"%s\"",
+ optNamesValuesOrig);
+ break;
+ case 4:
+ compLogMessage (s->display, "animation", CompLogLevelError,
+ "Unknown option \"%s\" in \"%s\"",
+ nameTrimmed, optNamesValuesOrig);
+ break;
+ case 5:
+ compLogMessage (s->display, "animation", CompLogLevelError,
+ "Option \"%s\" cannot be changed like this.",
+ nameTrimmed);
+ break;
+ case 6:
+ compLogMessage (s->display, "animation", CompLogLevelError,
+ "Invalid value \"%s\" in \"%s\"",
+ valueStr, optNamesValuesOrig);
+ break;
+ case 7:
+ compLogMessage (s->display, "animation", CompLogLevelError,
+ "Value \"%s\" out of range in \"%s\"",
+ valueStr, optNamesValuesOrig);
+ break;
+ default:
+ break;
+ }
+ free(os->pairs);
+ os->pairs = 0;
+ os->nPairs = 0;
+ }
+ free(optNamesValues);
+}
+
+void
+updateOptionSets(CompScreen *s,
+ OptionSets *oss,
+ CompListValue *listVal)
+{
+ int n = listVal->nValue;
+
+ if (oss->sets)
+ freeSingleEventOptionSets(oss);
+
+ oss->sets = calloc(n, sizeof(OptionSet));
+ if (!oss->sets)
+ {
+ compLogMessage (s->display, "animation", CompLogLevelError,
+ "Not enough memory");
+ return;
+ }
+ oss->nSets = n;
+
+ int i;
+ for (i = 0; i < n; i++)
+ updateOptionSet(s, &oss->sets[i], listVal->value[i].s);
+}
Modified: fusion/plugins/animation/polygon.c
===================================================================
--- fusion/plugins/animation/polygon.c
+++ fusion/plugins/animation/polygon.c
@@ -221,9 +221,8 @@ tessellateIntoRectangles(CompWindow * w,
pset->polygons = calloc(pset->nPolygons, sizeof(PolygonObject));
if (!pset->polygons)
{
- compLogMessage (w->screen->display, "animation", CompLogLevelError,
- "%s: Not enough memory at line %d!",
- __FILE__, __LINE__);
+ compLogMessage (w->screen->display, "animation",
+ CompLogLevelError, "Not enough memory");
pset->nPolygons = 0;
return FALSE;
}
@@ -273,9 +272,8 @@ tessellateIntoRectangles(CompWindow * w,
//p->vertexTexCoords4Clips = calloc (1, sizeof (GLfloat) * 4 * 2 * 2);
if (!p->vertices) // || !p->vertexOnEdge)// || !p->vertexTexCoords4Clips)
{
- compLogMessage (w->screen->display, "animation", CompLogLevelError,
- "%s: Not enough memory at line %d!",
- __FILE__, __LINE__);
+ compLogMessage (w->screen->display, "animation",
+ CompLogLevelError, "Not enough memory");
freePolygonObjects(pset);
return FALSE;
}
@@ -323,9 +321,8 @@ tessellateIntoRectangles(CompWindow * w,
}
if (!p->sideIndices)
{
- compLogMessage (w->screen->display, "animation", CompLogLevelError,
- "%s: Not enough memory at line %d!",
- __FILE__, __LINE__);
+ compLogMessage (w->screen->display, "animation",
+ CompLogLevelError, "Not enough memory");
freePolygonObjects(pset);
return FALSE;
}
@@ -373,9 +370,9 @@ tessellateIntoRectangles(CompWindow * w,
}
if (!p->normals)
{
- compLogMessage (w->screen->display, "animation", CompLogLevelError,
- "%s: Not enough memory at line %d!",
- __FILE__, __LINE__);
+ compLogMessage (w->screen->display, "animation",
+ CompLogLevelError,
+ "Not enough memory");
freePolygonObjects(pset);
return FALSE;
}
@@ -494,8 +491,7 @@ tessellateIntoHexagons(CompWindow * w,
if (!pset->polygons)
{
compLogMessage (w->screen->display, "animation", CompLogLevelError,
- "%s: Not enough memory at line %d!",
- __FILE__, __LINE__);
+ "Not enough memory");
pset->nPolygons = 0;
return FALSE;
}
@@ -578,8 +574,7 @@ tessellateIntoHexagons(CompWindow * w,
if (!p->vertices)
{
compLogMessage (w->screen->display, "animation", CompLogLevelError,
- "%s: Not enough memory at line %d!",
- __FILE__, __LINE__);
+ "Not enough memory");
freePolygonObjects(pset);
return FALSE;
}
@@ -645,9 +640,8 @@ tessellateIntoHexagons(CompWindow * w,
}
if (!p->sideIndices)
{
- compLogMessage (w->screen->display, "animation", CompLogLevelError,
- "%s: Not enough memory at line %d!",
- __FILE__, __LINE__);
+ compLogMessage (w->screen->display, "animation",
+ CompLogLevelError, "Not enough memory");
freePolygonObjects(pset);
return FALSE;
}
@@ -693,9 +687,8 @@ tessellateIntoHexagons(CompWindow * w,
}
if (!p->normals)
{
- compLogMessage (w->screen->display, "animation", CompLogLevelError,
- "%s: Not enough memory at line %d!",
- __FILE__, __LINE__);
+ compLogMessage (w->screen->display, "animation",
+ CompLogLevelError, "Not enough memory");
freePolygonObjects(pset);
return FALSE;
}
@@ -811,9 +804,8 @@ polygonsStoreClips(CompScreen * s, CompWindow * w,
if (!ensureLargerClipCapacity(pset))
{
- compLogMessage (w->screen->display, "animation", CompLogLevelError,
- "%s: Not enough memory at line %d!",
- __FILE__, __LINE__);
+ compLogMessage (s->display, "animation", CompLogLevelError,
+ "Not enough memory");
return;
}
@@ -989,8 +981,7 @@ static Bool processIntersectingPolygons(CompScreen * s, PolygonSet * pset)
if (!c->intersectingPolygons || !c->polygonVertexTexCoords)
{
compLogMessage (s->display, "animation", CompLogLevelError,
- "%s: Not enough memory at line %d!",
- __FILE__, __LINE__);
+ "Not enough memory");
freeClipsPolygons(pset);
return FALSE;
}
Modified: fusion/plugins/animation/rollup.c
===================================================================
--- fusion/plugins/animation/rollup.c
+++ fusion/plugins/animation/rollup.c
@@ -43,12 +43,12 @@
#define ROLLUP_PERCEIVED_T 0.6f
void
-fxRollUpInitGrid(AnimScreen * as,
- WindowEvent forWindowEvent, int *gridWidth, int *gridHeight)
+fxRollUpInitGrid(AnimScreen * as, AnimWindow *aw,
+ int *gridWidth, int *gridHeight)
{
*gridWidth = 2;
- if (forWindowEvent == WindowEventShade ||
- forWindowEvent == WindowEventUnshade)
+ if (aw->curWindowEvent == WindowEventShade ||
+ aw->curWindowEvent == WindowEventUnshade)
*gridHeight = 4;
else
*gridHeight = 2;
@@ -134,13 +134,13 @@ Bool fxRollUpModelStep(CompScreen * s, CompWindow * w, float time)
int i;
for (i = 0; i < model->numObjects; i++)
- fxRollUpModelStepObject(w,
- model,
- &model->objects[i],
- forwardProgress,
- as->opt
- [ANIM_SCREEN_OPTION_ROLLUP_FIXED_INTERIOR].
- value.b);
+ fxRollUpModelStepObject
+ (w,
+ model,
+ &model->objects[i],
+ forwardProgress,
+ animGetB(as, aw,
+ ANIM_SCREEN_OPTION_ROLLUP_FIXED_INTERIOR));
modelCalcBounds(model);
return TRUE;
}
Modified: fusion/plugins/animation/wave.c
===================================================================
--- fusion/plugins/animation/wave.c
+++ fusion/plugins/animation/wave.c
@@ -84,9 +84,9 @@ Bool fxWaveModelStep(CompScreen * s, CompWindow * w, float time)
&model->objects[i],
forwardProgress,
WIN_H(w) * model->scale.y *
- as->opt[ANIM_SCREEN_OPTION_WAVE_AMP].value.f,
+ animGetF(as, aw, ANIM_SCREEN_OPTION_WAVE_AMP),
WIN_H(w) * model->scale.y *
- as->opt[ANIM_SCREEN_OPTION_WAVE_WIDTH].value.f /
+ animGetF(as, aw, ANIM_SCREEN_OPTION_WAVE_WIDTH) /
2);
modelCalcBounds(model);
return TRUE;
Modified: fusion/plugins/animation/zoomside.c
===================================================================
--- fusion/plugins/animation/zoomside.c
+++ fusion/plugins/animation/zoomside.c
@@ -50,7 +50,7 @@ void fxSidekickInit(CompScreen * s, CompWindow * w)
// determine number of rotations randomly in [0.75, 1.25] range
aw->numZoomRotations =
- as->opt[ANIM_SCREEN_OPTION_SIDEKICK_NUM_ROTATIONS].value.f *
+ animGetF(as, aw, ANIM_SCREEN_OPTION_SIDEKICK_NUM_ROTATIONS) *
(1.0f + 0.2f * rand() / RAND_MAX - 0.1f);
fxZoomInit(s, w);
@@ -60,9 +60,9 @@ static float
fxZoomGetSpringiness(AnimScreen *as, AnimWindow *aw)
{
if (aw->curAnimEffect == AnimEffectZoom)
- return 2 * as->opt[ANIM_SCREEN_OPTION_ZOOM_SPRINGINESS].value.f;
+ return 2 * animGetF(as, aw, ANIM_SCREEN_OPTION_ZOOM_SPRINGINESS);
else if (aw->curAnimEffect == AnimEffectSidekick)
- return 1.6 * as->opt[ANIM_SCREEN_OPTION_SIDEKICK_SPRINGINESS].value.f;
+ return 1.6 * animGetF(as, aw, ANIM_SCREEN_OPTION_SIDEKICK_SPRINGINESS);
else
return 0.0f;
}
@@ -73,26 +73,26 @@ void fxZoomInit(CompScreen * s, CompWindow * w)
ANIM_WINDOW(w);
if ((aw->curAnimEffect == AnimEffectSidekick &&
- (as->opt[ANIM_SCREEN_OPTION_SIDEKICK_ZOOM_FROM_CENTER].value.i ==
+ (animGetI(as, aw, ANIM_SCREEN_OPTION_SIDEKICK_ZOOM_FROM_CENTER) ==
ZoomFromCenterOn ||
((aw->curWindowEvent == WindowEventMinimize ||
aw->curWindowEvent == WindowEventUnminimize) &&
- as->opt[ANIM_SCREEN_OPTION_SIDEKICK_ZOOM_FROM_CENTER].value.i ==
+ animGetI(as, aw, ANIM_SCREEN_OPTION_SIDEKICK_ZOOM_FROM_CENTER) ==
ZoomFromCenterMin) ||
((aw->curWindowEvent == WindowEventOpen ||
aw->curWindowEvent == WindowEventClose) &&
- as->opt[ANIM_SCREEN_OPTION_SIDEKICK_ZOOM_FROM_CENTER].value.i ==
+ animGetI(as, aw, ANIM_SCREEN_OPTION_SIDEKICK_ZOOM_FROM_CENTER) ==
ZoomFromCenterCreate))) ||
(aw->curAnimEffect == AnimEffectZoom &&
- (as->opt[ANIM_SCREEN_OPTION_ZOOM_FROM_CENTER].value.i ==
+ (animGetI(as, aw, ANIM_SCREEN_OPTION_ZOOM_FROM_CENTER) ==
ZoomFromCenterOn ||
((aw->curWindowEvent == WindowEventMinimize ||
aw->curWindowEvent == WindowEventUnminimize) &&
- as->opt[ANIM_SCREEN_OPTION_ZOOM_FROM_CENTER].value.i ==
+ animGetI(as, aw, ANIM_SCREEN_OPTION_ZOOM_FROM_CENTER) ==
ZoomFromCenterMin) ||
((aw->curWindowEvent == WindowEventOpen ||
aw->curWindowEvent == WindowEventClose) &&
- as->opt[ANIM_SCREEN_OPTION_ZOOM_FROM_CENTER].value.i ==
+ animGetI(as, aw, ANIM_SCREEN_OPTION_ZOOM_FROM_CENTER) ==
ZoomFromCenterCreate))))
{
aw->icon.x =
More information about the commits
mailing list