summaryrefslogtreecommitdiff
path: root/unity-shared
diff options
authorNick Dedekind <nicholas.dedekind@gmail.com>2012-12-17 21:30:27 +0000
committerTarmac <>2012-12-17 21:30:27 +0000
commit087508e85621dec96d232a92f8d0b0c8468d9ebf (patch)
tree92844ceb50b6f57f79362b3b9478387bde0201f6 /unity-shared
parent86b478542ca6c882483f3edc2a2670b5df2d8f24 (diff)
parentf229d269ea3574b9c68c679c01c872117b0b8ca2 (diff)
Improved dash animations. (LP: #1060948, #1060941, #1060937). Fixes: https://bugs.launchpad.net/bugs/1060937, https://bugs.launchpad.net/bugs/1060941, https://bugs.launchpad.net/bugs/1060948.
Approved by Brandon Schaefer. (bzr r2996)
Diffstat (limited to 'unity-shared')
-rw-r--r--unity-shared/CoverArt.cpp21
-rwxr-xr-xunity-shared/DashStyle.cpp15
-rwxr-xr-xunity-shared/DashStyle.h3
-rw-r--r--unity-shared/DashStyleInterface.h3
-rw-r--r--unity-shared/OverlayRenderer.cpp9
-rw-r--r--unity-shared/PlacesOverlayVScrollBar.cpp12
-rw-r--r--unity-shared/PlacesOverlayVScrollBar.h1
-rw-r--r--unity-shared/PreviewStyle.cpp6
-rw-r--r--unity-shared/PreviewStyle.h1
-rw-r--r--unity-shared/SearchBarSpinner.cpp18
-rw-r--r--unity-shared/UBusMessages.h2
11 files changed, 65 insertions, 26 deletions
diff --git a/unity-shared/CoverArt.cpp b/unity-shared/CoverArt.cpp
index b7e6986a1..97375a6c2 100644
--- a/unity-shared/CoverArt.cpp
+++ b/unity-shared/CoverArt.cpp
@@ -378,7 +378,7 @@ void CoverArt::DrawContent(nux::GraphicsEngine& gfx_engine, bool force_draw)
else if (IsFullRedraw())
{
if (waiting_)
- {
+ {
nux::TexCoordXForm texxform;
texxform.SetTexCoordType(nux::TexCoordXForm::OFFSET_COORD);
texxform.SetWrap(nux::TEXWRAP_REPEAT, nux::TEXWRAP_REPEAT);
@@ -395,11 +395,15 @@ void CoverArt::DrawContent(nux::GraphicsEngine& gfx_engine, bool force_draw)
int spin_offset_w = !(base.width % 2) ? 0 : 1;
int spin_offset_h = !(base.height % 2) ? 0 : 1;
- gfx_engine.PushModelViewMatrix(nux::Matrix4::TRANSLATE(-spin_geo.x - (spin_geo.width + spin_offset_w) / 2.0f,
- -spin_geo.y - (spin_geo.height + spin_offset_h) / 2.0f, 0));
- gfx_engine.PushModelViewMatrix(rotate_matrix_);
- gfx_engine.PushModelViewMatrix(nux::Matrix4::TRANSLATE(spin_geo.x + (spin_geo.width + spin_offset_w) / 2.0f,
- spin_geo.y + (spin_geo.height + spin_offset_h) / 2.0f, 0));
+ // we need to apply the rotation transformation first.
+ nux::Matrix4 matrix_texture;
+ matrix_texture = nux::Matrix4::TRANSLATE(-spin_geo.x - (spin_geo.width + spin_offset_w) / 2.0f,
+ -spin_geo.y - (spin_geo.height + spin_offset_h) / 2.0f, 0) * matrix_texture;
+ matrix_texture = rotate_matrix_ * matrix_texture;
+ matrix_texture = nux::Matrix4::TRANSLATE(spin_geo.x + (spin_geo.width + spin_offset_w) / 2.0f,
+ spin_geo.y + (spin_geo.height + spin_offset_h) / 2.0f, 0) * matrix_texture;
+
+ gfx_engine.SetModelViewMatrix(gfx_engine.GetModelViewMatrix() * matrix_texture);
gfx_engine.QRP_1Tex(spin_geo.x,
spin_geo.y,
@@ -409,9 +413,8 @@ void CoverArt::DrawContent(nux::GraphicsEngine& gfx_engine, bool force_draw)
texxform,
nux::color::White);
- gfx_engine.PopModelViewMatrix();
- gfx_engine.PopModelViewMatrix();
- gfx_engine.PopModelViewMatrix();
+ // revert to model view matrix stack
+ gfx_engine.ApplyModelViewMatrix();
if (!frame_timeout_)
{
diff --git a/unity-shared/DashStyle.cpp b/unity-shared/DashStyle.cpp
index 8dca2c037..8e3f040c8 100755
--- a/unity-shared/DashStyle.cpp
+++ b/unity-shared/DashStyle.cpp
@@ -2362,6 +2362,11 @@ int Style::GetScrollbarWidth() const
return 3;
}
+int Style::GetCategoryIconSize() const
+{
+ return 22;
+}
+
int Style::GetCategoryHighlightHeight() const
{
return 24;
@@ -2372,6 +2377,16 @@ int Style::GetPlacesGroupTopSpace() const
return 7;
}
+int Style::GetPlacesGroupResultTopPadding() const
+{
+ return 2;
+}
+
+int Style::GetPlacesGroupResultLeftPadding() const
+{
+ return 25;
+}
+
int Style::GetCategoryHeaderLeftPadding() const
{
return 19;
diff --git a/unity-shared/DashStyle.h b/unity-shared/DashStyle.h
index a1c6b93a8..53f70165d 100755
--- a/unity-shared/DashStyle.h
+++ b/unity-shared/DashStyle.h
@@ -243,8 +243,11 @@ public:
int GetScrollbarWidth() const;
// Places Group
+ int GetCategoryIconSize() const;
int GetCategoryHighlightHeight() const;
int GetPlacesGroupTopSpace() const;
+ int GetPlacesGroupResultTopPadding() const;
+ int GetPlacesGroupResultLeftPadding() const;
int GetCategoryHeaderLeftPadding() const;
int GetCategorySeparatorLeftPadding() const;
int GetCategorySeparatorRightPadding() const;
diff --git a/unity-shared/DashStyleInterface.h b/unity-shared/DashStyleInterface.h
index 43d488bc4..24e30f361 100644
--- a/unity-shared/DashStyleInterface.h
+++ b/unity-shared/DashStyleInterface.h
@@ -43,8 +43,11 @@ public:
virtual nux::BaseTexture* GetGroupUnexpandIcon() = 0;
virtual nux::BaseTexture* GetGroupExpandIcon() = 0;
+ virtual int GetCategoryIconSize() const = 0;
virtual int GetCategoryHeaderLeftPadding() const = 0;
virtual int GetPlacesGroupTopSpace() const = 0;
+ virtual int GetPlacesGroupResultTopPadding() const = 0;
+ virtual int GetPlacesGroupResultLeftPadding() const = 0;
};
}
diff --git a/unity-shared/OverlayRenderer.cpp b/unity-shared/OverlayRenderer.cpp
index 3c04864fa..ef8120c68 100644
--- a/unity-shared/OverlayRenderer.cpp
+++ b/unity-shared/OverlayRenderer.cpp
@@ -816,7 +816,7 @@ void OverlayRendererImpl::DrawContent(nux::GraphicsEngine& gfx_context, nux::Geo
int excess_border = (Settings::Instance().form_factor() != FormFactor::NETBOOK) ? EXCESS_BORDER : 0;
- nux::Geometry larger_content_geo = nux::Geometry(content_geo.x, content_geo.y, content_geo.width, content_geo.height);
+ nux::Geometry larger_content_geo = content_geo;
larger_content_geo.OffsetSize(excess_border, excess_border);
nux::Geometry larger_geo(larger_content_geo);
@@ -824,7 +824,6 @@ void OverlayRendererImpl::DrawContent(nux::GraphicsEngine& gfx_context, nux::Geo
nux::Geometry larger_absolute_geo = absolute_geo;
larger_absolute_geo.OffsetSize(excess_border, excess_border);
-
gfx_context.PushClippingRectangle(larger_geo);
unsigned int blend_alpha, blend_src, blend_dest = 0;
@@ -913,15 +912,13 @@ void OverlayRendererImpl::DrawContent(nux::GraphicsEngine& gfx_context, nux::Geo
}
}
+ gfx_context.GetRenderStates().SetBlend(blend_alpha, blend_src, blend_dest);
+ gfx_context.PopClippingRectangle();
}
void OverlayRendererImpl::DrawContentCleanup(nux::GraphicsEngine& gfx_context, nux::Geometry const& content_geo, nux::Geometry const& absolute_geo, nux::Geometry const& geometry)
{
nux::GetPainter().PopBackground(bgs);
-
- gfx_context.GetRenderStates().SetBlend(false);
- gfx_context.PopClippingRectangle();
-
bgs = 0;
}
diff --git a/unity-shared/PlacesOverlayVScrollBar.cpp b/unity-shared/PlacesOverlayVScrollBar.cpp
index 6943176e6..8ba19c988 100644
--- a/unity-shared/PlacesOverlayVScrollBar.cpp
+++ b/unity-shared/PlacesOverlayVScrollBar.cpp
@@ -56,6 +56,7 @@ PlacesOverlayVScrollBar::PlacesOverlayVScrollBar(NUX_FILE_LINE_DECL)
_track->geometry_changed.connect(sigc::mem_fun(this, &PlacesOverlayVScrollBar::OnTrackGeometryChanged));
OnVisibleChanged.connect(sigc::mem_fun(this, &PlacesOverlayVScrollBar::OnVisibilityChanged));
+ OnSensitiveChanged.connect(sigc::mem_fun(this, &PlacesOverlayVScrollBar::OnSensitivityChanged));
}
void PlacesOverlayVScrollBar::OnTrackGeometryChanged(nux::Area* /*area*/, nux::Geometry& /*geo*/)
@@ -79,6 +80,15 @@ void PlacesOverlayVScrollBar::OnVisibilityChanged(nux::Area* /*area*/, bool visi
}
}
+void PlacesOverlayVScrollBar::OnSensitivityChanged(nux::Area* /*area*/, bool sensitive)
+{
+ if (!sensitive)
+ {
+ overlay_window_->ResetStates();
+ ResetConnector();
+ }
+}
+
void PlacesOverlayVScrollBar::SetupAnimation(int start, int stop, int milliseconds)
{
tweening_connection_.disconnect();
@@ -152,7 +162,7 @@ void PlacesOverlayVScrollBar::OnMouseLeave(int x, int y, unsigned int button_fla
void PlacesOverlayVScrollBar::OnMouseNear(nux::Point const& mouse_pos)
{
- if (IsVisible() && IsScrollBarVisible())
+ if (IsSensitive() && IsVisible() && IsScrollBarVisible())
{
animation_.Stop();
diff --git a/unity-shared/PlacesOverlayVScrollBar.h b/unity-shared/PlacesOverlayVScrollBar.h
index 64945b944..dc8962608 100644
--- a/unity-shared/PlacesOverlayVScrollBar.h
+++ b/unity-shared/PlacesOverlayVScrollBar.h
@@ -50,6 +50,7 @@ private:
void OnTrackGeometryChanged(nux::Area* area, nux::Geometry& geo);
void OnVisibilityChanged(nux::Area* area, bool visible);
+ void OnSensitivityChanged(nux::Area* area, bool sensitive);
void OnMouseEnter(int x, int y, unsigned int button_flags, unsigned int key_flags);
void OnMouseLeave(int x, int y, unsigned int button_flags, unsigned int key_flags);
diff --git a/unity-shared/PreviewStyle.cpp b/unity-shared/PreviewStyle.cpp
index 314d6bdbb..7b332176f 100644
--- a/unity-shared/PreviewStyle.cpp
+++ b/unity-shared/PreviewStyle.cpp
@@ -171,6 +171,12 @@ int Style::GetPreviewHeight() const
return preview_height;
}
+
+int Style::GetPreviewTopPadding() const
+{
+ return 100;
+}
+
int Style::GetDetailsTopMargin() const
{
return 5;
diff --git a/unity-shared/PreviewStyle.h b/unity-shared/PreviewStyle.h
index fc823f36b..1a2eec4ac 100644
--- a/unity-shared/PreviewStyle.h
+++ b/unity-shared/PreviewStyle.h
@@ -62,6 +62,7 @@ public:
int GetPreviewWidth() const;
int GetPreviewHeight() const;
+ int GetPreviewTopPadding() const;
int GetDetailsTopMargin() const;
int GetDetailsBottomMargin() const;
diff --git a/unity-shared/SearchBarSpinner.cpp b/unity-shared/SearchBarSpinner.cpp
index 39b62b523..6e1dbaec2 100644
--- a/unity-shared/SearchBarSpinner.cpp
+++ b/unity-shared/SearchBarSpinner.cpp
@@ -88,11 +88,14 @@ SearchBarSpinner::Draw(nux::GraphicsEngine& GfxContext, bool force_draw)
int spin_offset_w = !(geo.width % 2) ? 0 : 1;
int spin_offset_h = !(geo.height % 2) ? 0 : 1;
- GfxContext.PushModelViewMatrix(nux::Matrix4::TRANSLATE(-spin_geo.x - (spin_geo.width + spin_offset_w) / 2.0f,
- -spin_geo.y - (spin_geo.height + spin_offset_h) / 2.0f, 0));
- GfxContext.PushModelViewMatrix(_2d_rotate);
- GfxContext.PushModelViewMatrix(nux::Matrix4::TRANSLATE(spin_geo.x + (spin_geo.width + spin_offset_w) / 2.0f,
- spin_geo.y + (spin_geo.height + spin_offset_h) / 2.0f, 0));
+ nux::Matrix4 matrix_texture;
+ matrix_texture = nux::Matrix4::TRANSLATE(-spin_geo.x - (spin_geo.width + spin_offset_w) / 2.0f,
+ -spin_geo.y - (spin_geo.height + spin_offset_h) / 2.0f, 0) * matrix_texture;
+ matrix_texture = _2d_rotate * matrix_texture;
+ matrix_texture = nux::Matrix4::TRANSLATE(spin_geo.x + (spin_geo.width + spin_offset_w) / 2.0f,
+ spin_geo.y + (spin_geo.height + spin_offset_h) / 2.0f, 0) * matrix_texture;
+
+ GfxContext.SetModelViewMatrix(GfxContext.GetModelViewMatrix() * matrix_texture);
GfxContext.QRP_1Tex(spin_geo.x,
spin_geo.y,
@@ -102,9 +105,8 @@ SearchBarSpinner::Draw(nux::GraphicsEngine& GfxContext, bool force_draw)
texxform,
nux::color::White);
- GfxContext.PopModelViewMatrix();
- GfxContext.PopModelViewMatrix();
- GfxContext.PopModelViewMatrix();
+ // revert to model view matrix stack
+ GfxContext.ApplyModelViewMatrix();
}
else
{
diff --git a/unity-shared/UBusMessages.h b/unity-shared/UBusMessages.h
index c2b2f502f..034e710ad 100644
--- a/unity-shared/UBusMessages.h
+++ b/unity-shared/UBusMessages.h
@@ -40,8 +40,6 @@
#define UBUS_OVERLAY_HIDDEN "OVERLAY_HIDDEN"
#define UBUS_OVERLAY_SHOWN "OVERLAY_SHOWN"
-#define UBUS_PLACE_VIEW_QUEUE_DRAW "PLACE_VIEW_QUEUE_DRAW"
-
// Signal send by Launcher/Quicklist when it wants to exit key-nav and wants to
// get rid of keyboard-input-focus
#define UBUS_LAUNCHER_START_KEY_NAV "LAUNCHER_START_KEY_NAV"