diff options
| author | Marco Trevisan (Treviño) <mail@3v1n0.net> | 2017-07-17 13:08:57 +0200 | 
|---|---|---|
| committer | Marco Trevisan (Treviño) <mail@3v1n0.net> | 2017-07-17 13:08:57 +0200 | 
| commit | e37aa12080db798e725accada4c69933d2cbc610 (patch) | |
| tree | 867eb3c41673d0456e657012a8ba1551ea8123d9 | |
| parent | bbac6998b230abb0b003f283cb8580c49123b8bc (diff) | |
Launcher: define animation durations just once
(bzr r4245.3.1)
| -rw-r--r-- | launcher/Launcher.cpp | 35 | ||||
| -rw-r--r-- | launcher/Launcher.h | 1 | 
2 files changed, 19 insertions, 17 deletions
| diff --git a/launcher/Launcher.cpp b/launcher/Launcher.cpp index 144fff6e6..139f9590a 100644 --- a/launcher/Launcher.cpp +++ b/launcher/Launcher.cpp @@ -138,13 +138,6 @@ Launcher::Launcher(MockableBaseWindow* parent,  , drag_action_(nux::DNDACTION_NONE)  , bg_effect_helper_(this)  , launcher_position_(unity::Settings::Instance().launcher_position()) - , auto_hide_animation_(Settings::Instance().low_gfx ? 0 : ANIM_DURATION_SHORT) - , hover_animation_(Settings::Instance().low_gfx ? ANIM_DURATION_SHORT_SHORT : ANIM_DURATION) - , drag_over_animation_(Settings::Instance().low_gfx ? 0 : ANIM_DURATION_LONG) - , drag_out_animation_(Settings::Instance().low_gfx ? 0 : ANIM_DURATION_SHORT) - , drag_icon_animation_(Settings::Instance().low_gfx ? 0 : ANIM_DURATION_SHORT) - , dnd_hide_animation_(Settings::Instance().low_gfx ? 0 : ANIM_DURATION * 3) - , dash_showing_animation_(Settings::Instance().low_gfx ? 0 : ANIM_DURATION_DASH_SHOWING)  , cv_(Settings::Instance().em(monitor))  {  icon_renderer_->monitor = monitor(); @@ -198,18 +191,11 @@ Launcher::Launcher(MockableBaseWindow* parent,  QueueDraw();  }); +//FIXME, move to single function  Settings::Instance().dpi_changed.connect(sigc::mem_fun(this, &Launcher::OnDPIChanged)); - Settings::Instance().low_gfx.changed.connect(sigc::track_obj([this] (bool low_gfx) { - auto_hide_animation_.SetDuration(low_gfx ? 0 : ANIM_DURATION_SHORT); - hover_animation_.SetDuration(low_gfx ? ANIM_DURATION_SHORT_SHORT : ANIM_DURATION); - drag_over_animation_.SetDuration(low_gfx ? 0 : ANIM_DURATION_LONG); - drag_out_animation_.SetDuration(low_gfx ? 0 : ANIM_DURATION_SHORT); - drag_icon_animation_.SetDuration(low_gfx ? 0 : ANIM_DURATION_SHORT); - dnd_hide_animation_.SetDuration(low_gfx ? 0 : ANIM_DURATION * 3); - dash_showing_animation_.SetDuration(low_gfx ? 0 : ANIM_DURATION_DASH_SHOWING); - QueueDraw(); - }, *this)); + Settings::Instance().low_gfx.changed.connect(sigc::hide(sigc::mem_fun(this, &Launcher::UpdateAnimations))); + UpdateAnimations();  auto_hide_animation_.updated.connect(redraw_cb);  hover_animation_.updated.connect(redraw_cb);  drag_over_animation_.updated.connect(redraw_cb); @@ -1366,6 +1352,21 @@ void Launcher::UpdateOptions(Options::Ptr options)  QueueDraw();  } +void Launcher::UpdateAnimations() +{ + bool low_gfx = Settings::Instance().low_gfx(); + + auto_hide_animation_.SetDuration(low_gfx ? 0 : ANIM_DURATION_SHORT); + hover_animation_.SetDuration(low_gfx ? 0 : ANIM_DURATION); + drag_over_animation_.SetDuration(low_gfx ? 0 : ANIM_DURATION_LONG); + drag_out_animation_.SetDuration(low_gfx ? 0 : ANIM_DURATION_SHORT); + drag_icon_animation_.SetDuration(low_gfx ? 0 : ANIM_DURATION_SHORT); + dnd_hide_animation_.SetDuration(low_gfx ? 0 : ANIM_DURATION * 3); + dash_showing_animation_.SetDuration(low_gfx ? 0 : ANIM_DURATION_DASH_SHOWING); + + QueueDraw(); +} +  void Launcher::ConfigureBarrier()  {  float decay_responsiveness_mult = ((options()->edge_responsiveness() - 1) * .3f) + 1; diff --git a/launcher/Launcher.h b/launcher/Launcher.h index c0d3ced68..c745bf1d7 100644 --- a/launcher/Launcher.h +++ b/launcher/Launcher.h @@ -195,6 +195,7 @@ private:  void OnOptionsChanged(Options::Ptr options);  void OnOptionChanged();  void UpdateOptions(Options::Ptr options); + void UpdateAnimations();  #ifdef NUX_GESTURES_SUPPORT  void OnDragStart(const nux::GestureEvent &event); | 
