diff options
| author | Andrea Azzarone <azzaronea@gmail.com> | 2014-12-11 13:54:37 +0100 |
|---|---|---|
| committer | Andrea Azzarone <azzaronea@gmail.com> | 2014-12-11 13:54:37 +0100 |
| commit | 50feffe79668b8fcfae7d6f9a779eb8212bad15d (patch) | |
| tree | bd61177274c9ff98a42779c246939e8ff2e4473a /unity-shared | |
| parent | 41b61acafe6f593806e48142191ad281275f7270 (diff) | |
Skip the animation of BGHash on startup.
Fixes LP: #1398287 (bzr r3893.2.1)
Diffstat (limited to 'unity-shared')
| -rw-r--r-- | unity-shared/BGHash.cpp | 18 | ||||
| -rw-r--r-- | unity-shared/BGHash.h | 4 |
2 files changed, 14 insertions, 8 deletions
diff --git a/unity-shared/BGHash.cpp b/unity-shared/BGHash.cpp index 4c593aa9f..c2f065383 100644 --- a/unity-shared/BGHash.cpp +++ b/unity-shared/BGHash.cpp @@ -44,7 +44,7 @@ BGHash::BGHash() COLORS_ATOM = gdk_x11_get_xatom_by_name("_GNOME_BACKGROUND_REPRESENTATIVE_COLORS"); transition_animator_.updated.connect(sigc::mem_fun(this, &BGHash::OnTransitionUpdated)); WindowManager::Default().average_color = unity::colors::Aubergine; - RefreshColor(); + RefreshColor(/* skip_animation */ true); } uint64_t BGHash::ColorAtomId() const @@ -58,11 +58,11 @@ void BGHash::OverrideColor(nux::Color const& color) RefreshColor(); } -void BGHash::RefreshColor() +void BGHash::RefreshColor(bool skip_animation) { if (override_color_.alpha > 0.0f) { - TransitionToNewColor(override_color_); + TransitionToNewColor(override_color_, skip_animation); return; } @@ -99,19 +99,25 @@ void BGHash::RefreshColor() { gdk_rgba_parse(&color_gdk, colors); nux::Color new_color(color_gdk.red, color_gdk.green, color_gdk.blue, 1.0f); - TransitionToNewColor(MatchColor(new_color)); + TransitionToNewColor(MatchColor(new_color), skip_animation); } XFree(colors); } -void BGHash::TransitionToNewColor(nux::color::Color const& new_color) +void BGHash::TransitionToNewColor(nux::color::Color const& new_color, bool skip_animation) { auto const& current_color = WindowManager::Default().average_color(); LOG_DEBUG(logger) << "transitioning from: " << current_color.red << " to " << new_color.red; transition_animator_.Stop(); - transition_animator_.SetStartValue(current_color).SetFinishValue(new_color).Start(); + transition_animator_.SetStartValue(current_color) + .SetFinishValue(new_color) + .SetDuration(skip_animation ? 0 : TRANSITION_DURATION) + .Start(); + + // This will make sure that the animation starts even if the screen is idle. + nux::GetWindowThread()->RequestRedraw(); } void BGHash::OnTransitionUpdated(nux::Color const& new_color) diff --git a/unity-shared/BGHash.h b/unity-shared/BGHash.h index af0afe571..680f53afe 100644 --- a/unity-shared/BGHash.h +++ b/unity-shared/BGHash.h @@ -37,12 +37,12 @@ namespace unity nux::Color CurrentColor() const; uint64_t ColorAtomId() const; - void RefreshColor(); + void RefreshColor(bool skip_animation = false); void OverrideColor(nux::Color const& color); private: void OnTransitionUpdated(nux::Color const& new_color); - void TransitionToNewColor(nux::Color const& new_color); + void TransitionToNewColor(nux::Color const& new_color, bool skip_animation = false); nux::Color MatchColor(nux::Color const& base_color) const; private: |
