Merge lp:~azzar1/unity/fix-1241757 into lp:unity

Proposed by Andrea Azzarone
Status: Merged
Approved by: Marco Trevisan (Treviño)
Approved revision: no longer in the source branch.
Merged at revision: 3897
Proposed branch: lp:~azzar1/unity/fix-1241757
Merge into: lp:unity
Diff against target: 74 lines (+14/-8)
2 files modified
unity-shared/BGHash.cpp (+12/-6)
unity-shared/BGHash.h (+2/-2)
To merge this branch: bzr merge lp:~azzar1/unity/fix-1241757
Reviewer Review Type Date Requested Status
Marco Trevisan (Treviño) Approve
PS Jenkins bot (community) continuous-integration Needs Fixing
Review via email: mp+244423@code.launchpad.net

Commit message

skipped the animation of BGHash on startup to prevent unwanted fade-in

To post a comment you must log in.
Revision history for this message
Andrea Azzarone (azzar1) wrote :

Skip the animation of BGHash on startup.

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :

FAILED: Continuous integration, rev:3894
No commit message was specified in the merge proposal. Click on the following link and set the commit message (if you want a jenkins rebuild you need to trigger it yourself):
https://code.launchpad.net/~andyrock/unity/fix-1241757/+merge/244423/+edit-commit-message

http://jenkins.qa.ubuntu.com/job/unity-ci/1121/
Executed test runs:
    FAILURE: http://jenkins.qa.ubuntu.com/job/unity-vivid-amd64-ci/8/console
    FAILURE: http://jenkins.qa.ubuntu.com/job/unity-vivid-armhf-ci/8/console
    FAILURE: http://jenkins.qa.ubuntu.com/job/unity-vivid-i386-ci/8/console

Click here to trigger a rebuild:
http://s-jenkins.ubuntu-ci:8080/job/unity-ci/1121/rebuild

review: Needs Fixing (continuous-integration)
Revision history for this message
Marco Trevisan (Treviño) (3v1n0) wrote :

Looks good.

You might also have used animation::Skip from AnimationUtils, but this is fine as well.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'unity-shared/BGHash.cpp'
2--- unity-shared/BGHash.cpp 2013-09-24 20:40:09 +0000
3+++ unity-shared/BGHash.cpp 2014-12-11 12:55:29 +0000
4@@ -44,7 +44,7 @@
5 COLORS_ATOM = gdk_x11_get_xatom_by_name("_GNOME_BACKGROUND_REPRESENTATIVE_COLORS");
6 transition_animator_.updated.connect(sigc::mem_fun(this, &BGHash::OnTransitionUpdated));
7 WindowManager::Default().average_color = unity::colors::Aubergine;
8- RefreshColor();
9+ RefreshColor(/* skip_animation */ true);
10 }
11
12 uint64_t BGHash::ColorAtomId() const
13@@ -58,11 +58,11 @@
14 RefreshColor();
15 }
16
17-void BGHash::RefreshColor()
18+void BGHash::RefreshColor(bool skip_animation)
19 {
20 if (override_color_.alpha > 0.0f)
21 {
22- TransitionToNewColor(override_color_);
23+ TransitionToNewColor(override_color_, skip_animation);
24 return;
25 }
26
27@@ -99,19 +99,25 @@
28 {
29 gdk_rgba_parse(&color_gdk, colors);
30 nux::Color new_color(color_gdk.red, color_gdk.green, color_gdk.blue, 1.0f);
31- TransitionToNewColor(MatchColor(new_color));
32+ TransitionToNewColor(MatchColor(new_color), skip_animation);
33 }
34
35 XFree(colors);
36 }
37
38-void BGHash::TransitionToNewColor(nux::color::Color const& new_color)
39+void BGHash::TransitionToNewColor(nux::color::Color const& new_color, bool skip_animation)
40 {
41 auto const& current_color = WindowManager::Default().average_color();
42 LOG_DEBUG(logger) << "transitioning from: " << current_color.red << " to " << new_color.red;
43
44 transition_animator_.Stop();
45- transition_animator_.SetStartValue(current_color).SetFinishValue(new_color).Start();
46+ transition_animator_.SetStartValue(current_color)
47+ .SetFinishValue(new_color)
48+ .SetDuration(skip_animation ? 0 : TRANSITION_DURATION)
49+ .Start();
50+
51+ // This will make sure that the animation starts even if the screen is idle.
52+ nux::GetWindowThread()->RequestRedraw();
53 }
54
55 void BGHash::OnTransitionUpdated(nux::Color const& new_color)
56
57=== modified file 'unity-shared/BGHash.h'
58--- unity-shared/BGHash.h 2013-09-24 20:14:21 +0000
59+++ unity-shared/BGHash.h 2014-12-11 12:55:29 +0000
60@@ -37,12 +37,12 @@
61
62 nux::Color CurrentColor() const;
63 uint64_t ColorAtomId() const;
64- void RefreshColor();
65+ void RefreshColor(bool skip_animation = false);
66 void OverrideColor(nux::Color const& color);
67
68 private:
69 void OnTransitionUpdated(nux::Color const& new_color);
70- void TransitionToNewColor(nux::Color const& new_color);
71+ void TransitionToNewColor(nux::Color const& new_color, bool skip_animation = false);
72 nux::Color MatchColor(nux::Color const& base_color) const;
73
74 private: