Merge lp:~bregma/unity/lp-1241757-trusty into lp:unity/7.2

Proposed by Stephen M. Webb
Status: Merged
Approved by: Christopher Townsend
Approved revision: no longer in the source branch.
Merged at revision: 3815
Proposed branch: lp:~bregma/unity/lp-1241757-trusty
Merge into: lp:unity/7.2
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:~bregma/unity/lp-1241757-trusty
Reviewer Review Type Date Requested Status
Christopher Townsend Approve
Review via email: mp+252659@code.launchpad.net

Commit message

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

Description of the change

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

Cherry-picked from Unity trunk.

To post a comment you must log in.
Revision history for this message
Christopher Townsend (townsend) wrote :

+1

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 2015-03-11 21:00:11 +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 2015-03-11 21:00:11 +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:

Subscribers

People subscribed via source and target branches

to all changes:
to status/vote changes: