Merge lp:~3v1n0/unity/lower-launcher-effects into lp:unity

Proposed by Marco Trevisan (Treviño)
Status: Merged
Approved by: Andrea Azzarone
Approved revision: no longer in the source branch.
Merged at revision: 4251
Proposed branch: lp:~3v1n0/unity/lower-launcher-effects
Merge into: lp:unity
Prerequisite: lp:~3v1n0/unity/lowgfx-setting-sync
Diff against target: 121 lines (+37/-32)
2 files modified
launcher/Launcher.cpp (+36/-32)
launcher/Launcher.h (+1/-0)
To merge this branch: bzr merge lp:~3v1n0/unity/lower-launcher-effects
Reviewer Review Type Date Requested Status
Andrea Azzarone (community) Approve
Review via email: mp+327524@code.launchpad.net

Commit message

Launcher: disable or reduce most icon effects on lowgfx

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

+1

review: Approve
Revision history for this message
deaunapaul (waxmigs2902) wrote :

> +1

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'launcher/Launcher.cpp'
2--- launcher/Launcher.cpp 2016-07-04 15:09:42 +0000
3+++ launcher/Launcher.cpp 2017-07-17 14:19:10 +0000
4@@ -138,13 +138,6 @@
5 , drag_action_(nux::DNDACTION_NONE)
6 , bg_effect_helper_(this)
7 , launcher_position_(unity::Settings::Instance().launcher_position())
8- , auto_hide_animation_(Settings::Instance().low_gfx ? 0 : ANIM_DURATION_SHORT)
9- , hover_animation_(Settings::Instance().low_gfx ? ANIM_DURATION_SHORT_SHORT : ANIM_DURATION)
10- , drag_over_animation_(Settings::Instance().low_gfx ? 0 : ANIM_DURATION_LONG)
11- , drag_out_animation_(Settings::Instance().low_gfx ? 0 : ANIM_DURATION_SHORT)
12- , drag_icon_animation_(Settings::Instance().low_gfx ? 0 : ANIM_DURATION_SHORT)
13- , dnd_hide_animation_(Settings::Instance().low_gfx ? 0 : ANIM_DURATION * 3)
14- , dash_showing_animation_(Settings::Instance().low_gfx ? 0 : ANIM_DURATION_DASH_SHOWING)
15 , cv_(Settings::Instance().em(monitor))
16 {
17 icon_renderer_->monitor = monitor();
18@@ -199,17 +192,9 @@
19 });
20
21 Settings::Instance().dpi_changed.connect(sigc::mem_fun(this, &Launcher::OnDPIChanged));
22- Settings::Instance().low_gfx.changed.connect(sigc::track_obj([this] (bool low_gfx) {
23- auto_hide_animation_.SetDuration(low_gfx ? 0 : ANIM_DURATION_SHORT);
24- hover_animation_.SetDuration(low_gfx ? ANIM_DURATION_SHORT_SHORT : ANIM_DURATION);
25- drag_over_animation_.SetDuration(low_gfx ? 0 : ANIM_DURATION_LONG);
26- drag_out_animation_.SetDuration(low_gfx ? 0 : ANIM_DURATION_SHORT);
27- drag_icon_animation_.SetDuration(low_gfx ? 0 : ANIM_DURATION_SHORT);
28- dnd_hide_animation_.SetDuration(low_gfx ? 0 : ANIM_DURATION * 3);
29- dash_showing_animation_.SetDuration(low_gfx ? 0 : ANIM_DURATION_DASH_SHOWING);
30- QueueDraw();
31- }, *this));
32+ Settings::Instance().low_gfx.changed.connect(sigc::hide(sigc::mem_fun(this, &Launcher::UpdateAnimations)));
33
34+ UpdateAnimations();
35 auto_hide_animation_.updated.connect(redraw_cb);
36 hover_animation_.updated.connect(redraw_cb);
37 drag_over_animation_.updated.connect(redraw_cb);
38@@ -1356,13 +1341,29 @@
39 SetLauncherMinimizeWindow(options->minimize_window_on_click);
40 OnMonitorChanged(monitor);
41
42+ UpdateAnimations();
43+ ConfigureBarrier();
44+ QueueDraw();
45+}
46+
47+void Launcher::UpdateAnimations()
48+{
49+ bool low_gfx = Settings::Instance().low_gfx();
50+
51+ auto_hide_animation_.SetDuration(low_gfx ? 0 : ANIM_DURATION_SHORT);
52+ hover_animation_.SetDuration(low_gfx ? 0 : ANIM_DURATION);
53+ drag_over_animation_.SetDuration(low_gfx ? 0 : ANIM_DURATION_LONG);
54+ drag_out_animation_.SetDuration(low_gfx ? 0 : ANIM_DURATION_SHORT);
55+ drag_icon_animation_.SetDuration(low_gfx ? 0 : ANIM_DURATION_SHORT);
56+ dnd_hide_animation_.SetDuration(low_gfx ? 0 : ANIM_DURATION * 3);
57+ dash_showing_animation_.SetDuration(low_gfx ? 0 : ANIM_DURATION_DASH_SHOWING);
58+
59 if (model_)
60 {
61 for (auto const& icon : *model_)
62 SetupIconAnimations(icon);
63 }
64
65- ConfigureBarrier();
66 QueueDraw();
67 }
68
69@@ -1739,23 +1740,26 @@
70
71 void Launcher::SetupIconAnimations(AbstractLauncherIcon::Ptr const& icon)
72 {
73- icon->SetQuirkDuration(AbstractLauncherIcon::Quirk::VISIBLE, ANIM_DURATION_SHORT, monitor());
74- icon->SetQuirkDuration(AbstractLauncherIcon::Quirk::RUNNING, ANIM_DURATION_SHORT, monitor());
75- icon->SetQuirkDuration(AbstractLauncherIcon::Quirk::ACTIVE, ANIM_DURATION_SHORT, monitor());
76- icon->SetQuirkDuration(AbstractLauncherIcon::Quirk::STARTING, (ANIM_DURATION_LONG * MAX_STARTING_BLINKS * STARTING_BLINK_LAMBDA * 2), monitor());
77- icon->SetQuirkDuration(AbstractLauncherIcon::Quirk::PULSE_ONCE, (ANIM_DURATION_LONG * PULSE_BLINK_LAMBDA * 2), monitor());
78- icon->SetQuirkDuration(AbstractLauncherIcon::Quirk::PRESENTED, ANIM_DURATION, monitor());
79- icon->SetQuirkDuration(AbstractLauncherIcon::Quirk::UNFOLDED, ANIM_DURATION, monitor());
80- icon->SetQuirkDuration(AbstractLauncherIcon::Quirk::SHIMMER, ANIM_DURATION_LONG, monitor());
81- icon->SetQuirkDuration(AbstractLauncherIcon::Quirk::CENTER_SAVED, ANIM_DURATION, monitor());
82- icon->SetQuirkDuration(AbstractLauncherIcon::Quirk::PROGRESS, ANIM_DURATION, monitor());
83- icon->SetQuirkDuration(AbstractLauncherIcon::Quirk::DESAT, ANIM_DURATION_SHORT_SHORT, monitor());
84- icon->SetQuirkDuration(AbstractLauncherIcon::Quirk::GLOW, ANIM_DURATION_SHORT, monitor());
85+ bool display = monitor();
86+ bool low_gfx = Settings::Instance().low_gfx();
87+
88+ icon->SetQuirkDuration(AbstractLauncherIcon::Quirk::VISIBLE, low_gfx ? 0 : ANIM_DURATION_SHORT, display);
89+ icon->SetQuirkDuration(AbstractLauncherIcon::Quirk::RUNNING, low_gfx ? 0 : ANIM_DURATION_SHORT, display);
90+ icon->SetQuirkDuration(AbstractLauncherIcon::Quirk::ACTIVE, low_gfx ? 0 : ANIM_DURATION_SHORT, display);
91+ icon->SetQuirkDuration(AbstractLauncherIcon::Quirk::STARTING, (ANIM_DURATION_LONG * MAX_STARTING_BLINKS * STARTING_BLINK_LAMBDA * 2), display);
92+ icon->SetQuirkDuration(AbstractLauncherIcon::Quirk::PULSE_ONCE, (ANIM_DURATION_LONG * PULSE_BLINK_LAMBDA * 2), display);
93+ icon->SetQuirkDuration(AbstractLauncherIcon::Quirk::PRESENTED, low_gfx ? 0 : ANIM_DURATION, display);
94+ icon->SetQuirkDuration(AbstractLauncherIcon::Quirk::UNFOLDED, low_gfx ? 0 : ANIM_DURATION, display);
95+ icon->SetQuirkDuration(AbstractLauncherIcon::Quirk::SHIMMER, low_gfx ? ANIM_DURATION_SHORT_SHORT : ANIM_DURATION_LONG, display);
96+ icon->SetQuirkDuration(AbstractLauncherIcon::Quirk::CENTER_SAVED, low_gfx ? ANIM_DURATION_SHORT_SHORT : ANIM_DURATION, display);
97+ icon->SetQuirkDuration(AbstractLauncherIcon::Quirk::PROGRESS, low_gfx ? ANIM_DURATION_SHORT_SHORT : ANIM_DURATION, display);
98+ icon->SetQuirkDuration(AbstractLauncherIcon::Quirk::DESAT, low_gfx ? 0 : ANIM_DURATION_SHORT_SHORT, display);
99+ icon->SetQuirkDuration(AbstractLauncherIcon::Quirk::GLOW, low_gfx ? 0 : ANIM_DURATION_SHORT, display);
100
101 if (options()->urgent_animation() == URGENT_ANIMATION_WIGGLE)
102- icon->SetQuirkDuration(AbstractLauncherIcon::Quirk::URGENT, (ANIM_DURATION_SHORT * WIGGLE_CYCLES), monitor());
103+ icon->SetQuirkDuration(AbstractLauncherIcon::Quirk::URGENT, (ANIM_DURATION_SHORT * WIGGLE_CYCLES), display);
104 else
105- icon->SetQuirkDuration(AbstractLauncherIcon::Quirk::URGENT, (ANIM_DURATION_LONG * URGENT_BLINKS * 2), monitor());
106+ icon->SetQuirkDuration(AbstractLauncherIcon::Quirk::URGENT, (ANIM_DURATION_LONG * URGENT_BLINKS * 2), display);
107 }
108
109 void Launcher::SetModel(LauncherModel::Ptr model)
110
111=== modified file 'launcher/Launcher.h'
112--- launcher/Launcher.h 2016-03-30 18:18:07 +0000
113+++ launcher/Launcher.h 2017-07-17 14:19:10 +0000
114@@ -195,6 +195,7 @@
115 void OnOptionsChanged(Options::Ptr options);
116 void OnOptionChanged();
117 void UpdateOptions(Options::Ptr options);
118+ void UpdateAnimations();
119
120 #ifdef NUX_GESTURES_SUPPORT
121 void OnDragStart(const nux::GestureEvent &event);