summaryrefslogtreecommitdiff
diff options
authorMarco Trevisan (Treviño) <mail@3v1n0.net>2012-11-14 03:21:36 +0100
committerMarco Trevisan (Treviño) <mail@3v1n0.net>2012-11-14 03:21:36 +0100
commit15205f0079d36eeeba511d715255d885699cec20 (patch)
tree49ba7656e860c504c7b557187c574aad8b8a43a4
parentc35f84ab9310452113ffec033e1b9cfefad273c8 (diff)
SwitcherView: make the switcher windows thumbnail to grow with the switcher when animating
(bzr r2846.1.44)
-rw-r--r--launcher/SwitcherView.cpp16
-rw-r--r--plugins/unityshell/src/unityshell.cpp4
2 files changed, 18 insertions, 2 deletions
diff --git a/launcher/SwitcherView.cpp b/launcher/SwitcherView.cpp
index f76de94c4..3632a1414 100644
--- a/launcher/SwitcherView.cpp
+++ b/launcher/SwitcherView.cpp
@@ -219,9 +219,9 @@ nux::Geometry SwitcherView::InterpolateBackground (nux::Geometry const& start, n
return result;
}
-nux::Geometry SwitcherView::UpdateRenderTargets (nux::Point const& center, timespec const& current)
+nux::Geometry SwitcherView::UpdateRenderTargets(nux::Point const& center, timespec const& current)
{
- std::vector<Window> xids = model_->DetailXids ();
+ std::vector<Window> const& xids = model_->DetailXids();
int ms_since_change = TimeUtil::TimeDelta(&current, &save_time_);
float progress = std::min<float>(1.0f, ms_since_change / static_cast<float>(animation_length()));
@@ -247,6 +247,18 @@ nux::Geometry SwitcherView::UpdateRenderTargets (nux::Point const& center, times
nux::Geometry final_bounds;
layout_system_.LayoutWindows(render_targets_, max_bounds, final_bounds);
+ if (progress < 1.0f)
+ {
+ // Animate the windows thumbnail sizes to make them grow with the switcher
+ for (LayoutWindow::Ptr const& win : render_targets_)
+ {
+ auto old_geo = win->result;
+ win->result = old_geo * progress;
+ win->result.x += (old_geo.width - win->result.width) / 4;
+ win->result.y += (old_geo.height - win->result.height) / 4;
+ }
+ }
+
return final_bounds;
}
diff --git a/plugins/unityshell/src/unityshell.cpp b/plugins/unityshell/src/unityshell.cpp
index 8bd519a7e..f572f4e4f 100644
--- a/plugins/unityshell/src/unityshell.cpp
+++ b/plugins/unityshell/src/unityshell.cpp
@@ -3975,6 +3975,10 @@ void UnityWindow::paintThumbnail(nux::Geometry const& geo, float alpha, float sc
mask |= PAINT_WINDOW_BLEND_MASK;
attrib.opacity = OPAQUE;
+ // The thumbnail is still animating, don't draw the decoration as selected
+ if (selected && alpha < 1.0f)
+ selected = false;
+
paintFakeDecoration(geo, attrib, matrix, mask, selected, scale_ratio);
}