diff --git a/debian/unity-lowgfx.ini b/debian/unity-lowgfx.ini index 88570689d6908a1c8dd1594045e566376051af88..b0ed77fe30c37f7f19c2e6394b4e344f2612d140 100644 --- a/debian/unity-lowgfx.ini +++ b/debian/unity-lowgfx.ini @@ -12,8 +12,8 @@ s0_fade_mode = 1 s0_fade_time = 1 [grid] -s0_animation_duration = 1 -s0_disable_blend = true +s0_animation_duration = 0 +s0_draw_stretched_window = false [resize] s0_mode = 2 diff --git a/plugins/grid/src/grid.cpp b/plugins/grid/src/grid.cpp index c1cb7e03625fdeb47ea4eded92413e97aa7e0840..1532b26224c6e66b602c2538bed2d8051511a772 100755 --- a/plugins/grid/src/grid.cpp +++ b/plugins/grid/src/grid.cpp @@ -532,7 +532,7 @@ GridScreen::glPaintRectangle (const GLScreenPaintAttrib &sAttrib, Animation& anim = *iter; float curve = powf (CURVE_ANIMATION, -anim.progress); - float alpha = (optionGetFillColorAlpha () / MaxUShortFloat) * anim.opacity; + float alpha = blend ? (optionGetFillColorAlpha () / MaxUShortFloat) * anim.opacity : 0.85; color = optionGetFillColor (); colorData[0] = alpha * color[0]; @@ -570,7 +570,7 @@ GridScreen::glPaintRectangle (const GLScreenPaintAttrib &sAttrib, anim.currentRect.height () - 2); /* draw outline */ - alpha = (optionGetOutlineColorAlpha () / MaxUShortFloat) * anim.opacity; + alpha = blend ? (optionGetOutlineColorAlpha () / MaxUShortFloat) * anim.opacity : 1; color = optionGetOutlineColor (); colorData[0] = alpha * color[0]; @@ -603,7 +603,7 @@ GridScreen::glPaintRectangle (const GLScreenPaintAttrib &sAttrib, if (!animating) { /* draw filled rectangle */ - float alpha = optionGetFillColorAlpha () / MaxUShortFloat; + float alpha = blend ? optionGetFillColorAlpha () / MaxUShortFloat : 0.85; color = optionGetFillColor (); colorData[0] = alpha * color[0]; @@ -885,7 +885,7 @@ GridScreen::handleEvent (XEvent *event) animations.at (current).fromRect = w->serverBorderRect (); animations.at (current).currentRect = w->serverBorderRect (); animations.at (current).duration = optionGetAnimationDuration (); - animations.at (current).timer = animations.at (current).duration; + animations.at (current).progress = 0.0f; animations.at (current).targetRect = desiredSlot; animations.at (current).window = w->id(); @@ -1199,18 +1199,24 @@ GridScreen::preparePaint (int msSinceLastPaint) for (iter = animations.begin (); iter != animations.end (); ++iter) { Animation& anim = *iter; - anim.timer -= msSinceLastPaint; + GLfloat msSinceLastPaintFloat = static_cast(msSinceLastPaint); + GLfloat animDurationFloat = static_cast(anim.duration); + GLfloat progress_delta = 1.0f; - if (anim.timer < 0) - anim.timer = 0; + if (animDurationFloat > 0.0f) + progress_delta = msSinceLastPaintFloat / animDurationFloat; if (anim.fadingOut) - anim.opacity -= msSinceLastPaint * 0.002; + { + anim.opacity -= progress_delta; + } else + { if (anim.opacity < 1.0f) anim.opacity = anim.progress * anim.progress; else anim.opacity = 1.0f; + } if (anim.opacity < 0) { @@ -1219,10 +1225,10 @@ GridScreen::preparePaint (int msSinceLastPaint) anim.complete = true; } - anim.progress = (anim.duration - anim.timer) / anim.duration; + anim.progress = std::min(anim.progress + progress_delta, 1.0); } - if (optionGetDrawStretchedWindow ()) + if (optionGetDrawStretchedWindow () && !optionGetDisableBlend ()) { CompWindow *cw = screen->findWindow (CompOption::getIntOptionNamed (o, "window")); @@ -1292,7 +1298,6 @@ Animation::Animation () targetRect = CompRect (0, 0, 0, 0); currentRect = CompRect (0, 0, 0, 0); opacity = 0.0f; - timer = 0.0f; duration = 0; complete = false; fadingOut = false; @@ -1400,7 +1405,7 @@ GridWindow::glPaint (const GLWindowPaintAttrib& attrib, const GLMatrix& matrix, { Animation& anim = *iter; - if (anim.timer > 0.0f && anim.window == window->id()) + if (anim.progress < 1.0f && anim.window == window->id()) { GLWindowPaintAttrib wAttrib(attrib); GLMatrix wTransform (matrix); diff --git a/plugins/grid/src/grid.h b/plugins/grid/src/grid.h index 8390f4c39a263871fc0d84e9b7ed8bece1008e96..40b18017f483968a21f732e9b5543a3456ec728c 100644 --- a/plugins/grid/src/grid.h +++ b/plugins/grid/src/grid.h @@ -96,7 +96,6 @@ class Animation CompRect targetRect; CompRect currentRect; GLfloat opacity; - GLfloat timer; Window window; int duration; bool complete;