summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorErkin Bahceci <erkinbah@gmail.com>2009-10-13 05:40:42 -0500
committerErkin Bahceci <erkinbah@gmail.com>2009-10-13 05:40:42 -0500
commitc1e0fa6c0757bad5a3626fa7ae4dc666214926d3 (patch)
treee9ab7cdeff965f521607d1b9b8d9f16e9ea27cd6
parent668b6f7bb9974db9a01460990f2759e4a9746d70 (diff)
downloadelements-compiz-0.8.tar.gz
elements-compiz-0.8.tar.bz2
Fix element rotate option handling.compiz-0.8
-rw-r--r--compiz-elements.h5
-rw-r--r--elements.c32
2 files changed, 27 insertions, 10 deletions
diff --git a/compiz-elements.h b/compiz-elements.h
index 885e1a0..1d72df6 100644
--- a/compiz-elements.h
+++ b/compiz-elements.h
@@ -104,6 +104,8 @@ struct _ElementAnimation
int speed;
int id; /* Uniquely idenitifies this animation */
+ Bool rotate;
+
Bool active;
ElementTexture *texture;
@@ -118,7 +120,8 @@ struct _ElementAnimation
/* Resets an animation to defaults */
void initiateElement (CompScreen *s,
ElementAnimation *anim,
- Element *ele);
+ Element *ele,
+ Bool rotate);
/* Calls the movement function pointer for an element in an element animation */
void elementMove (CompScreen *s,
diff --git a/elements.c b/elements.c
index f8e78d5..4105301 100644
--- a/elements.c
+++ b/elements.c
@@ -96,7 +96,7 @@ elementTestCreate (CompScreen *s,
{
if (anim->properties->fini)
(*anim->properties->fini) (s, ele);
- initiateElement(s, anim, ele);
+ initiateElement(s, anim, ele, FALSE);
}
}
@@ -658,7 +658,8 @@ createElementAnimation (CompScreen *s,
char *type,
int size,
int speed,
- int iter)
+ int iter,
+ Bool rotate)
{
ElementAnimation *anim = elementsCreateAnimation (s, type);
CompListValue *paths, *iters;
@@ -673,6 +674,7 @@ createElementAnimation (CompScreen *s,
anim->size = size;
anim->speed = speed;
anim->id = iter;
+ anim->rotate = rotate;
anim->type = strdup (type);
anim->nTextures = 0;
@@ -688,7 +690,7 @@ createElementAnimation (CompScreen *s,
e = anim->elements;
while (nElement--)
{
- initiateElement (s, anim, e);
+ initiateElement (s, anim, e, rotate);
e++;
}
anim->active = TRUE;
@@ -1092,6 +1094,7 @@ elementsToggleSelected (CompDisplay *d,
CompListValue *cCap = elementsGetElementCap (s);
CompListValue *cSize = elementsGetElementSize (s);
CompListValue *cSpeed = elementsGetElementSpeed (s);
+ CompListValue *cRot = elementsGetElementRotate(s);
ElementAnimation *anim;
ELEMENTS_DISPLAY (d);
@@ -1101,7 +1104,8 @@ elementsToggleSelected (CompDisplay *d,
(cPath->nValue == cIter->nValue) &&
(cCap->nValue == cIter->nValue) &&
(cSize->nValue == cIter->nValue) &&
- (cSpeed->nValue == cIter->nValue)))
+ (cSpeed->nValue == cIter->nValue) &&
+ (cRot->nValue == cIter->nValue)))
{
compLogMessage ("elements", CompLogLevelWarn,
"Options are not set correctly,"
@@ -1135,7 +1139,8 @@ elementsToggleSelected (CompDisplay *d,
cType->value[es->listIter].s,
cSize->value[es->listIter].i,
cSpeed->value[es->listIter].i,
- es->animIter);
+ es->animIter,
+ cRot->value[es->listIter].b);
}
if (ed->textFunc && elementsGetTitleOnToggle (s) && success)
@@ -1317,14 +1322,15 @@ elementsDrawWindow (CompWindow *w,
void
initiateElement (CompScreen *s,
ElementAnimation *anim,
- Element *e)
+ Element *e,
+ Bool rotate)
{
e->x = 0;
e->y = 0;
e->z = elementsMmRand (-elementsGetScreenDepth (s), 0.1, 5000);
e->dz = elementsMmRand (-500, 500, 500000);
e->rAngle = elementsMmRand (-1000, 1000, 50);
- e->rSpeed = elementsMmRand (-2100, 2100, 700);
+ e->rSpeed = rotate ? elementsMmRand (-2100, 2100, 700) : 0;
e->opacity = 1.0f;
e->nTexture = 0;
@@ -1412,6 +1418,7 @@ updateElementTextures (CompScreen *s,
for (anim = es->animations; anim; anim = anim->next)
{
int i, iter, nElement, size,speed;
+ Bool rotate;
char *type;
CompListValue *cType = elementsGetElementType (s);
CompListValue *cPath = elementsGetElementImage (s);
@@ -1419,6 +1426,7 @@ updateElementTextures (CompScreen *s,
CompListValue *cSize = elementsGetElementSize (s);
CompListValue *cSpeed = elementsGetElementSpeed (s);
CompListValue *cIter = elementsGetElementIter (s);
+ CompListValue *cRot = elementsGetElementRotate(s);
Element *e;
Bool initiate = FALSE;
@@ -1426,7 +1434,8 @@ updateElementTextures (CompScreen *s,
(cPath->nValue == cIter->nValue) &&
(cCap->nValue == cIter->nValue) &&
(cSize->nValue == cIter->nValue) &&
- (cSpeed->nValue == cIter->nValue)))
+ (cSpeed->nValue == cIter->nValue) &&
+ (cRot->nValue == cIter->nValue)))
{
compLogMessage ("elements", CompLogLevelWarn,
"Options are not set correctly,"
@@ -1439,6 +1448,7 @@ updateElementTextures (CompScreen *s,
type = cType->value[anim->id - 1].s;
size = cSize->value[anim->id - 1].i;
speed = cSpeed->value[anim->id - 1].i;
+ rotate = cRot->value[anim->id - 1].b;
for (i = 0; i < anim->nTextures; i++)
{
@@ -1490,13 +1500,17 @@ updateElementTextures (CompScreen *s,
initiate = TRUE;
}
+ if (anim->rotate != rotate)
+ initiate = TRUE;
+
+ anim->rotate = rotate;
anim->size = size;
anim->speed = speed;
e = anim->elements;
if (initiate)
for (; nElement--; e++)
- initiateElement (s, anim, e);
+ initiateElement (s, anim, e, rotate);
}
}
}