summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSam Spilsbury <smspillaz@gmail.com>2010-08-30 23:12:26 +0800
committerSam Spilsbury <smspillaz@gmail.com>2010-08-30 23:12:26 +0800
commitb02b3dd135dedb140a2aff8620dd6021904894b6 (patch)
treebec4935f6f782edeeaa4028020085eef4715d1e3
parent45e77d888f8a326dcbed76438f4a90a8c048c123 (diff)
downloaddialog-b02b3dd135dedb140a2aff8620dd6021904894b6.tar.gz
dialog-b02b3dd135dedb140a2aff8620dd6021904894b6.tar.bz2
Drop animation code, use fade plguin
-rw-r--r--dialog.xml.in1
-rw-r--r--src/dialog.cpp70
-rw-r--r--src/dialog.h8
3 files changed, 8 insertions, 71 deletions
diff --git a/dialog.xml.in b/dialog.xml.in
index f7fd44c..65a764d 100644
--- a/dialog.xml.in
+++ b/dialog.xml.in
@@ -9,6 +9,7 @@
<plugin>composite</plugin>
<plugin>opengl</plugin>
<plugin>decor</plugin>
+ <plugin>fade</plugin>
</relation>
<requirement>
<plugin>regex</plugin>
diff --git a/src/dialog.cpp b/src/dialog.cpp
index 0bf88f3..116a088 100644
--- a/src/dialog.cpp
+++ b/src/dialog.cpp
@@ -28,15 +28,13 @@ DialogWindow::glPaint (const GLWindowPaintAttrib &attrib,
const CompRegion &region,
unsigned int mask)
{
- if (mFaded || mAnimate)
+ if (mFaded)
{
+ DIALOG_SCREEN (screen);
GLWindowPaintAttrib wAttrib (attrib);
- wAttrib.opacity *= (mOpacity / 100);
- wAttrib.saturation *= (mSaturation / 100);
- wAttrib.brightness *= (mBrightness / 100);
-
- if (mAnimate)
- cWindow->addDamage ();
+ wAttrib.opacity *= (ds->optionGetOpacity () / 100);
+ wAttrib.saturation *= (ds->optionGetSaturation () / 100);
+ wAttrib.brightness *= (ds->optionGetBrightness () / 100);
return gWindow->glPaint (wAttrib, transform, region, mask);
}
@@ -47,47 +45,6 @@ DialogWindow::glPaint (const GLWindowPaintAttrib &attrib,
void
DialogScreen::preparePaint (int ms)
{
- float topacity = optionGetOpacity ();
- float tsat = optionGetSaturation ();
- float tbright = optionGetBrightness ();
- foreach (CompWindow *w, screen->windows ())
- {
- DIALOG_WINDOW(w);
- if (dw->mAnimate != ANIMATE_NONE)
- {
- if (dw->mAnimate == ANIMATE_DOWN)
- {
- dw->mOpacity = fmax(dw->mOpacity - (dw->mOpacity - topacity) * ms * SPEED,topacity);
- dw->mSaturation = fmax(dw->mSaturation - (dw->mSaturation - tsat) * ms * SPEED,tsat );
- dw->mBrightness = fmax(dw->mBrightness - (dw->mBrightness - tbright) * ms * SPEED,tbright );
- if (dw->mOpacity <= topacity + 1 &&
- dw->mSaturation <= tsat + 1 &&
- dw->mBrightness <= tbright + 1)
- dw->mAnimate = ANIMATE_NONE;
- }
- else if (dw->mFaded == TRUE)
- {
- dw->mOpacity = fmin(dw->mOpacity + (topacity - dw->mOpacity ) * ms * SPEED,topacity);
- dw->mSaturation = fmin(dw->mSaturation + (tsat - dw->mSaturation) * ms * SPEED,tsat );
- dw->mBrightness = fmin(dw->mBrightness + (tbright - dw->mBrightness) * ms * SPEED,tbright );
- if (dw->mOpacity >= topacity - 1 &&
- dw->mSaturation >= tsat - 1 &&
- dw->mBrightness >= tbright - 1)
- dw->mAnimate = ANIMATE_NONE;
- }
- else
- {
- dw->mOpacity = fmin(dw->mOpacity + (100 - dw->mOpacity ) * ms * SPEED,100);
- dw->mSaturation = fmin(dw->mSaturation + (100 - dw->mSaturation) * ms * SPEED,100);
- dw->mBrightness = fmin(dw->mBrightness + (100 - dw->mBrightness) * ms * SPEED,100);
- if (dw->mOpacity >= 99 &&
- dw->mSaturation >= 99 &&
- dw->mBrightness >= 99)
- dw->mAnimate = ANIMATE_NONE;
- }
- }
- }
-
cScreen->preparePaint (ms);
}
@@ -115,7 +72,6 @@ DialogScreen::handleEvent (XEvent *event)
if (!othertrans)
{
dww->mFaded = FALSE;
- dww->mAnimate = ANIMATE_UP;
CompositeWindow::get (ww)->addDamage ();
}
}
@@ -132,7 +88,6 @@ DialogScreen::handleEvent (XEvent *event)
if (!dww->mFaded)
{
dww->mFaded = TRUE;
- dww->mAnimate = ANIMATE_DOWN;
dww->cWindow->addDamage ();
}
}
@@ -148,16 +103,7 @@ DialogScreen::optionChanged (CompOption *option,
foreach (CompWindow *w, screen->windows ())
{
DIALOG_WINDOW (w);
-
- if (dw->mFaded && (optionGetOpacity () > dw->mOpacity ||
- optionGetSaturation () > dw->mSaturation ||
- optionGetBrightness () > dw->mBrightness ))
- dw->mAnimate = ANIMATE_UP;
- else if (dw->mFaded && (optionGetOpacity () < dw->mOpacity ||
- optionGetSaturation () < dw->mSaturation ||
- optionGetBrightness () < dw->mBrightness ))
- dw->mAnimate = ANIMATE_DOWN;
- dw->cWindow->addDamage ();
+ dw->cWindow->addDamage ();
}
}
@@ -179,11 +125,7 @@ DialogWindow::DialogWindow (CompWindow *w) :
window (w),
cWindow (CompositeWindow::get (w)),
gWindow (GLWindow::get (w)),
- mAnimate (0),
mFaded (false),
- mOpacity (OPAQUE),
- mBrightness (BRIGHT),
- mSaturation (COLOR),
mOldTransient (None)
{
GLWindowInterface::setHandler (gWindow);
diff --git a/src/dialog.h b/src/dialog.h
index 592888a..7709867 100644
--- a/src/dialog.h
+++ b/src/dialog.h
@@ -66,12 +66,7 @@ class DialogWindow :
CompWindow *window;
CompositeWindow *cWindow;
GLWindow *gWindow;
-
- int mAnimate;
bool mFaded;
- float mOpacity;
- float mBrightness;
- float mSaturation;
Window mOldTransient;
@@ -93,8 +88,7 @@ class DialogWindow :
#define WIN_W(w) ((w)->width () + (w)->input ().left + (w)->input ().right)
#define WIN_H(w) ((w)->height () + (w)->input ().top + (w)->input ().bottom)
-#define SPEED (optionGetSpeed() * 0.0005f)
-#define SPEED_W (fws->optionGetSpeed () * 0.000f)
+#define SPEED (optionGetSpeed () * 0.0005f)
class DialogPluginVTable :
public CompPlugin::VTableForScreenAndWindow <DialogScreen, DialogWindow>