Merge lp:~3v1n0/unity/lowgfx-mode-less-effects into lp:unity
- lowgfx-mode-less-effects
- Merge into trunk
Proposed by
Marco Trevisan (Treviño)
Status: | Merged |
---|---|
Approved by: | Andrea Azzarone |
Approved revision: | no longer in the source branch. |
Merged at revision: | 4143 |
Proposed branch: | lp:~3v1n0/unity/lowgfx-mode-less-effects |
Merge into: | lp:unity |
Prerequisite: | lp:~hikiko/unity/unity.showdesktop |
Diff against target: |
1199 lines (+187/-171) 32 files modified
dash/DashController.cpp (+6/-2) dash/DashView.cpp (+14/-10) dash/StandaloneDash.cpp (+1/-1) dash/previews/PreviewContainer.cpp (+35/-76) dash/previews/PreviewContainer.h (+4/-9) dash/previews/StandaloneApplicationPreview.cpp (+5/-0) dash/previews/StandaloneErrorPreview.cpp (+5/-0) dash/previews/StandaloneMoviePreview.cpp (+5/-0) dash/previews/StandaloneMusicPaymentPreview.cpp (+5/-0) dash/previews/StandaloneSocialPreview.cpp (+5/-0) hud/HudController.cpp (+5/-2) launcher/CairoBaseWindow.cpp (+6/-2) launcher/Launcher.cpp (+22/-11) launcher/LauncherController.cpp (+2/-6) launcher/LauncherControllerPrivate.h (+0/-1) launcher/SwitcherController.cpp (+6/-1) launcher/SwitcherView.cpp (+3/-0) lockscreen/LockScreenController.cpp (+6/-2) panel/PanelView.cpp (+7/-7) plugins/unityshell/src/UnityShowdesktopHandler.cpp (+3/-3) plugins/unityshell/src/unityshell.cpp (+3/-3) shortcuts/ShortcutController.cpp (+7/-1) shutdown/SessionController.cpp (+7/-2) unity-shared/BGHash.cpp (+6/-1) unity-shared/BGHash.h (+1/-1) unity-shared/BackgroundEffectHelper.cpp (+1/-1) unity-shared/OverlayRenderer.cpp (+6/-6) unity-shared/PlacesOverlayVScrollBar.cpp (+2/-1) unity-shared/SpreadFilter.cpp (+5/-1) unity-shared/UnitySettings.cpp (+2/-18) unity-shared/UnitySettings.h (+1/-2) unity-shared/UnityWindowView.cpp (+1/-1) |
To merge this branch: | bzr merge lp:~3v1n0/unity/lowgfx-mode-less-effects |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Andrea Azzarone (community) | Approve | ||
PS Jenkins bot | continuous-integration | Pending | |
Review via email: mp+299059@code.launchpad.net |
Commit message
Views: Toggle animators durations based on low-gfx setting
Disable animations based on low_gfx setting (now ported to nux::Property)
Description of the change
To post a comment you must log in.
Revision history for this message
Andrea Azzarone (azzar1) wrote : | # |
Revision history for this message
Andrea Azzarone (azzar1) : | # |
review:
Approve
Preview Diff
[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1 | === modified file 'dash/DashController.cpp' |
2 | --- dash/DashController.cpp 2016-03-30 14:37:36 +0000 |
3 | +++ dash/DashController.cpp 2016-07-04 18:08:50 +0000 |
4 | @@ -43,7 +43,8 @@ |
5 | |
6 | namespace |
7 | { |
8 | -unsigned const PRELOAD_TIMEOUT_LENGTH = 40; |
9 | +const unsigned PRELOAD_TIMEOUT_LENGTH = 40; |
10 | +const unsigned FADE_DURATION = 90; |
11 | |
12 | namespace dbus |
13 | { |
14 | @@ -68,7 +69,7 @@ |
15 | , visible_(false) |
16 | , dbus_server_(dbus::BUS_NAME) |
17 | , ensure_timeout_(PRELOAD_TIMEOUT_LENGTH) |
18 | - , timeline_animator_(90) |
19 | + , timeline_animator_(Settings::Instance().low_gfx() ? 0 : FADE_DURATION) |
20 | { |
21 | RegisterUBusInterests(); |
22 | |
23 | @@ -91,6 +92,9 @@ |
24 | SetupWindow(); |
25 | UScreen::GetDefault()->changed.connect(sigc::mem_fun(this, &Controller::OnMonitorChanged)); |
26 | Settings::Instance().launcher_position.changed.connect(sigc::hide(sigc::mem_fun(this, &Controller::Relayout))); |
27 | + Settings::Instance().low_gfx.changed.connect(sigc::track_obj([this] (bool low_gfx) { |
28 | + timeline_animator_.SetDuration(low_gfx ? 0 : FADE_DURATION); |
29 | + }, *this)); |
30 | |
31 | form_factor_changed_ = Settings::Instance().form_factor.changed.connect([this] (FormFactor) |
32 | { |
33 | |
34 | === modified file 'dash/DashView.cpp' |
35 | --- dash/DashView.cpp 2016-03-18 01:47:08 +0000 |
36 | +++ dash/DashView.cpp 2016-07-04 18:08:50 +0000 |
37 | @@ -313,13 +313,15 @@ |
38 | preview_animation_.reset(); |
39 | preview_container_animation_.reset(); |
40 | |
41 | + double anim_length = Settings::Instance().low_gfx() ? 0 : PREVIEW_ANIMATION_LENGTH; |
42 | + |
43 | // Dash Split Open Animation |
44 | split_animation_.reset(new na::AnimateValue<float>()); |
45 | - split_animation_->SetDuration((1.0f - animate_split_value_) * PREVIEW_ANIMATION_LENGTH); |
46 | + split_animation_->SetDuration((1.0f - animate_split_value_) * anim_length); |
47 | split_animation_->SetStartValue(animate_split_value_); |
48 | split_animation_->SetFinishValue(1.0f); |
49 | split_animation_->SetEasingCurve(na::EasingCurve(na::EasingCurve::Type::Linear)); |
50 | - split_animation_->updated.connect([this](float const& linear_split_animate_value) |
51 | + split_animation_->updated.connect([this, anim_length](float const& linear_split_animate_value) |
52 | { |
53 | static na::EasingCurve split_animation_curve(na::EasingCurve::Type::InQuad); |
54 | |
55 | @@ -331,11 +333,11 @@ |
56 | { |
57 | // Preview Container Close Animation |
58 | preview_container_animation_.reset(new na::AnimateValue<float>()); |
59 | - preview_container_animation_->SetDuration((1.0f - animate_preview_container_value_) * PREVIEW_ANIMATION_LENGTH); |
60 | + preview_container_animation_->SetDuration((1.0f - animate_preview_container_value_) * anim_length); |
61 | preview_container_animation_->SetStartValue(animate_preview_container_value_); |
62 | preview_container_animation_->SetFinishValue(1.0f); |
63 | preview_container_animation_->SetEasingCurve(na::EasingCurve(na::EasingCurve::Type::Linear)); |
64 | - preview_container_animation_->updated.connect([this](float const& linear_preview_container_animate_value) |
65 | + preview_container_animation_->updated.connect([this, anim_length](float const& linear_preview_container_animate_value) |
66 | { |
67 | static na::EasingCurve preview_container_animation_curve(na::EasingCurve::Type::InQuad); |
68 | |
69 | @@ -347,7 +349,7 @@ |
70 | { |
71 | // Preview Close Animation |
72 | preview_animation_.reset(new na::AnimateValue<float>()); |
73 | - preview_animation_->SetDuration((1.0f - animate_preview_value_) * PREVIEW_ANIMATION_LENGTH); |
74 | + preview_animation_->SetDuration((1.0f - animate_preview_value_) * anim_length); |
75 | preview_animation_->SetStartValue(animate_preview_value_); |
76 | preview_animation_->SetFinishValue(1.0f); |
77 | preview_animation_->SetEasingCurve(na::EasingCurve(na::EasingCurve::Type::Linear)); |
78 | @@ -382,13 +384,15 @@ |
79 | split_animation_.reset(); |
80 | preview_container_animation_.reset(); |
81 | |
82 | + double anim_length = Settings::Instance().low_gfx() ? 0 : PREVIEW_ANIMATION_LENGTH; |
83 | + |
84 | // Preview Close Animation |
85 | preview_animation_.reset(new na::AnimateValue<float>()); |
86 | - preview_animation_->SetDuration(animate_preview_value_ * PREVIEW_ANIMATION_LENGTH); |
87 | + preview_animation_->SetDuration(animate_preview_value_ * anim_length); |
88 | preview_animation_->SetStartValue(1.0f - animate_preview_value_); |
89 | preview_animation_->SetFinishValue(1.0f); |
90 | preview_animation_->SetEasingCurve(na::EasingCurve(na::EasingCurve::Type::Linear)); |
91 | - preview_animation_->updated.connect([this](float const& preview_value) |
92 | + preview_animation_->updated.connect([this, anim_length](float const& preview_value) |
93 | { |
94 | animate_preview_value_ = 1.0f - preview_value; |
95 | QueueDraw(); |
96 | @@ -398,11 +402,11 @@ |
97 | { |
98 | // Preview Container Close Animation |
99 | preview_container_animation_.reset(new na::AnimateValue<float>()); |
100 | - preview_container_animation_->SetDuration(animate_preview_container_value_ * PREVIEW_ANIMATION_LENGTH); |
101 | + preview_container_animation_->SetDuration(animate_preview_container_value_ * anim_length); |
102 | preview_container_animation_->SetStartValue(1.0f - animate_preview_container_value_); |
103 | preview_container_animation_->SetFinishValue(1.0f); |
104 | preview_container_animation_->SetEasingCurve(na::EasingCurve(na::EasingCurve::Type::Linear)); |
105 | - preview_container_animation_->updated.connect([this](float const& linear_preview_container_animate_value) |
106 | + preview_container_animation_->updated.connect([this, anim_length](float const& linear_preview_container_animate_value) |
107 | { |
108 | static na::EasingCurve preview_container_animation_curve(na::EasingCurve::Type::InQuad); |
109 | |
110 | @@ -413,7 +417,7 @@ |
111 | { |
112 | // Dash Split Close Animation |
113 | split_animation_.reset(new na::AnimateValue<float>()); |
114 | - split_animation_->SetDuration(animate_split_value_ * PREVIEW_ANIMATION_LENGTH); |
115 | + split_animation_->SetDuration(animate_split_value_ * anim_length); |
116 | split_animation_->SetStartValue(1.0f - animate_split_value_); |
117 | split_animation_->SetFinishValue(1.0f); |
118 | split_animation_->SetEasingCurve(na::EasingCurve(na::EasingCurve::Type::Linear)); |
119 | |
120 | === modified file 'dash/StandaloneDash.cpp' |
121 | --- dash/StandaloneDash.cpp 2016-03-17 07:36:44 +0000 |
122 | +++ dash/StandaloneDash.cpp 2016-07-04 18:08:50 +0000 |
123 | @@ -93,6 +93,7 @@ |
124 | { |
125 | gtk_init (&argc, &argv); |
126 | |
127 | + unity::Settings settings; |
128 | unity::BGHash bghash; |
129 | unity::FontSettings font_settings; |
130 | |
131 | @@ -100,7 +101,6 @@ |
132 | nux::logging::configure_logging(::getenv("UNITY_LOG_SEVERITY")); |
133 | // The instances for the pseudo-singletons. |
134 | unity::ThumbnailGenerator thumb_generator; |
135 | - unity::Settings settings; |
136 | unity::dash::Style dash_style; |
137 | unity::panel::Style panel_style; |
138 | |
139 | |
140 | === modified file 'dash/previews/PreviewContainer.cpp' |
141 | --- dash/previews/PreviewContainer.cpp 2014-07-30 00:49:35 +0000 |
142 | +++ dash/previews/PreviewContainer.cpp 2016-07-04 18:08:50 +0000 |
143 | @@ -23,11 +23,13 @@ |
144 | #include "PreviewContainer.h" |
145 | #include <Nux/HLayout.h> |
146 | |
147 | +#include "unity-shared/AnimationUtils.h" |
148 | #include "unity-shared/IntrospectableWrappers.h" |
149 | #include "unity-shared/TimeUtil.h" |
150 | #include "unity-shared/PreviewStyle.h" |
151 | #include "unity-shared/DashStyle.h" |
152 | #include "unity-shared/GraphicsUtils.h" |
153 | +#include "unity-shared/UnitySettings.h" |
154 | #include "PreviewNavigator.h" |
155 | #include <boost/math/constants/constants.hpp> |
156 | #include "config.h" |
157 | @@ -49,7 +51,6 @@ |
158 | const int ANIM_DURATION_LONG = 500; |
159 | const int PREVIEW_SPINNER_WAIT = 2000; |
160 | |
161 | -const std::string ANIMATION_IDLE = "animation-idle"; |
162 | const RawPixel CHILDREN_SPACE = 6_em; |
163 | } |
164 | |
165 | @@ -113,7 +114,7 @@ |
166 | StopPreviewWait(); |
167 | // the parents layout will not change based on the previews. |
168 | preview->SetReconfigureParentLayoutOnGeometryChange(false); |
169 | - |
170 | + |
171 | AddChild(preview.GetPointer()); |
172 | AddView(preview.GetPointer()); |
173 | preview->SetVisible(false); |
174 | @@ -409,23 +410,21 @@ |
175 | , scale(1.0) |
176 | , preview_layout_(nullptr) |
177 | , nav_disabled_(Navigation::NONE) |
178 | - , navigation_progress_speed_(0.0) |
179 | - , navigation_count_(0) |
180 | + , animation_(Settings::Instance().low_gfx() ? 0 : ANIM_DURATION_LONG) |
181 | { |
182 | SetAcceptKeyNavFocusOnMouseDown(false); |
183 | SetAcceptKeyNavFocusOnMouseEnter(false); |
184 | |
185 | SetupViews(); |
186 | - last_progress_time_.tv_sec = 0; |
187 | - last_progress_time_.tv_nsec = 0; |
188 | |
189 | key_down.connect(sigc::mem_fun(this, &PreviewContainer::OnKeyDown)); |
190 | mouse_click.connect(sigc::mem_fun(this, &PreviewContainer::OnMouseDown)); |
191 | scale.changed.connect(sigc::mem_fun(this, &PreviewContainer::UpdateScale)); |
192 | -} |
193 | + animation_.updated.connect(sigc::mem_fun(this, &PreviewContainer::QueueAnimation)); |
194 | |
195 | -PreviewContainer::~PreviewContainer() |
196 | -{ |
197 | + Settings::Instance().low_gfx.changed.connect(sigc::track_obj([this] (bool low_gfx) { |
198 | + animation_.SetDuration(low_gfx ? 0 : ANIM_DURATION_LONG); |
199 | + }, *this)); |
200 | } |
201 | |
202 | void PreviewContainer::Preview(dash::Preview::Ptr preview_model, Navigation direction) |
203 | @@ -503,28 +502,22 @@ |
204 | |
205 | layout->AddSpace(0, 1); |
206 | |
207 | - preview_layout_->start_navigation.connect([this]() |
208 | - { |
209 | - // reset animation clock. |
210 | - if (navigation_count_ == 0) |
211 | - clock_gettime(CLOCK_MONOTONIC, &last_progress_time_); |
212 | - |
213 | - float navigation_progress_remaining = CLAMP((1.0 - preview_layout_->GetAnimationProgress()) + navigation_count_, 1.0f, 10.0f); |
214 | - navigation_count_++; |
215 | - |
216 | - navigation_progress_speed_ = navigation_progress_remaining / ANIM_DURATION_LONG; |
217 | - QueueAnimation(); |
218 | - }); |
219 | - |
220 | - preview_layout_->continue_navigation.connect([this]() |
221 | - { |
222 | - QueueAnimation(); |
223 | - }); |
224 | - |
225 | - preview_layout_->end_navigation.connect([this]() |
226 | - { |
227 | - navigation_count_ = 0; |
228 | - navigation_progress_speed_ = 0; |
229 | + preview_layout_->start_navigation.connect([this] |
230 | + { |
231 | + if (animation_.CurrentState() == na::Animation::State::Running) |
232 | + preview_layout_->UpdateAnimationProgress(1, 1); |
233 | + |
234 | + animation::Start(animation_, animation::Direction::FORWARD); |
235 | + }); |
236 | + |
237 | + preview_layout_->continue_navigation.connect([this] |
238 | + { |
239 | + QueueAnimation(animation_.GetCurrentValue()); |
240 | + }); |
241 | + |
242 | + preview_layout_->end_navigation.connect([this] |
243 | + { |
244 | + animation_.Stop(); |
245 | }); |
246 | |
247 | navigate_right.connect( [this]() { preview_layout_->StartPreviewWait(); } ); |
248 | @@ -551,17 +544,6 @@ |
249 | gfx_engine.QRP_Color(GetX(), GetY(), GetWidth(), GetHeight(), nux::Color(0.0f, 0.0f, 0.0f, 0.0f)); |
250 | } |
251 | |
252 | - // rely on the compiz event loop to come back to us in a nice throttling |
253 | - if (AnimationInProgress()) |
254 | - { |
255 | - if (!animation_timer_) |
256 | - animation_timer_.reset(new glib::Timeout(1000/60, sigc::mem_fun(this, &PreviewContainer::QueueAnimation))); |
257 | - } |
258 | - else if (preview_layout_ && preview_layout_->IsAnimating()) |
259 | - { |
260 | - preview_layout_->UpdateAnimationProgress(1.0f, 1.0f); |
261 | - } |
262 | - |
263 | // Paint using ProcessDraw2. ProcessDraw is overrided by empty impl so we can control z order. |
264 | if (preview_layout_) |
265 | { |
266 | @@ -573,23 +555,9 @@ |
267 | gfx_engine.PopClippingRectangle(); |
268 | } |
269 | |
270 | -bool PreviewContainer::AnimationInProgress() |
271 | +namespace |
272 | { |
273 | - // short circuit to avoid unneeded calculations |
274 | - struct timespec current; |
275 | - clock_gettime(CLOCK_MONOTONIC, ¤t); |
276 | - |
277 | - if (preview_layout_ == nullptr) |
278 | - return false; |
279 | - |
280 | - // hover in animation |
281 | - if (navigation_progress_speed_ > 0) |
282 | - return true; |
283 | - |
284 | - return false; |
285 | -} |
286 | - |
287 | -static float easeInOutQuart(float t) |
288 | +double easeInOutQuart(double t) |
289 | { |
290 | t = CLAMP(t, 0.0, 1.0); |
291 | t*=2.0f; |
292 | @@ -599,28 +567,19 @@ |
293 | return -0.5f * (pow(t, 4)- 2); |
294 | } |
295 | } |
296 | - |
297 | -float PreviewContainer::GetSwipeAnimationProgress(struct timespec const& current) const |
298 | -{ |
299 | - DeltaTime time_delta = TimeUtil::TimeDelta(¤t, &last_progress_time_); |
300 | - float progress = preview_layout_->GetAnimationProgress() + (navigation_progress_speed_ * time_delta); |
301 | - |
302 | - return progress; |
303 | -} |
304 | - |
305 | -bool PreviewContainer::QueueAnimation() |
306 | -{ |
307 | - animation_timer_.reset(); |
308 | - |
309 | - timespec current; |
310 | - clock_gettime(CLOCK_MONOTONIC, ¤t); |
311 | - float progress = GetSwipeAnimationProgress(current); |
312 | +} |
313 | + |
314 | +double PreviewContainer::GetSwipeAnimationProgress(struct timespec const& current) const |
315 | +{ |
316 | + return preview_layout_ ? preview_layout_->GetAnimationProgress() : 0 + animation_.GetCurrentValue(); |
317 | +} |
318 | + |
319 | +void PreviewContainer::QueueAnimation(double progress) |
320 | +{ |
321 | if (preview_layout_) |
322 | preview_layout_->UpdateAnimationProgress(progress, easeInOutQuart(progress)); // ease in/out. |
323 | - last_progress_time_ = current; |
324 | |
325 | QueueDraw(); |
326 | - return false; |
327 | } |
328 | |
329 | bool PreviewContainer::AcceptKeyNavFocus() |
330 | |
331 | === modified file 'dash/previews/PreviewContainer.h' |
332 | --- dash/previews/PreviewContainer.h 2014-07-07 18:51:45 +0000 |
333 | +++ dash/previews/PreviewContainer.h 2016-07-04 18:08:50 +0000 |
334 | @@ -26,6 +26,7 @@ |
335 | #include <Nux/Nux.h> |
336 | #include <Nux/View.h> |
337 | #include <Nux/VLayout.h> |
338 | +#include <NuxCore/Animation.h> |
339 | #include <UnityCore/Preview.h> |
340 | #include "Preview.h" |
341 | #include "unity-shared/Introspectable.h" |
342 | @@ -57,7 +58,6 @@ |
343 | NUX_DECLARE_OBJECT_TYPE(PreviewContainer, nux::View); |
344 | |
345 | PreviewContainer(NUX_FILE_LINE_PROTO); |
346 | - virtual ~PreviewContainer(); |
347 | |
348 | void Preview(dash::Preview::Ptr preview_model, Navigation direction); |
349 | |
350 | @@ -98,10 +98,8 @@ |
351 | private: |
352 | void SetupViews(); |
353 | |
354 | - bool AnimationInProgress(); |
355 | - float GetSwipeAnimationProgress(struct timespec const& current) const; |
356 | - |
357 | - bool QueueAnimation(); |
358 | + void QueueAnimation(double progress); |
359 | + double GetSwipeAnimationProgress(struct timespec const& current) const; |
360 | |
361 | private: |
362 | void UpdateScale(double scale); |
363 | @@ -114,11 +112,8 @@ |
364 | Navigation nav_disabled_; |
365 | |
366 | // Animation |
367 | - struct timespec last_progress_time_; |
368 | - float navigation_progress_speed_; |
369 | - int navigation_count_; |
370 | + nux::animation::AnimateValue<double> animation_; |
371 | |
372 | - glib::Source::UniquePtr animation_timer_; |
373 | friend class PreviewContent; |
374 | }; |
375 | |
376 | |
377 | === modified file 'dash/previews/StandaloneApplicationPreview.cpp' |
378 | --- dash/previews/StandaloneApplicationPreview.cpp 2016-02-09 01:58:11 +0000 |
379 | +++ dash/previews/StandaloneApplicationPreview.cpp 2016-07-04 18:08:50 +0000 |
380 | @@ -21,10 +21,12 @@ |
381 | #include "config.h" |
382 | |
383 | #include "Nux/Nux.h" |
384 | +#include "Nux/NuxTimerTickSource.h" |
385 | #include "Nux/VLayout.h" |
386 | #include "Nux/WindowThread.h" |
387 | #include "NuxGraphics/GraphicsEngine.h" |
388 | #include <Nux/Layout.h> |
389 | +#include <NuxCore/AnimationController.h> |
390 | #include <NuxCore/Logger.h> |
391 | #include <UnityCore/Variant.h> |
392 | #include <UnityCore/ApplicationPreview.h> |
393 | @@ -341,6 +343,9 @@ |
394 | &TestRunner::InitWindowThread, |
395 | test_runner); |
396 | |
397 | + nux::NuxTimerTickSource tick_source; |
398 | + nux::animation::AnimationController animation_controller(tick_source); |
399 | + |
400 | wt->Run (NULL); |
401 | delete wt; |
402 | return 0; |
403 | |
404 | === modified file 'dash/previews/StandaloneErrorPreview.cpp' |
405 | --- dash/previews/StandaloneErrorPreview.cpp 2014-07-08 16:50:54 +0000 |
406 | +++ dash/previews/StandaloneErrorPreview.cpp 2016-07-04 18:08:50 +0000 |
407 | @@ -24,6 +24,8 @@ |
408 | #include "Nux/VLayout.h" |
409 | #include "Nux/WindowThread.h" |
410 | #include "NuxGraphics/GraphicsEngine.h" |
411 | +#include "Nux/NuxTimerTickSource.h" |
412 | +#include <NuxCore/AnimationController.h> |
413 | #include <Nux/Layout.h> |
414 | #include <NuxCore/Logger.h> |
415 | #include <UnityCore/Variant.h> |
416 | @@ -228,6 +230,9 @@ |
417 | &TestRunner::InitWindowThread, |
418 | test_runner); |
419 | |
420 | + nux::NuxTimerTickSource tick_source; |
421 | + nux::animation::AnimationController animation_controller(tick_source); |
422 | + |
423 | wt->Run (NULL); |
424 | delete wt; |
425 | return 0; |
426 | |
427 | === modified file 'dash/previews/StandaloneMoviePreview.cpp' |
428 | --- dash/previews/StandaloneMoviePreview.cpp 2014-07-08 16:50:54 +0000 |
429 | +++ dash/previews/StandaloneMoviePreview.cpp 2016-07-04 18:08:50 +0000 |
430 | @@ -20,10 +20,12 @@ |
431 | #include <gtk/gtk.h> |
432 | |
433 | #include "Nux/Nux.h" |
434 | +#include "Nux/NuxTimerTickSource.h" |
435 | #include "Nux/VLayout.h" |
436 | #include "Nux/WindowThread.h" |
437 | #include "NuxGraphics/GraphicsEngine.h" |
438 | #include <Nux/Layout.h> |
439 | +#include <NuxCore/AnimationController.h> |
440 | #include <NuxCore/Logger.h> |
441 | #include <UnityCore/Variant.h> |
442 | #include <UnityCore/ApplicationPreview.h> |
443 | @@ -257,6 +259,9 @@ |
444 | &TestRunner::InitWindowThread, |
445 | test_runner); |
446 | |
447 | + nux::NuxTimerTickSource tick_source; |
448 | + nux::animation::AnimationController animation_controller(tick_source); |
449 | + |
450 | wt->Run (NULL); |
451 | delete wt; |
452 | return 0; |
453 | |
454 | === modified file 'dash/previews/StandaloneMusicPaymentPreview.cpp' |
455 | --- dash/previews/StandaloneMusicPaymentPreview.cpp 2014-07-08 16:50:54 +0000 |
456 | +++ dash/previews/StandaloneMusicPaymentPreview.cpp 2016-07-04 18:08:50 +0000 |
457 | @@ -21,9 +21,11 @@ |
458 | |
459 | #include "Nux/Nux.h" |
460 | #include "Nux/VLayout.h" |
461 | +#include "Nux/NuxTimerTickSource.h" |
462 | #include "Nux/WindowThread.h" |
463 | #include "NuxGraphics/GraphicsEngine.h" |
464 | #include <Nux/Layout.h> |
465 | +#include <NuxCore/AnimationController.h> |
466 | #include <NuxCore/Logger.h> |
467 | #include <UnityCore/Variant.h> |
468 | #include <UnityCore/Preview.h> |
469 | @@ -232,6 +234,9 @@ |
470 | &TestRunner::InitWindowThread, |
471 | test_runner); |
472 | |
473 | + nux::NuxTimerTickSource tick_source; |
474 | + nux::animation::AnimationController animation_controller(tick_source); |
475 | + |
476 | wt->Run (NULL); |
477 | delete wt; |
478 | return 0; |
479 | |
480 | === modified file 'dash/previews/StandaloneSocialPreview.cpp' |
481 | --- dash/previews/StandaloneSocialPreview.cpp 2016-02-09 01:58:11 +0000 |
482 | +++ dash/previews/StandaloneSocialPreview.cpp 2016-07-04 18:08:50 +0000 |
483 | @@ -20,10 +20,12 @@ |
484 | #include "config.h" |
485 | |
486 | #include "Nux/Nux.h" |
487 | +#include "Nux/NuxTimerTickSource.h" |
488 | #include "Nux/VLayout.h" |
489 | #include "Nux/WindowThread.h" |
490 | #include "NuxGraphics/GraphicsEngine.h" |
491 | #include <Nux/Layout.h> |
492 | +#include <NuxCore/AnimationController.h> |
493 | #include <NuxCore/Logger.h> |
494 | #include <UnityCore/Variant.h> |
495 | #include <UnityCore/SocialPreview.h> |
496 | @@ -291,6 +293,9 @@ |
497 | &TestRunner::InitWindowThread, |
498 | test_runner); |
499 | |
500 | + nux::NuxTimerTickSource tick_source; |
501 | + nux::animation::AnimationController animation_controller(tick_source); |
502 | + |
503 | wt->Run (NULL); |
504 | delete wt; |
505 | return 0; |
506 | |
507 | === modified file 'hud/HudController.cpp' |
508 | --- hud/HudController.cpp 2016-03-31 02:50:01 +0000 |
509 | +++ hud/HudController.cpp 2016-07-04 18:08:50 +0000 |
510 | @@ -40,8 +40,11 @@ |
511 | { |
512 | namespace hud |
513 | { |
514 | - |
515 | +namespace |
516 | +{ |
517 | DECLARE_LOGGER(logger, "unity.hud.controller"); |
518 | +const unsigned FADE_DURATION = 90; |
519 | +} |
520 | |
521 | Controller::Controller(Controller::ViewCreator const& create_view, |
522 | Controller::WindowCreator const& create_window) |
523 | @@ -54,7 +57,7 @@ |
524 | , monitor_index_(0) |
525 | , create_view_(create_view) |
526 | , create_window_(create_window) |
527 | - , timeline_animator_(90) |
528 | + , timeline_animator_(Settings::Instance().low_gfx() ? 0 : FADE_DURATION) |
529 | { |
530 | LOG_DEBUG(logger) << "hud startup"; |
531 | |
532 | |
533 | === modified file 'launcher/CairoBaseWindow.cpp' |
534 | --- launcher/CairoBaseWindow.cpp 2016-03-17 04:22:27 +0000 |
535 | +++ launcher/CairoBaseWindow.cpp 2016-07-04 18:08:50 +0000 |
536 | @@ -44,13 +44,17 @@ |
537 | |
538 | CairoBaseWindow::CairoBaseWindow(int monitor) |
539 | : cv_(Settings::Instance().em(monitor)) |
540 | - , use_blurred_background_(!Settings::Instance().GetLowGfxMode()) |
541 | + , use_blurred_background_(!Settings::Instance().low_gfx()) |
542 | , compute_blur_bkg_(use_blurred_background_) |
543 | - , fade_animator_(FADE_DURATION) |
544 | + , fade_animator_(Settings::Instance().low_gfx() ? 0 : FADE_DURATION) |
545 | { |
546 | SetWindowSizeMatchLayout(true); |
547 | sigVisible.connect([this] (BaseWindow*) { compute_blur_bkg_ = true; }); |
548 | |
549 | + Settings::Instance().low_gfx.changed.connect(sigc::track_obj([this] (bool low_gfx) { |
550 | + fade_animator_.SetDuration(low_gfx ? 0 : FADE_DURATION); |
551 | + }, *this)); |
552 | + |
553 | fade_animator_.updated.connect(sigc::mem_fun(this, &BaseWindow::SetOpacity)); |
554 | fade_animator_.finished.connect([this] { |
555 | if (animation::GetDirection(fade_animator_) == animation::Direction::BACKWARD) |
556 | |
557 | === modified file 'launcher/Launcher.cpp' |
558 | --- launcher/Launcher.cpp 2016-05-31 12:26:04 +0000 |
559 | +++ launcher/Launcher.cpp 2016-07-04 18:08:50 +0000 |
560 | @@ -72,6 +72,7 @@ |
561 | const int ANIM_DURATION_SHORT_SHORT = 100; |
562 | const int ANIM_DURATION = 200; |
563 | const int ANIM_DURATION_LONG = 350; |
564 | +const int ANIM_DURATION_DASH_SHOWING = 90; |
565 | const int START_DRAGICON_DURATION = 250; |
566 | |
567 | const RawPixel DEFAULT_ICON_SIZE = 48_em; |
568 | @@ -137,14 +138,14 @@ |
569 | , drag_action_(nux::DNDACTION_NONE) |
570 | , bg_effect_helper_(this) |
571 | , launcher_position_(unity::Settings::Instance().launcher_position()) |
572 | - , auto_hide_animation_(ANIM_DURATION_SHORT) |
573 | - , hover_animation_(ANIM_DURATION) |
574 | - , drag_over_animation_(ANIM_DURATION_LONG) |
575 | - , drag_out_animation_(ANIM_DURATION_SHORT) |
576 | - , drag_icon_animation_(ANIM_DURATION_SHORT) |
577 | - , dnd_hide_animation_(ANIM_DURATION * 3) |
578 | - , dash_showing_animation_(90) |
579 | - , cv_(unity::Settings::Instance().em(monitor)) |
580 | + , auto_hide_animation_(Settings::Instance().low_gfx ? 0 : ANIM_DURATION_SHORT) |
581 | + , hover_animation_(Settings::Instance().low_gfx ? ANIM_DURATION_SHORT_SHORT : ANIM_DURATION) |
582 | + , drag_over_animation_(Settings::Instance().low_gfx ? 0 : ANIM_DURATION_LONG) |
583 | + , drag_out_animation_(Settings::Instance().low_gfx ? 0 : ANIM_DURATION_SHORT) |
584 | + , drag_icon_animation_(Settings::Instance().low_gfx ? 0 : ANIM_DURATION_SHORT) |
585 | + , dnd_hide_animation_(Settings::Instance().low_gfx ? 0 : ANIM_DURATION * 3) |
586 | + , dash_showing_animation_(Settings::Instance().low_gfx ? 0 : ANIM_DURATION_DASH_SHOWING) |
587 | + , cv_(Settings::Instance().em(monitor)) |
588 | { |
589 | icon_renderer_->monitor = monitor(); |
590 | icon_renderer_->scale = cv_->DPIScale(); |
591 | @@ -197,7 +198,17 @@ |
592 | QueueDraw(); |
593 | }); |
594 | |
595 | - unity::Settings::Instance().dpi_changed.connect(sigc::mem_fun(this, &Launcher::OnDPIChanged)); |
596 | + Settings::Instance().dpi_changed.connect(sigc::mem_fun(this, &Launcher::OnDPIChanged)); |
597 | + Settings::Instance().low_gfx.changed.connect(sigc::track_obj([this] (bool low_gfx) { |
598 | + auto_hide_animation_.SetDuration(low_gfx ? 0 : ANIM_DURATION_SHORT); |
599 | + hover_animation_.SetDuration(low_gfx ? ANIM_DURATION_SHORT_SHORT : ANIM_DURATION); |
600 | + drag_over_animation_.SetDuration(low_gfx ? 0 : ANIM_DURATION_LONG); |
601 | + drag_out_animation_.SetDuration(low_gfx ? 0 : ANIM_DURATION_SHORT); |
602 | + drag_icon_animation_.SetDuration(low_gfx ? 0 : ANIM_DURATION_SHORT); |
603 | + dnd_hide_animation_.SetDuration(low_gfx ? 0 : ANIM_DURATION * 3); |
604 | + dash_showing_animation_.SetDuration(low_gfx ? 0 : ANIM_DURATION_DASH_SHOWING); |
605 | + QueueDraw(); |
606 | + }, *this)); |
607 | |
608 | auto_hide_animation_.updated.connect(redraw_cb); |
609 | hover_animation_.updated.connect(redraw_cb); |
610 | @@ -1847,7 +1858,7 @@ |
611 | GfxContext.PushClippingRectangle(base); |
612 | gPainter.PushDrawColorLayer(GfxContext, base, clear_colour, true, ROP); |
613 | |
614 | - if (Settings::Instance().GetLowGfxMode() == false) |
615 | + if (Settings::Instance().low_gfx() == false) |
616 | { |
617 | GfxContext.GetRenderStates().SetBlend(true); |
618 | GfxContext.GetRenderStates().SetPremultipliedBlend(nux::SRC_OVER); |
619 | @@ -1899,7 +1910,7 @@ |
620 | pressure_color); |
621 | } |
622 | |
623 | - if (!Settings::Instance().GetLowGfxMode()) |
624 | + if (!Settings::Instance().low_gfx()) |
625 | { |
626 | if (IsOverlayOpen() && bg_effect_helper_.enabled) |
627 | { |
628 | |
629 | === modified file 'launcher/LauncherController.cpp' |
630 | --- launcher/LauncherController.cpp 2016-04-28 08:03:48 +0000 |
631 | +++ launcher/LauncherController.cpp 2016-07-04 18:08:50 +0000 |
632 | @@ -156,14 +156,10 @@ |
633 | |
634 | WindowManager& wm = WindowManager::Default(); |
635 | wm.window_focus_changed.connect(sigc::mem_fun(this, &Controller::Impl::OnWindowFocusChanged)); |
636 | -#if SIGCXX_MAJOR_VERSION >= 2 && SIGCXX_MINOR_VERSION >= 5 |
637 | wm.viewport_layout_changed.connect(sigc::track_obj([this] (int w, int h) { UpdateNumWorkspaces(w * h); }, *this)); |
638 | -#else |
639 | - wm.viewport_layout_changed.connect(sigc::group(sigc::mem_fun(this, &Controller::Impl::UpdateNumWorkspaces), sigc::_1 * sigc::_2)); |
640 | -#endif |
641 | - average_color_connection_ = wm.average_color.changed.connect([this] (nux::Color const& color) { |
642 | + wm.average_color.changed.connect(sigc::track_obj([this] (nux::Color const& color) { |
643 | parent_->options()->background_color = color; |
644 | - }); |
645 | + }, *this)); |
646 | |
647 | ubus.RegisterInterest(UBUS_QUICKLIST_END_KEY_NAV, [this](GVariant * args) { |
648 | reactivate_index = model_->SelectionIndex(); |
649 | |
650 | === modified file 'launcher/LauncherControllerPrivate.h' |
651 | --- launcher/LauncherControllerPrivate.h 2016-03-18 01:47:08 +0000 |
652 | +++ launcher/LauncherControllerPrivate.h 2016-07-04 18:08:50 +0000 |
653 | @@ -151,7 +151,6 @@ |
654 | connection::Wrapper launcher_key_press_connection_; |
655 | connection::Wrapper launcher_event_outside_connection_; |
656 | connection::Wrapper launcher_key_nav_terminate_; |
657 | - connection::Wrapper average_color_connection_; |
658 | }; |
659 | |
660 | } // launcher namespace |
661 | |
662 | === modified file 'launcher/SwitcherController.cpp' |
663 | --- launcher/SwitcherController.cpp 2016-05-17 02:56:03 +0000 |
664 | +++ launcher/SwitcherController.cpp 2016-07-04 18:08:50 +0000 |
665 | @@ -25,6 +25,7 @@ |
666 | #include "unity-shared/UBusMessages.h" |
667 | #include "unity-shared/WindowManager.h" |
668 | #include "unity-shared/IconRenderer.h" |
669 | +#include "unity-shared/UnitySettings.h" |
670 | #include "unity-shared/UScreen.h" |
671 | |
672 | #include "SwitcherController.h" |
673 | @@ -270,7 +271,7 @@ |
674 | , create_window_(create_window) |
675 | , icon_renderer_(std::make_shared<ui::IconRenderer>()) |
676 | , main_layout_(nullptr) |
677 | - , fade_animator_(FADE_DURATION) |
678 | + , fade_animator_(Settings::Instance().low_gfx() ? 0 : FADE_DURATION) |
679 | { |
680 | WindowManager::Default().average_color.changed.connect(sigc::mem_fun(this, &Impl::OnBackgroundUpdate)); |
681 | |
682 | @@ -291,6 +292,10 @@ |
683 | HideWindow(); |
684 | } |
685 | }); |
686 | + |
687 | + Settings::Instance().low_gfx.changed.connect(sigc::track_obj([this] (bool low_gfx) { |
688 | + fade_animator_.SetDuration(low_gfx ? 0 : FADE_DURATION); |
689 | + }, *this)); |
690 | } |
691 | |
692 | void Controller::Impl::OnBackgroundUpdate(nux::Color const& new_color) |
693 | |
694 | === modified file 'launcher/SwitcherView.cpp' |
695 | --- launcher/SwitcherView.cpp 2016-04-25 15:09:34 +0000 |
696 | +++ launcher/SwitcherView.cpp 2016-07-04 18:08:50 +0000 |
697 | @@ -23,6 +23,7 @@ |
698 | #include "unity-shared/AnimationUtils.h" |
699 | #include "unity-shared/IconRenderer.h" |
700 | #include "unity-shared/TimeUtil.h" |
701 | +#include "unity-shared/UnitySettings.h" |
702 | #include "unity-shared/UScreen.h" |
703 | #include "unity-shared/XKeyboardUtil.h" |
704 | |
705 | @@ -248,6 +249,7 @@ |
706 | render_targets_.clear(); |
707 | } |
708 | |
709 | + animation_.SetDuration(Settings::Instance().low_gfx() ? 0 : animation_length); |
710 | SaveLast(); |
711 | } |
712 | |
713 | @@ -258,6 +260,7 @@ |
714 | |
715 | delta_tracker_.ResetState(); |
716 | |
717 | + animation_.SetDuration(animation_length); |
718 | SaveLast(); |
719 | } |
720 | |
721 | |
722 | === modified file 'lockscreen/LockScreenController.cpp' |
723 | --- lockscreen/LockScreenController.cpp 2016-06-21 01:28:26 +0000 |
724 | +++ lockscreen/LockScreenController.cpp 2016-07-04 18:08:50 +0000 |
725 | @@ -28,6 +28,7 @@ |
726 | #include "LockScreenShield.h" |
727 | #include "LockScreenSettings.h" |
728 | #include "unity-shared/AnimationUtils.h" |
729 | +#include "unity-shared/UnitySettings.h" |
730 | #include "unity-shared/UScreen.h" |
731 | #include "unity-shared/WindowManager.h" |
732 | |
733 | @@ -65,7 +66,7 @@ |
734 | , upstart_wrapper_(upstart_wrapper) |
735 | , shield_factory_(shield_factory) |
736 | , suspend_inhibitor_manager_(std::make_shared<SuspendInhibitorManager>()) |
737 | - , fade_animator_(LOCK_FADE_DURATION) |
738 | + , fade_animator_(unity::Settings::Instance().low_gfx() ? 0 : LOCK_FADE_DURATION) |
739 | , blank_window_animator_(IDLE_FADE_DURATION) |
740 | , test_mode_(test_mode) |
741 | , prompt_activation_(false) |
742 | @@ -83,6 +84,7 @@ |
743 | }); |
744 | hidden_window_connection_->block(); |
745 | |
746 | + suspend_inhibitor_manager_->connected.connect(sigc::mem_fun(this, &Controller::SyncInhibitor)); |
747 | suspend_inhibitor_manager_->about_to_suspend.connect([this] () { |
748 | if (Settings::Instance().lock_on_suspend()) |
749 | session_manager_->PromptLockScreen(); |
750 | @@ -90,7 +92,9 @@ |
751 | |
752 | Settings::Instance().lock_on_suspend.changed.connect(sigc::hide(sigc::mem_fun(this, &Controller::SyncInhibitor))); |
753 | Settings::Instance().use_legacy.changed.connect(sigc::hide(sigc::mem_fun(this, &Controller::SyncInhibitor))); |
754 | - suspend_inhibitor_manager_->connected.connect(sigc::mem_fun(this, &Controller::SyncInhibitor)); |
755 | + unity::Settings::Instance().low_gfx.changed.connect(sigc::track_obj([this] (bool low_gfx) { |
756 | + fade_animator_.SetDuration(low_gfx ? 0 : LOCK_FADE_DURATION); |
757 | + }, *this)); |
758 | |
759 | dbus_manager_->simulate_activity.connect(sigc::mem_fun(this, &Controller::SimulateActivity)); |
760 | session_manager_->screensaver_requested.connect(sigc::mem_fun(this, &Controller::OnScreenSaverActivationRequest)); |
761 | |
762 | === modified file 'panel/PanelView.cpp' |
763 | --- panel/PanelView.cpp 2016-05-19 10:25:56 +0000 |
764 | +++ panel/PanelView.cpp 2016-07-04 18:08:50 +0000 |
765 | @@ -64,7 +64,7 @@ |
766 | auto& wm = WindowManager::Default(); |
767 | panel::Style::Instance().changed.connect(sigc::mem_fun(this, &PanelView::ForceUpdateBackground)); |
768 | Settings::Instance().dpi_changed.connect(sigc::mem_fun(this, &PanelView::Resize)); |
769 | - Settings::Instance().low_gfx_changed.connect(sigc::mem_fun(this, &PanelView::OnLowGfxChanged)); |
770 | + Settings::Instance().low_gfx.changed.connect(sigc::hide(sigc::mem_fun(this, &PanelView::OnLowGfxChanged))); |
771 | |
772 | wm.average_color.changed.connect(sigc::mem_fun(this, &PanelView::OnBackgroundUpdate)); |
773 | wm.initiate_spread.connect(sigc::mem_fun(this, &PanelView::OnSpreadInitiate)); |
774 | @@ -76,7 +76,7 @@ |
775 | rop.Blend = true; |
776 | nux::Color darken_colour = nux::Color(0.9f, 0.9f, 0.9f, 1.0f); |
777 | |
778 | - if (!Settings::Instance().GetLowGfxMode()) |
779 | + if (!Settings::Instance().low_gfx()) |
780 | { |
781 | rop.SrcBlend = GL_ZERO; |
782 | rop.DstBlend = GL_SRC_COLOR; |
783 | @@ -258,7 +258,7 @@ |
784 | |
785 | void PanelView::OnLowGfxChanged() |
786 | { |
787 | - if (!Settings::Instance().GetLowGfxMode()) |
788 | + if (!Settings::Instance().low_gfx()) |
789 | { |
790 | nux::ROPConfig rop; |
791 | |
792 | @@ -368,7 +368,7 @@ |
793 | GfxContext.PopClippingRectangle(); |
794 | } |
795 | |
796 | - if (overlay_mode && !Settings::Instance().GetLowGfxMode()) |
797 | + if (overlay_mode && !Settings::Instance().low_gfx()) |
798 | { |
799 | nux::GetPainter().RenderSinglePaintLayer(GfxContext, geo, bg_darken_layer_.get()); |
800 | |
801 | @@ -462,7 +462,7 @@ |
802 | |
803 | if (overlay_mode) |
804 | { |
805 | - if (Settings::Instance().GetLowGfxMode()) |
806 | + if (Settings::Instance().low_gfx()) |
807 | { |
808 | rop.Blend = false; |
809 | auto const& bg_color = WindowManager::Default().average_color(); |
810 | @@ -481,7 +481,7 @@ |
811 | refine_geo.x = refine_x_pos; |
812 | refine_geo.width = bg_refine_tex_->GetWidth(); |
813 | |
814 | - if (!Settings::Instance().GetLowGfxMode()) |
815 | + if (!Settings::Instance().low_gfx()) |
816 | { |
817 | nux::GetPainter().PushLayer(GfxContext, refine_geo, bg_refine_layer_.get()); |
818 | bgs++; |
819 | @@ -497,7 +497,7 @@ |
820 | if (!overlay_mode || !GfxContext.UsingGLSLCodePath()) |
821 | gPainter.PushLayer(GfxContext, geo, bg_layer_.get()); |
822 | |
823 | - if (overlay_mode && !Settings::Instance().GetLowGfxMode()) |
824 | + if (overlay_mode && !Settings::Instance().low_gfx()) |
825 | { |
826 | // apply the shine |
827 | nux::TexCoordXForm texxform; |
828 | |
829 | === modified file 'plugins/unityshell/src/UnityShowdesktopHandler.cpp' |
830 | --- plugins/unityshell/src/UnityShowdesktopHandler.cpp 2016-07-04 18:08:49 +0000 |
831 | +++ plugins/unityshell/src/UnityShowdesktopHandler.cpp 2016-07-04 18:08:50 +0000 |
832 | @@ -100,7 +100,7 @@ |
833 | return; |
834 | |
835 | state_ = ShowdesktopHandler::StateFadeOut; |
836 | - progress_ = unity::Settings::Instance().GetLowGfxMode() ? 1.0f : 0.0f; |
837 | + progress_ = Settings::Instance().low_gfx() ? 1.0f : 0.0f; |
838 | |
839 | was_hidden_ = showdesktop_handler_window_interface_->Hidden(); |
840 | |
841 | @@ -144,7 +144,7 @@ |
842 | |
843 | if (state_ == ShowdesktopHandler::StateFadeOut) |
844 | { |
845 | - progress_ = unity::Settings::Instance().GetLowGfxMode() ? 1.0f : progress_ + inc; |
846 | + progress_ = Settings::Instance().low_gfx() ? 1.0f : progress_ + inc; |
847 | if (progress_ >= 1.0f) |
848 | { |
849 | progress_ = 1.0f; |
850 | @@ -153,7 +153,7 @@ |
851 | } |
852 | else if (state_ == StateFadeIn) |
853 | { |
854 | - progress_ = unity::Settings::Instance().GetLowGfxMode() ? 0.0f : progress_ - inc; |
855 | + progress_ = Settings::Instance().low_gfx() ? 0.0f : progress_ - inc; |
856 | if (progress_ <= 0.0f) |
857 | { |
858 | progress_ = 0.0f; |
859 | |
860 | === modified file 'plugins/unityshell/src/unityshell.cpp' |
861 | --- plugins/unityshell/src/unityshell.cpp 2016-06-21 01:28:26 +0000 |
862 | +++ plugins/unityshell/src/unityshell.cpp 2016-07-04 18:08:50 +0000 |
863 | @@ -301,12 +301,12 @@ |
864 | (getenv("UNITY_LOW_GFX_MODE") != NULL && atoi(getenv("UNITY_LOW_GFX_MODE")) == 1) || |
865 | optionGetLowGraphicsMode()) |
866 | { |
867 | - unity_settings_.SetLowGfxMode(true); |
868 | + unity_settings_.low_gfx = true; |
869 | } |
870 | |
871 | if (getenv("UNITY_LOW_GFX_MODE") != NULL && atoi(getenv("UNITY_LOW_GFX_MODE")) == 0) |
872 | { |
873 | - unity_settings_.SetLowGfxMode(false); |
874 | + unity_settings_.low_gfx = false; |
875 | } |
876 | #endif |
877 | |
878 | @@ -3727,7 +3727,7 @@ |
879 | else |
880 | BackgroundEffectHelper::blur_type = (unity::BlurType)optionGetDashBlurExperimental(); |
881 | |
882 | - unity::Settings::Instance().SetLowGfxMode(optionGetLowGraphicsMode()); |
883 | + unity::Settings::Instance().low_gfx = optionGetLowGraphicsMode(); |
884 | break; |
885 | case UnityshellOptions::DecayRate: |
886 | launcher_options->edge_decay_rate = optionGetDecayRate() * 100; |
887 | |
888 | === modified file 'shortcuts/ShortcutController.cpp' |
889 | --- shortcuts/ShortcutController.cpp 2015-11-26 00:06:37 +0000 |
890 | +++ shortcuts/ShortcutController.cpp 2016-07-04 18:08:50 +0000 |
891 | @@ -22,6 +22,7 @@ |
892 | |
893 | #include "unity-shared/AnimationUtils.h" |
894 | #include "unity-shared/UBusMessages.h" |
895 | +#include "unity-shared/UnitySettings.h" |
896 | #include "unity-shared/UScreen.h" |
897 | #include "unity-shared/WindowManager.h" |
898 | |
899 | @@ -42,7 +43,7 @@ |
900 | , base_window_raiser_(base_window_raiser) |
901 | , visible_(false) |
902 | , enabled_(true) |
903 | - , fade_animator_(FADE_DURATION) |
904 | + , fade_animator_(Settings::Instance().low_gfx() ? 0 : FADE_DURATION) |
905 | { |
906 | ubus_manager_.RegisterInterest(UBUS_LAUNCHER_START_KEY_SWITCHER, [this] (GVariant*) |
907 | { SetEnabled(false); }); |
908 | @@ -57,6 +58,11 @@ |
909 | if (animation::GetDirection(fade_animator_) == animation::Direction::BACKWARD) |
910 | view_window_->ShowWindow(false); |
911 | }); |
912 | + |
913 | + Settings::Instance().low_gfx.changed.connect(sigc::track_obj([this] (bool low_gfx) { |
914 | + fade_animator_.SetDuration(low_gfx ? 0 : FADE_DURATION); |
915 | + }, *this)); |
916 | + |
917 | modeller_->model_changed.connect(sigc::mem_fun(this, &Controller::OnModelUpdated)); |
918 | } |
919 | |
920 | |
921 | === modified file 'shutdown/SessionController.cpp' |
922 | --- shutdown/SessionController.cpp 2014-12-10 14:24:06 +0000 |
923 | +++ shutdown/SessionController.cpp 2016-07-04 18:08:50 +0000 |
924 | @@ -20,9 +20,10 @@ |
925 | #include "SessionController.h" |
926 | |
927 | #include "unity-shared/AnimationUtils.h" |
928 | -#include "unity-shared/UScreen.h" |
929 | #include "unity-shared/UBusMessages.h" |
930 | #include "unity-shared/UBusWrapper.h" |
931 | +#include "unity-shared/UnitySettings.h" |
932 | +#include "unity-shared/UScreen.h" |
933 | #include "unity-shared/WindowManager.h" |
934 | |
935 | namespace na = nux::animation; |
936 | @@ -38,7 +39,7 @@ |
937 | |
938 | Controller::Controller(session::Manager::Ptr const& manager) |
939 | : manager_(manager) |
940 | - , fade_animator_(FADE_DURATION) |
941 | + , fade_animator_(Settings::Instance().low_gfx() ? 0 : FADE_DURATION) |
942 | { |
943 | manager_->reboot_requested.connect([this] (bool inhibitors) { |
944 | Show(View::Mode::SHUTDOWN, inhibitors); |
945 | @@ -61,6 +62,10 @@ |
946 | if (animation::GetDirection(fade_animator_) == animation::Direction::BACKWARD) |
947 | CloseWindow(); |
948 | }); |
949 | + |
950 | + Settings::Instance().low_gfx.changed.connect(sigc::track_obj([this] (bool low_gfx) { |
951 | + fade_animator_.SetDuration(low_gfx ? 0 : FADE_DURATION); |
952 | + }, *this)); |
953 | } |
954 | |
955 | void Controller::OnBackgroundUpdate(nux::Color const& new_color) |
956 | |
957 | === modified file 'unity-shared/BGHash.cpp' |
958 | --- unity-shared/BGHash.cpp 2015-04-23 13:39:31 +0000 |
959 | +++ unity-shared/BGHash.cpp 2016-07-04 18:08:50 +0000 |
960 | @@ -20,6 +20,7 @@ |
961 | #include "BGHash.h" |
962 | #include <gdk/gdkx.h> |
963 | #include <NuxCore/Logger.h> |
964 | +#include "unity-shared/UnitySettings.h" |
965 | #include "unity-shared/WindowManager.h" |
966 | |
967 | #ifndef XA_STRING |
968 | @@ -38,13 +39,17 @@ |
969 | } |
970 | |
971 | BGHash::BGHash() |
972 | - : transition_animator_(TRANSITION_DURATION) |
973 | + : transition_animator_(Settings::Instance().low_gfx() ? 0 : TRANSITION_DURATION) |
974 | , override_color_(nux::color::Transparent) |
975 | { |
976 | COLORS_ATOM = gdk_x11_get_xatom_by_name("_GNOME_BACKGROUND_REPRESENTATIVE_COLORS"); |
977 | transition_animator_.updated.connect(sigc::mem_fun(this, &BGHash::OnTransitionUpdated)); |
978 | WindowManager::Default().average_color = unity::colors::Aubergine; |
979 | RefreshColor(/* skip_animation */ true); |
980 | + |
981 | + Settings::Instance().low_gfx.changed.connect(sigc::track_obj([this] (bool low_gfx) { |
982 | + transition_animator_.SetDuration(low_gfx ? 0 : TRANSITION_DURATION); |
983 | + }, *this)); |
984 | } |
985 | |
986 | uint64_t BGHash::ColorAtomId() const |
987 | |
988 | === modified file 'unity-shared/BGHash.h' |
989 | --- unity-shared/BGHash.h 2014-12-11 12:54:37 +0000 |
990 | +++ unity-shared/BGHash.h 2016-07-04 18:08:50 +0000 |
991 | @@ -30,7 +30,7 @@ |
992 | |
993 | namespace unity |
994 | { |
995 | - class BGHash |
996 | + class BGHash : public sigc::trackable |
997 | { |
998 | public: |
999 | BGHash(); |
1000 | |
1001 | === modified file 'unity-shared/BackgroundEffectHelper.cpp' |
1002 | --- unity-shared/BackgroundEffectHelper.cpp 2016-03-31 06:06:15 +0000 |
1003 | +++ unity-shared/BackgroundEffectHelper.cpp 2016-07-04 18:08:50 +0000 |
1004 | @@ -51,7 +51,7 @@ |
1005 | TextureCache::GetDefault().themed_invalidated.connect(sigc::mem_fun(this, &BackgroundEffectHelper::LoadTextures)); |
1006 | LoadTextures(); |
1007 | |
1008 | - if (Settings::Instance().GetLowGfxMode()) |
1009 | + if (Settings::Instance().low_gfx()) |
1010 | blur_type = BLUR_NONE; |
1011 | } |
1012 | |
1013 | |
1014 | === modified file 'unity-shared/OverlayRenderer.cpp' |
1015 | --- unity-shared/OverlayRenderer.cpp 2016-03-31 05:54:52 +0000 |
1016 | +++ unity-shared/OverlayRenderer.cpp 2016-07-04 18:08:50 +0000 |
1017 | @@ -119,7 +119,7 @@ |
1018 | parent->scale = Settings::Instance().em()->DPIScale(); |
1019 | parent->scale.changed.connect(sigc::hide(sigc::mem_fun(this, &OverlayRendererImpl::LoadScaledTextures))); |
1020 | parent->owner_type.changed.connect(sigc::hide(sigc::mem_fun(this, &OverlayRendererImpl::LoadScaledTextures))); |
1021 | - Settings::Instance().low_gfx_changed.connect(sigc::mem_fun(this, &OverlayRendererImpl::UpdateTextures)); |
1022 | + Settings::Instance().low_gfx.changed.connect(sigc::hide(sigc::mem_fun(this, &OverlayRendererImpl::UpdateTextures))); |
1023 | Settings::Instance().launcher_position.changed.connect(sigc::hide(sigc::mem_fun(this, &OverlayRendererImpl::LoadScaledTextures))); |
1024 | dash::Style::Instance().textures_changed.connect(sigc::mem_fun(this, &OverlayRendererImpl::UpdateTextures)); |
1025 | dash::Style::Instance().textures_changed.connect(sigc::mem_fun(this, &OverlayRendererImpl::LoadScaledTextures)); |
1026 | @@ -157,7 +157,7 @@ |
1027 | bg_layer_->SetColor(new_color); |
1028 | |
1029 | //When we are in low gfx mode then our darken layer will act as a background. |
1030 | - if (Settings::Instance().GetLowGfxMode()) |
1031 | + if (Settings::Instance().low_gfx()) |
1032 | { |
1033 | bg_darken_layer_->SetColor(new_color); |
1034 | } |
1035 | @@ -172,7 +172,7 @@ |
1036 | rop.SrcBlend = GL_ONE; |
1037 | rop.DstBlend = GL_ONE_MINUS_SRC_ALPHA; |
1038 | |
1039 | - if (Settings::Instance().GetLowGfxMode() || !nux::GetWindowThread()->GetGraphicsEngine().UsingGLSLCodePath()) |
1040 | + if (Settings::Instance().low_gfx() || !nux::GetWindowThread()->GetGraphicsEngine().UsingGLSLCodePath()) |
1041 | { |
1042 | auto& avg_color = WindowManager::Default().average_color; |
1043 | bg_layer_ = std::make_shared<nux::ColorLayer>(avg_color(), true, rop); |
1044 | @@ -185,7 +185,7 @@ |
1045 | nux::Color darken_colour = nux::Color(0.9f, 0.9f, 0.9f, 1.0f); |
1046 | |
1047 | //When we are in low gfx mode then our darken layer will act as a background. |
1048 | - if (Settings::Instance().GetLowGfxMode()) |
1049 | + if (Settings::Instance().low_gfx()) |
1050 | { |
1051 | rop.Blend = false; |
1052 | rop.SrcBlend = GL_ONE; |
1053 | @@ -565,7 +565,7 @@ |
1054 | bg_darken_layer_->SetGeometry(larger_content_geo); |
1055 | nux::GetPainter().RenderSinglePaintLayer(gfx_context, larger_content_geo, bg_darken_layer_.get()); |
1056 | |
1057 | - if (!settings.GetLowGfxMode()) |
1058 | + if (!settings.low_gfx()) |
1059 | { |
1060 | #ifndef NUX_OPENGLES_20 |
1061 | if (!gfx_context.UsingGLSLCodePath()) |
1062 | @@ -984,7 +984,7 @@ |
1063 | bgs++; |
1064 | |
1065 | //Only apply shine if we aren't in low gfx mode. |
1066 | - if (!Settings::Instance().GetLowGfxMode()) |
1067 | + if (!Settings::Instance().low_gfx()) |
1068 | { |
1069 | #ifndef NUX_OPENGLES_20 |
1070 | if (!gfx_context.UsingGLSLCodePath()) |
1071 | |
1072 | === modified file 'unity-shared/PlacesOverlayVScrollBar.cpp' |
1073 | --- unity-shared/PlacesOverlayVScrollBar.cpp 2016-02-17 12:37:04 +0000 |
1074 | +++ unity-shared/PlacesOverlayVScrollBar.cpp 2016-07-04 18:08:50 +0000 |
1075 | @@ -23,6 +23,7 @@ |
1076 | #include "AnimationUtils.h" |
1077 | #include "DashStyle.h" |
1078 | #include "PlacesOverlayVScrollBar.h" |
1079 | +#include "UnitySettings.h" |
1080 | |
1081 | namespace unity |
1082 | { |
1083 | @@ -124,7 +125,7 @@ |
1084 | |
1085 | void PlacesOverlayVScrollBar::PerformPageNavigation(ScrollDir dir) |
1086 | { |
1087 | - StartScrollAnimation(dir, _slider->GetBaseHeight(), PAGE_SCROLL_ANIMATION); |
1088 | + StartScrollAnimation(dir, _slider->GetBaseHeight(), Settings::Instance().low_gfx() ? 0 : PAGE_SCROLL_ANIMATION); |
1089 | } |
1090 | |
1091 | void PlacesOverlayVScrollBar::StartScrollAnimation(ScrollDir dir, int stop, unsigned duration) |
1092 | |
1093 | === modified file 'unity-shared/SpreadFilter.cpp' |
1094 | --- unity-shared/SpreadFilter.cpp 2015-12-23 01:16:53 +0000 |
1095 | +++ unity-shared/SpreadFilter.cpp 2016-07-04 18:08:50 +0000 |
1096 | @@ -49,7 +49,7 @@ |
1097 | } |
1098 | |
1099 | Filter::Filter() |
1100 | - : fade_animator_(FADE_DURATION) |
1101 | + : fade_animator_(Settings::Instance().low_gfx() ? 0 : FADE_DURATION) |
1102 | { |
1103 | auto& wm = WindowManager::Default(); |
1104 | auto& settings = Settings::Instance(); |
1105 | @@ -110,6 +110,10 @@ |
1106 | } |
1107 | }); |
1108 | |
1109 | + Settings::Instance().low_gfx.changed.connect(sigc::track_obj([this] (bool low_gfx) { |
1110 | + fade_animator_.SetDuration(low_gfx ? 0 : FADE_DURATION); |
1111 | + }, *this)); |
1112 | + |
1113 | ApplicationManager::Default().window_opened.connect(sigc::hide(sigc::mem_fun(this, &Filter::OnWindowChanged))); |
1114 | } |
1115 | |
1116 | |
1117 | === modified file 'unity-shared/UnitySettings.cpp' |
1118 | --- unity-shared/UnitySettings.cpp 2016-06-17 12:05:17 +0000 |
1119 | +++ unity-shared/UnitySettings.cpp 2016-07-04 18:08:50 +0000 |
1120 | @@ -100,7 +100,6 @@ |
1121 | , cursor_scale_(1.0) |
1122 | , cached_double_click_activate_(true) |
1123 | , changing_gnome_settings_(false) |
1124 | - , lowGfx_(false) |
1125 | , remote_content_enabled_(true) |
1126 | { |
1127 | parent_->form_factor.SetGetterFunction(sigc::mem_fun(this, &Impl::GetFormFactor)); |
1128 | @@ -424,7 +423,6 @@ |
1129 | double cursor_scale_; |
1130 | bool cached_double_click_activate_; |
1131 | bool changing_gnome_settings_; |
1132 | - bool lowGfx_; |
1133 | bool remote_content_enabled_; |
1134 | }; |
1135 | |
1136 | @@ -433,7 +431,8 @@ |
1137 | // |
1138 | |
1139 | Settings::Settings() |
1140 | - : is_standalone(false) |
1141 | + : low_gfx(false) |
1142 | + , is_standalone(false) |
1143 | , pimpl(new Impl(this)) |
1144 | { |
1145 | if (settings_instance) |
1146 | @@ -461,21 +460,6 @@ |
1147 | return *settings_instance; |
1148 | } |
1149 | |
1150 | -bool Settings::GetLowGfxMode() const |
1151 | -{ |
1152 | - return pimpl->lowGfx_; |
1153 | -} |
1154 | - |
1155 | -void Settings::SetLowGfxMode(const bool low_gfx) |
1156 | -{ |
1157 | - if (pimpl->lowGfx_ != low_gfx) |
1158 | - { |
1159 | - pimpl->lowGfx_ = low_gfx; |
1160 | - |
1161 | - low_gfx_changed.emit(); |
1162 | - } |
1163 | -} |
1164 | - |
1165 | EMConverter::Ptr const& Settings::em(int monitor) const |
1166 | { |
1167 | return pimpl->em(monitor); |
1168 | |
1169 | === modified file 'unity-shared/UnitySettings.h' |
1170 | --- unity-shared/UnitySettings.h 2016-06-17 12:05:17 +0000 |
1171 | +++ unity-shared/UnitySettings.h 2016-07-04 18:08:50 +0000 |
1172 | @@ -54,13 +54,12 @@ |
1173 | ~Settings(); |
1174 | |
1175 | static Settings& Instance(); |
1176 | - bool GetLowGfxMode() const; |
1177 | - void SetLowGfxMode(const bool low_gfx); |
1178 | EMConverter::Ptr const& em(int monitor = 0) const; |
1179 | |
1180 | void SetLauncherSize(int launcher_size, int monitor); |
1181 | int LauncherSize(int mointor) const; |
1182 | |
1183 | + nux::Property<bool> low_gfx; |
1184 | nux::RWProperty<FormFactor> form_factor; |
1185 | nux::Property<bool> is_standalone; |
1186 | nux::ROProperty<DesktopType> desktop_type; |
1187 | |
1188 | === modified file 'unity-shared/UnityWindowView.cpp' |
1189 | --- unity-shared/UnityWindowView.cpp 2016-03-31 03:29:07 +0000 |
1190 | +++ unity-shared/UnityWindowView.cpp 2016-07-04 18:08:50 +0000 |
1191 | @@ -282,7 +282,7 @@ |
1192 | auto temp_background_color = background_color(); |
1193 | auto blend_mode = nux::LAYER_BLEND_MODE_OVERLAY; |
1194 | |
1195 | - if (Settings::Instance().GetLowGfxMode() || BackgroundEffectHelper::blur_type == BLUR_NONE) |
1196 | + if (Settings::Instance().low_gfx() || BackgroundEffectHelper::blur_type == BLUR_NONE) |
1197 | { |
1198 | temp_background_color.alpha = 1.0f; |
1199 | blend_mode = nux::LAYER_BLEND_MODE_NORMAL; |
Please remove the g_print.