summaryrefslogtreecommitdiff
path: root/src/hoverfx.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/hoverfx.cpp')
-rw-r--r--src/hoverfx.cpp51
1 files changed, 40 insertions, 11 deletions
diff --git a/src/hoverfx.cpp b/src/hoverfx.cpp
index 401aa6e..b8fbd95 100644
--- a/src/hoverfx.cpp
+++ b/src/hoverfx.cpp
@@ -66,10 +66,12 @@ HoverScreen::handleEvent (XEvent *event)
hw->mOld = hw->mCurrent;
hw->mTarget = 1.0f;
}
- else if (optionGetEffectType () == HoverfxOptions::EffectTypeLevels)
+ else if (optionGetEffectType () == HoverfxOptions::EffectTypeOpacity ||
+ optionGetEffectType () == HoverfxOptions::EffectTypeBrightness ||
+ optionGetEffectType () == HoverfxOptions::EffectTypeSaturation)
{
hw->mOld = hw->mCurrent;
- hw->mTarget = 0.0f;
+ hw->mTarget = 100.0f;
}
hw->mAnimate = true;
hw->toggleFunctions (true);
@@ -89,13 +91,27 @@ HoverScreen::handleEvent (XEvent *event)
hw->mAnimate = true;
if (optionGetEffectType () == HoverfxOptions::EffectTypeScale)
{
+ hw->mDefault = 1.0f;
hw->mOld = hw->mCurrent;
hw->mTarget = optionGetScaleFactor ();
}
- else if (optionGetEffectType () == HoverfxOptions::EffectTypeLevels)
+ else if (optionGetEffectType () == HoverfxOptions::EffectTypeOpacity)
{
+ hw->mDefault = 1.0f;
hw->mOld = hw->mCurrent;
- hw->mTarget = 1.0f;
+ hw->mTarget = optionGetOpacity ();
+ }
+ else if (optionGetEffectType () == HoverfxOptions::EffectTypeBrightness)
+ {
+ hw->mDefault = 1.0f;
+ hw->mOld = hw->mCurrent;
+ hw->mTarget = optionGetBrightness ();
+ }
+ else if (optionGetEffectType () == HoverfxOptions::EffectTypeSaturation)
+ {
+ hw->mDefault = 1.0f;
+ hw->mOld = hw->mCurrent;
+ hw->mTarget = optionGetSaturation ();
}
hw->mIsHovered = true;
mHoveredWindows.push_back (w);
@@ -120,10 +136,12 @@ HoverScreen::handleEvent (XEvent *event)
hw->mOld = hw->mCurrent;
hw->mTarget = 1.0f;
}
- else if (optionGetEffectType () == HoverfxOptions::EffectTypeLevels)
+ else if (optionGetEffectType () == HoverfxOptions::EffectTypeOpacity ||
+ optionGetEffectType () == HoverfxOptions::EffectTypeBrightness ||
+ optionGetEffectType () == HoverfxOptions::EffectTypeSaturation)
{
hw->mOld = hw->mCurrent;
- hw->mTarget = 1.0f;
+ hw->mTarget = 100.0f;
}
hw->toggleFunctions (true);
hw->mIsHovered = false;
@@ -166,7 +184,7 @@ HoverScreen::preparePaint (int ms)
hw->mAnimate = false;
hw->mCurrent = hw->mTarget;
}
- if (hw->mCurrent == 1.0f)
+ if (hw->mCurrent == hw->mDefault)
{
hw->mAnimate = false;
mHoveredWindows.remove (w);
@@ -220,13 +238,24 @@ HoverWindow::glPaint (const GLWindowPaintAttrib &attrib,
return gWindow->glPaint (attrib, wTransform, region, mask);
}
- else if (hs->optionGetEffectType () == HoverfxOptions::EffectTypeLevels)
+ else if (hs->optionGetEffectType () == HoverfxOptions::EffectTypeOpacity)
{
GLWindowPaintAttrib wAttrib (attrib);
+ wAttrib.opacity = (float) (mCurrent * OPAQUE) / 100;
- wAttrib.brightness -= mCurrent * ((float) (100 - hs->optionGetBrightness ()) / (float) 100) * BRIGHT;
- wAttrib.opacity -= mCurrent * ((float) (100 - hs->optionGetOpacity ()) / (float) 100) * OPAQUE;
- wAttrib.saturation -= mCurrent * ((float) (100 - hs->optionGetSaturation ()) / (float) 100) * COLOR;
+ return gWindow->glPaint (wAttrib, transform, region, mask);
+ }
+ else if (hs->optionGetEffectType () == HoverfxOptions::EffectTypeBrightness)
+ {
+ GLWindowPaintAttrib wAttrib (attrib);
+ wAttrib.brightness = (float) (mCurrent * BRIGHT) / 100;
+
+ return gWindow->glPaint (wAttrib, transform, region, mask);
+ }
+ else if (hs->optionGetEffectType () == HoverfxOptions::EffectTypeSaturation)
+ {
+ GLWindowPaintAttrib wAttrib (attrib);
+ wAttrib.saturation = (float) (mCurrent * COLOR) / 100;
return gWindow->glPaint (wAttrib, transform, region, mask);
}