Merge lp:~unity-team/unity/x-sru2 into lp:unity/7.4
- x-sru2
- Merge into xenial
Proposed by
Marco Trevisan (Treviño)
Status: | Merged |
---|---|
Approved by: | Andrea Azzarone |
Approved revision: | no longer in the source branch. |
Merged at revision: | 4109 |
Proposed branch: | lp:~unity-team/unity/x-sru2 |
Merge into: | lp:unity/7.4 |
Diff against target: |
3147 lines (+1049/-409) 58 files modified
UnityCore/GnomeSessionManager.cpp (+2/-1) com.canonical.Unity.gschema.xml (+38/-0) 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) debian/changelog (+47/-0) debian/unity7.conf (+11/-6) hud/HudController.cpp (+5/-2) launcher/ApplicationLauncherIcon.cpp (+2/-4) launcher/ApplicationLauncherIcon.h (+3/-0) launcher/CairoBaseWindow.cpp (+6/-2) launcher/FileManagerLauncherIcon.cpp (+8/-0) launcher/Launcher.cpp (+44/-32) launcher/LauncherController.cpp (+2/-6) launcher/LauncherControllerPrivate.h (+0/-1) launcher/SwitcherController.cpp (+6/-1) launcher/SwitcherView.cpp (+3/-0) launcher/VolumeImp.cpp (+4/-1) lockscreen/CMakeLists.txt (+1/-0) lockscreen/LockScreenAcceleratorController.cpp (+167/-148) lockscreen/LockScreenAcceleratorController.h (+8/-3) lockscreen/LockScreenAccelerators.cpp (+5/-0) lockscreen/LockScreenAccelerators.h (+3/-1) lockscreen/LockScreenButton.cpp (+148/-0) lockscreen/LockScreenButton.h (+70/-0) lockscreen/LockScreenController.cpp (+9/-3) lockscreen/LockScreenController.h (+3/-1) lockscreen/UserAuthenticatorPam.cpp (+14/-5) lockscreen/UserPromptView.cpp (+113/-13) lockscreen/UserPromptView.h (+9/-1) panel/PanelView.cpp (+16/-11) plugins/unityshell/src/UnityShowdesktopHandler.cpp (+4/-3) plugins/unityshell/src/unityshell.cpp (+40/-20) plugins/unityshell/src/unityshell.h (+6/-0) shortcuts/ShortcutController.cpp (+7/-1) shutdown/SessionController.cpp (+7/-2) tests/test_lockscreen_controller.cpp (+8/-4) unity-shared/BGHash.cpp (+6/-1) unity-shared/BGHash.h (+1/-1) unity-shared/BackgroundEffectHelper.cpp (+1/-1) unity-shared/DashStyle.cpp (+39/-0) unity-shared/DashStyle.h (+5/-0) unity-shared/GnomeKeyGrabber.cpp (+32/-6) unity-shared/GnomeKeyGrabberImpl.h (+8/-1) unity-shared/KeyGrabber.h (+4/-0) unity-shared/OverlayRenderer.cpp (+6/-6) unity-shared/PlacesOverlayVScrollBar.cpp (+2/-1) unity-shared/SpreadFilter.cpp (+5/-1) unity-shared/UnitySettings.cpp (+29/-18) unity-shared/UnitySettings.h (+6/-2) unity-shared/UnityWindowView.cpp (+1/-1) |
To merge this branch: | bzr merge lp:~unity-team/unity/x-sru2 |
Related bugs: |
|
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Andrea Azzarone (community) | Approve | ||
Review via email: mp+298665@code.launchpad.net |
Commit message
Releasing SRU2 for Xenial
Description of the change
To post a comment you must log in.
Preview Diff
[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1 | === modified file 'UnityCore/GnomeSessionManager.cpp' |
2 | --- UnityCore/GnomeSessionManager.cpp 2016-03-31 09:51:33 +0000 |
3 | +++ UnityCore/GnomeSessionManager.cpp 2016-07-15 10:12:55 +0000 |
4 | @@ -117,8 +117,9 @@ |
5 | |
6 | login_proxy_->ConnectProperty("Active", [this] (GVariant* variant) { |
7 | bool active = glib::Variant(variant).GetBool(); |
8 | - manager_->screensaver_requested.emit(!active); |
9 | manager_->is_session_active.changed.emit(active); |
10 | + if (active) |
11 | + manager_->screensaver_requested.emit(false); |
12 | }); |
13 | |
14 | manager_->is_session_active.SetGetterFunction([this] { |
15 | |
16 | === modified file 'com.canonical.Unity.gschema.xml' |
17 | --- com.canonical.Unity.gschema.xml 2016-03-18 01:47:08 +0000 |
18 | +++ com.canonical.Unity.gschema.xml 2016-07-15 10:12:55 +0000 |
19 | @@ -81,6 +81,25 @@ |
20 | integrated menus are enabled), otherwise they will be shown only when |
21 | the mouse cursor is over the relative mouse area.</description> |
22 | </key> |
23 | + <key type="as" name="whitelist-repeated-keys"> |
24 | + <default>[ |
25 | + 'XF86KbdBrightnessUp', |
26 | + 'XF86KbdBrightnessDown', |
27 | + 'XF86MonBrightnessUp', |
28 | + 'XF86MonBrightnessDown', |
29 | + 'XF86AudioRaiseVolume', |
30 | + 'XF86AudioLowerVolume' |
31 | + ]</default> |
32 | + <summary>List of keycodes that should be processed even if auto-repated.</summary> |
33 | + <description>These keycodes are processed even if they are auto-repeated.</description> |
34 | + </key> |
35 | + <key type="b" name="pam-check-account-type"> |
36 | + <default>false</default> |
37 | + <summary>Enable/Disable PAM account checking</summary> |
38 | + <description>Whether PAM should check the result of account modules |
39 | + when authenticating. Only do this if you have account |
40 | + configured properly on your system.</description> |
41 | + </key> |
42 | </schema> |
43 | <schema path="/com/canonical/unity/interface/" id="com.canonical.Unity.Interface" gettext-domain="unity"> |
44 | <key type="d" name="text-scale-factor"> |
45 | @@ -208,4 +227,23 @@ |
46 | when clicking over unfocused menu entries</description> |
47 | </key> |
48 | </schema> |
49 | + <schema path="/com/canonical/unity/gestures/" id="com.canonical.Unity.Gestures" gettext-domain="unity"> |
50 | + <key type="b" name="launcher-drag"> |
51 | + <default>true</default> |
52 | + <summary>Multi-touch gesture to reveal the launcher.</summary> |
53 | + <description>When this is enabled, a 4 finger swipe from left to right will reveal launcher, |
54 | + provided that the launcher is set to auto-hide.</description> |
55 | + </key> |
56 | + <key type="b" name="dash-tap"> |
57 | + <default>true</default> |
58 | + <summary>Multi-touch gesture to open the dash.</summary> |
59 | + <description>When this is enabled, a 4 finger tap will open the dash.</description> |
60 | + </key> |
61 | + <key type="b" name="windows-drag-pinch"> |
62 | + <default>true</default> |
63 | + <summary>Multi-touch gestures to manage the windows.</summary> |
64 | + <description>When this is enabled, 3 finger gestures such as drag, and pinch, will |
65 | + help manage the windows.</description> |
66 | + </key> |
67 | + </schema> |
68 | </schemalist> |
69 | |
70 | === modified file 'dash/DashController.cpp' |
71 | --- dash/DashController.cpp 2016-03-30 14:37:36 +0000 |
72 | +++ dash/DashController.cpp 2016-07-15 10:12:55 +0000 |
73 | @@ -43,7 +43,8 @@ |
74 | |
75 | namespace |
76 | { |
77 | -unsigned const PRELOAD_TIMEOUT_LENGTH = 40; |
78 | +const unsigned PRELOAD_TIMEOUT_LENGTH = 40; |
79 | +const unsigned FADE_DURATION = 90; |
80 | |
81 | namespace dbus |
82 | { |
83 | @@ -68,7 +69,7 @@ |
84 | , visible_(false) |
85 | , dbus_server_(dbus::BUS_NAME) |
86 | , ensure_timeout_(PRELOAD_TIMEOUT_LENGTH) |
87 | - , timeline_animator_(90) |
88 | + , timeline_animator_(Settings::Instance().low_gfx() ? 0 : FADE_DURATION) |
89 | { |
90 | RegisterUBusInterests(); |
91 | |
92 | @@ -91,6 +92,9 @@ |
93 | SetupWindow(); |
94 | UScreen::GetDefault()->changed.connect(sigc::mem_fun(this, &Controller::OnMonitorChanged)); |
95 | Settings::Instance().launcher_position.changed.connect(sigc::hide(sigc::mem_fun(this, &Controller::Relayout))); |
96 | + Settings::Instance().low_gfx.changed.connect(sigc::track_obj([this] (bool low_gfx) { |
97 | + timeline_animator_.SetDuration(low_gfx ? 0 : FADE_DURATION); |
98 | + }, *this)); |
99 | |
100 | form_factor_changed_ = Settings::Instance().form_factor.changed.connect([this] (FormFactor) |
101 | { |
102 | |
103 | === modified file 'dash/DashView.cpp' |
104 | --- dash/DashView.cpp 2016-03-18 01:47:08 +0000 |
105 | +++ dash/DashView.cpp 2016-07-15 10:12:55 +0000 |
106 | @@ -313,13 +313,15 @@ |
107 | preview_animation_.reset(); |
108 | preview_container_animation_.reset(); |
109 | |
110 | + double anim_length = Settings::Instance().low_gfx() ? 0 : PREVIEW_ANIMATION_LENGTH; |
111 | + |
112 | // Dash Split Open Animation |
113 | split_animation_.reset(new na::AnimateValue<float>()); |
114 | - split_animation_->SetDuration((1.0f - animate_split_value_) * PREVIEW_ANIMATION_LENGTH); |
115 | + split_animation_->SetDuration((1.0f - animate_split_value_) * anim_length); |
116 | split_animation_->SetStartValue(animate_split_value_); |
117 | split_animation_->SetFinishValue(1.0f); |
118 | split_animation_->SetEasingCurve(na::EasingCurve(na::EasingCurve::Type::Linear)); |
119 | - split_animation_->updated.connect([this](float const& linear_split_animate_value) |
120 | + split_animation_->updated.connect([this, anim_length](float const& linear_split_animate_value) |
121 | { |
122 | static na::EasingCurve split_animation_curve(na::EasingCurve::Type::InQuad); |
123 | |
124 | @@ -331,11 +333,11 @@ |
125 | { |
126 | // Preview Container Close Animation |
127 | preview_container_animation_.reset(new na::AnimateValue<float>()); |
128 | - preview_container_animation_->SetDuration((1.0f - animate_preview_container_value_) * PREVIEW_ANIMATION_LENGTH); |
129 | + preview_container_animation_->SetDuration((1.0f - animate_preview_container_value_) * anim_length); |
130 | preview_container_animation_->SetStartValue(animate_preview_container_value_); |
131 | preview_container_animation_->SetFinishValue(1.0f); |
132 | preview_container_animation_->SetEasingCurve(na::EasingCurve(na::EasingCurve::Type::Linear)); |
133 | - preview_container_animation_->updated.connect([this](float const& linear_preview_container_animate_value) |
134 | + preview_container_animation_->updated.connect([this, anim_length](float const& linear_preview_container_animate_value) |
135 | { |
136 | static na::EasingCurve preview_container_animation_curve(na::EasingCurve::Type::InQuad); |
137 | |
138 | @@ -347,7 +349,7 @@ |
139 | { |
140 | // Preview Close Animation |
141 | preview_animation_.reset(new na::AnimateValue<float>()); |
142 | - preview_animation_->SetDuration((1.0f - animate_preview_value_) * PREVIEW_ANIMATION_LENGTH); |
143 | + preview_animation_->SetDuration((1.0f - animate_preview_value_) * anim_length); |
144 | preview_animation_->SetStartValue(animate_preview_value_); |
145 | preview_animation_->SetFinishValue(1.0f); |
146 | preview_animation_->SetEasingCurve(na::EasingCurve(na::EasingCurve::Type::Linear)); |
147 | @@ -382,13 +384,15 @@ |
148 | split_animation_.reset(); |
149 | preview_container_animation_.reset(); |
150 | |
151 | + double anim_length = Settings::Instance().low_gfx() ? 0 : PREVIEW_ANIMATION_LENGTH; |
152 | + |
153 | // Preview Close Animation |
154 | preview_animation_.reset(new na::AnimateValue<float>()); |
155 | - preview_animation_->SetDuration(animate_preview_value_ * PREVIEW_ANIMATION_LENGTH); |
156 | + preview_animation_->SetDuration(animate_preview_value_ * anim_length); |
157 | preview_animation_->SetStartValue(1.0f - animate_preview_value_); |
158 | preview_animation_->SetFinishValue(1.0f); |
159 | preview_animation_->SetEasingCurve(na::EasingCurve(na::EasingCurve::Type::Linear)); |
160 | - preview_animation_->updated.connect([this](float const& preview_value) |
161 | + preview_animation_->updated.connect([this, anim_length](float const& preview_value) |
162 | { |
163 | animate_preview_value_ = 1.0f - preview_value; |
164 | QueueDraw(); |
165 | @@ -398,11 +402,11 @@ |
166 | { |
167 | // Preview Container Close Animation |
168 | preview_container_animation_.reset(new na::AnimateValue<float>()); |
169 | - preview_container_animation_->SetDuration(animate_preview_container_value_ * PREVIEW_ANIMATION_LENGTH); |
170 | + preview_container_animation_->SetDuration(animate_preview_container_value_ * anim_length); |
171 | preview_container_animation_->SetStartValue(1.0f - animate_preview_container_value_); |
172 | preview_container_animation_->SetFinishValue(1.0f); |
173 | preview_container_animation_->SetEasingCurve(na::EasingCurve(na::EasingCurve::Type::Linear)); |
174 | - preview_container_animation_->updated.connect([this](float const& linear_preview_container_animate_value) |
175 | + preview_container_animation_->updated.connect([this, anim_length](float const& linear_preview_container_animate_value) |
176 | { |
177 | static na::EasingCurve preview_container_animation_curve(na::EasingCurve::Type::InQuad); |
178 | |
179 | @@ -413,7 +417,7 @@ |
180 | { |
181 | // Dash Split Close Animation |
182 | split_animation_.reset(new na::AnimateValue<float>()); |
183 | - split_animation_->SetDuration(animate_split_value_ * PREVIEW_ANIMATION_LENGTH); |
184 | + split_animation_->SetDuration(animate_split_value_ * anim_length); |
185 | split_animation_->SetStartValue(1.0f - animate_split_value_); |
186 | split_animation_->SetFinishValue(1.0f); |
187 | split_animation_->SetEasingCurve(na::EasingCurve(na::EasingCurve::Type::Linear)); |
188 | |
189 | === modified file 'dash/StandaloneDash.cpp' |
190 | --- dash/StandaloneDash.cpp 2016-03-17 07:36:44 +0000 |
191 | +++ dash/StandaloneDash.cpp 2016-07-15 10:12:55 +0000 |
192 | @@ -93,6 +93,7 @@ |
193 | { |
194 | gtk_init (&argc, &argv); |
195 | |
196 | + unity::Settings settings; |
197 | unity::BGHash bghash; |
198 | unity::FontSettings font_settings; |
199 | |
200 | @@ -100,7 +101,6 @@ |
201 | nux::logging::configure_logging(::getenv("UNITY_LOG_SEVERITY")); |
202 | // The instances for the pseudo-singletons. |
203 | unity::ThumbnailGenerator thumb_generator; |
204 | - unity::Settings settings; |
205 | unity::dash::Style dash_style; |
206 | unity::panel::Style panel_style; |
207 | |
208 | |
209 | === modified file 'dash/previews/PreviewContainer.cpp' |
210 | --- dash/previews/PreviewContainer.cpp 2014-07-30 00:49:35 +0000 |
211 | +++ dash/previews/PreviewContainer.cpp 2016-07-15 10:12:55 +0000 |
212 | @@ -23,11 +23,13 @@ |
213 | #include "PreviewContainer.h" |
214 | #include <Nux/HLayout.h> |
215 | |
216 | +#include "unity-shared/AnimationUtils.h" |
217 | #include "unity-shared/IntrospectableWrappers.h" |
218 | #include "unity-shared/TimeUtil.h" |
219 | #include "unity-shared/PreviewStyle.h" |
220 | #include "unity-shared/DashStyle.h" |
221 | #include "unity-shared/GraphicsUtils.h" |
222 | +#include "unity-shared/UnitySettings.h" |
223 | #include "PreviewNavigator.h" |
224 | #include <boost/math/constants/constants.hpp> |
225 | #include "config.h" |
226 | @@ -49,7 +51,6 @@ |
227 | const int ANIM_DURATION_LONG = 500; |
228 | const int PREVIEW_SPINNER_WAIT = 2000; |
229 | |
230 | -const std::string ANIMATION_IDLE = "animation-idle"; |
231 | const RawPixel CHILDREN_SPACE = 6_em; |
232 | } |
233 | |
234 | @@ -113,7 +114,7 @@ |
235 | StopPreviewWait(); |
236 | // the parents layout will not change based on the previews. |
237 | preview->SetReconfigureParentLayoutOnGeometryChange(false); |
238 | - |
239 | + |
240 | AddChild(preview.GetPointer()); |
241 | AddView(preview.GetPointer()); |
242 | preview->SetVisible(false); |
243 | @@ -409,23 +410,21 @@ |
244 | , scale(1.0) |
245 | , preview_layout_(nullptr) |
246 | , nav_disabled_(Navigation::NONE) |
247 | - , navigation_progress_speed_(0.0) |
248 | - , navigation_count_(0) |
249 | + , animation_(Settings::Instance().low_gfx() ? 0 : ANIM_DURATION_LONG) |
250 | { |
251 | SetAcceptKeyNavFocusOnMouseDown(false); |
252 | SetAcceptKeyNavFocusOnMouseEnter(false); |
253 | |
254 | SetupViews(); |
255 | - last_progress_time_.tv_sec = 0; |
256 | - last_progress_time_.tv_nsec = 0; |
257 | |
258 | key_down.connect(sigc::mem_fun(this, &PreviewContainer::OnKeyDown)); |
259 | mouse_click.connect(sigc::mem_fun(this, &PreviewContainer::OnMouseDown)); |
260 | scale.changed.connect(sigc::mem_fun(this, &PreviewContainer::UpdateScale)); |
261 | -} |
262 | + animation_.updated.connect(sigc::mem_fun(this, &PreviewContainer::QueueAnimation)); |
263 | |
264 | -PreviewContainer::~PreviewContainer() |
265 | -{ |
266 | + Settings::Instance().low_gfx.changed.connect(sigc::track_obj([this] (bool low_gfx) { |
267 | + animation_.SetDuration(low_gfx ? 0 : ANIM_DURATION_LONG); |
268 | + }, *this)); |
269 | } |
270 | |
271 | void PreviewContainer::Preview(dash::Preview::Ptr preview_model, Navigation direction) |
272 | @@ -503,28 +502,22 @@ |
273 | |
274 | layout->AddSpace(0, 1); |
275 | |
276 | - preview_layout_->start_navigation.connect([this]() |
277 | - { |
278 | - // reset animation clock. |
279 | - if (navigation_count_ == 0) |
280 | - clock_gettime(CLOCK_MONOTONIC, &last_progress_time_); |
281 | - |
282 | - float navigation_progress_remaining = CLAMP((1.0 - preview_layout_->GetAnimationProgress()) + navigation_count_, 1.0f, 10.0f); |
283 | - navigation_count_++; |
284 | - |
285 | - navigation_progress_speed_ = navigation_progress_remaining / ANIM_DURATION_LONG; |
286 | - QueueAnimation(); |
287 | - }); |
288 | - |
289 | - preview_layout_->continue_navigation.connect([this]() |
290 | - { |
291 | - QueueAnimation(); |
292 | - }); |
293 | - |
294 | - preview_layout_->end_navigation.connect([this]() |
295 | - { |
296 | - navigation_count_ = 0; |
297 | - navigation_progress_speed_ = 0; |
298 | + preview_layout_->start_navigation.connect([this] |
299 | + { |
300 | + if (animation_.CurrentState() == na::Animation::State::Running) |
301 | + preview_layout_->UpdateAnimationProgress(1, 1); |
302 | + |
303 | + animation::Start(animation_, animation::Direction::FORWARD); |
304 | + }); |
305 | + |
306 | + preview_layout_->continue_navigation.connect([this] |
307 | + { |
308 | + QueueAnimation(animation_.GetCurrentValue()); |
309 | + }); |
310 | + |
311 | + preview_layout_->end_navigation.connect([this] |
312 | + { |
313 | + animation_.Stop(); |
314 | }); |
315 | |
316 | navigate_right.connect( [this]() { preview_layout_->StartPreviewWait(); } ); |
317 | @@ -551,17 +544,6 @@ |
318 | gfx_engine.QRP_Color(GetX(), GetY(), GetWidth(), GetHeight(), nux::Color(0.0f, 0.0f, 0.0f, 0.0f)); |
319 | } |
320 | |
321 | - // rely on the compiz event loop to come back to us in a nice throttling |
322 | - if (AnimationInProgress()) |
323 | - { |
324 | - if (!animation_timer_) |
325 | - animation_timer_.reset(new glib::Timeout(1000/60, sigc::mem_fun(this, &PreviewContainer::QueueAnimation))); |
326 | - } |
327 | - else if (preview_layout_ && preview_layout_->IsAnimating()) |
328 | - { |
329 | - preview_layout_->UpdateAnimationProgress(1.0f, 1.0f); |
330 | - } |
331 | - |
332 | // Paint using ProcessDraw2. ProcessDraw is overrided by empty impl so we can control z order. |
333 | if (preview_layout_) |
334 | { |
335 | @@ -573,23 +555,9 @@ |
336 | gfx_engine.PopClippingRectangle(); |
337 | } |
338 | |
339 | -bool PreviewContainer::AnimationInProgress() |
340 | +namespace |
341 | { |
342 | - // short circuit to avoid unneeded calculations |
343 | - struct timespec current; |
344 | - clock_gettime(CLOCK_MONOTONIC, ¤t); |
345 | - |
346 | - if (preview_layout_ == nullptr) |
347 | - return false; |
348 | - |
349 | - // hover in animation |
350 | - if (navigation_progress_speed_ > 0) |
351 | - return true; |
352 | - |
353 | - return false; |
354 | -} |
355 | - |
356 | -static float easeInOutQuart(float t) |
357 | +double easeInOutQuart(double t) |
358 | { |
359 | t = CLAMP(t, 0.0, 1.0); |
360 | t*=2.0f; |
361 | @@ -599,28 +567,19 @@ |
362 | return -0.5f * (pow(t, 4)- 2); |
363 | } |
364 | } |
365 | - |
366 | -float PreviewContainer::GetSwipeAnimationProgress(struct timespec const& current) const |
367 | -{ |
368 | - DeltaTime time_delta = TimeUtil::TimeDelta(¤t, &last_progress_time_); |
369 | - float progress = preview_layout_->GetAnimationProgress() + (navigation_progress_speed_ * time_delta); |
370 | - |
371 | - return progress; |
372 | -} |
373 | - |
374 | -bool PreviewContainer::QueueAnimation() |
375 | -{ |
376 | - animation_timer_.reset(); |
377 | - |
378 | - timespec current; |
379 | - clock_gettime(CLOCK_MONOTONIC, ¤t); |
380 | - float progress = GetSwipeAnimationProgress(current); |
381 | +} |
382 | + |
383 | +double PreviewContainer::GetSwipeAnimationProgress(struct timespec const& current) const |
384 | +{ |
385 | + return preview_layout_ ? preview_layout_->GetAnimationProgress() : 0 + animation_.GetCurrentValue(); |
386 | +} |
387 | + |
388 | +void PreviewContainer::QueueAnimation(double progress) |
389 | +{ |
390 | if (preview_layout_) |
391 | preview_layout_->UpdateAnimationProgress(progress, easeInOutQuart(progress)); // ease in/out. |
392 | - last_progress_time_ = current; |
393 | |
394 | QueueDraw(); |
395 | - return false; |
396 | } |
397 | |
398 | bool PreviewContainer::AcceptKeyNavFocus() |
399 | |
400 | === modified file 'dash/previews/PreviewContainer.h' |
401 | --- dash/previews/PreviewContainer.h 2014-07-07 18:51:45 +0000 |
402 | +++ dash/previews/PreviewContainer.h 2016-07-15 10:12:55 +0000 |
403 | @@ -26,6 +26,7 @@ |
404 | #include <Nux/Nux.h> |
405 | #include <Nux/View.h> |
406 | #include <Nux/VLayout.h> |
407 | +#include <NuxCore/Animation.h> |
408 | #include <UnityCore/Preview.h> |
409 | #include "Preview.h" |
410 | #include "unity-shared/Introspectable.h" |
411 | @@ -57,7 +58,6 @@ |
412 | NUX_DECLARE_OBJECT_TYPE(PreviewContainer, nux::View); |
413 | |
414 | PreviewContainer(NUX_FILE_LINE_PROTO); |
415 | - virtual ~PreviewContainer(); |
416 | |
417 | void Preview(dash::Preview::Ptr preview_model, Navigation direction); |
418 | |
419 | @@ -98,10 +98,8 @@ |
420 | private: |
421 | void SetupViews(); |
422 | |
423 | - bool AnimationInProgress(); |
424 | - float GetSwipeAnimationProgress(struct timespec const& current) const; |
425 | - |
426 | - bool QueueAnimation(); |
427 | + void QueueAnimation(double progress); |
428 | + double GetSwipeAnimationProgress(struct timespec const& current) const; |
429 | |
430 | private: |
431 | void UpdateScale(double scale); |
432 | @@ -114,11 +112,8 @@ |
433 | Navigation nav_disabled_; |
434 | |
435 | // Animation |
436 | - struct timespec last_progress_time_; |
437 | - float navigation_progress_speed_; |
438 | - int navigation_count_; |
439 | + nux::animation::AnimateValue<double> animation_; |
440 | |
441 | - glib::Source::UniquePtr animation_timer_; |
442 | friend class PreviewContent; |
443 | }; |
444 | |
445 | |
446 | === modified file 'dash/previews/StandaloneApplicationPreview.cpp' |
447 | --- dash/previews/StandaloneApplicationPreview.cpp 2016-02-09 01:58:11 +0000 |
448 | +++ dash/previews/StandaloneApplicationPreview.cpp 2016-07-15 10:12:55 +0000 |
449 | @@ -21,10 +21,12 @@ |
450 | #include "config.h" |
451 | |
452 | #include "Nux/Nux.h" |
453 | +#include "Nux/NuxTimerTickSource.h" |
454 | #include "Nux/VLayout.h" |
455 | #include "Nux/WindowThread.h" |
456 | #include "NuxGraphics/GraphicsEngine.h" |
457 | #include <Nux/Layout.h> |
458 | +#include <NuxCore/AnimationController.h> |
459 | #include <NuxCore/Logger.h> |
460 | #include <UnityCore/Variant.h> |
461 | #include <UnityCore/ApplicationPreview.h> |
462 | @@ -341,6 +343,9 @@ |
463 | &TestRunner::InitWindowThread, |
464 | test_runner); |
465 | |
466 | + nux::NuxTimerTickSource tick_source; |
467 | + nux::animation::AnimationController animation_controller(tick_source); |
468 | + |
469 | wt->Run (NULL); |
470 | delete wt; |
471 | return 0; |
472 | |
473 | === modified file 'dash/previews/StandaloneErrorPreview.cpp' |
474 | --- dash/previews/StandaloneErrorPreview.cpp 2014-07-08 16:50:54 +0000 |
475 | +++ dash/previews/StandaloneErrorPreview.cpp 2016-07-15 10:12:55 +0000 |
476 | @@ -24,6 +24,8 @@ |
477 | #include "Nux/VLayout.h" |
478 | #include "Nux/WindowThread.h" |
479 | #include "NuxGraphics/GraphicsEngine.h" |
480 | +#include "Nux/NuxTimerTickSource.h" |
481 | +#include <NuxCore/AnimationController.h> |
482 | #include <Nux/Layout.h> |
483 | #include <NuxCore/Logger.h> |
484 | #include <UnityCore/Variant.h> |
485 | @@ -228,6 +230,9 @@ |
486 | &TestRunner::InitWindowThread, |
487 | test_runner); |
488 | |
489 | + nux::NuxTimerTickSource tick_source; |
490 | + nux::animation::AnimationController animation_controller(tick_source); |
491 | + |
492 | wt->Run (NULL); |
493 | delete wt; |
494 | return 0; |
495 | |
496 | === modified file 'dash/previews/StandaloneMoviePreview.cpp' |
497 | --- dash/previews/StandaloneMoviePreview.cpp 2014-07-08 16:50:54 +0000 |
498 | +++ dash/previews/StandaloneMoviePreview.cpp 2016-07-15 10:12:55 +0000 |
499 | @@ -20,10 +20,12 @@ |
500 | #include <gtk/gtk.h> |
501 | |
502 | #include "Nux/Nux.h" |
503 | +#include "Nux/NuxTimerTickSource.h" |
504 | #include "Nux/VLayout.h" |
505 | #include "Nux/WindowThread.h" |
506 | #include "NuxGraphics/GraphicsEngine.h" |
507 | #include <Nux/Layout.h> |
508 | +#include <NuxCore/AnimationController.h> |
509 | #include <NuxCore/Logger.h> |
510 | #include <UnityCore/Variant.h> |
511 | #include <UnityCore/ApplicationPreview.h> |
512 | @@ -257,6 +259,9 @@ |
513 | &TestRunner::InitWindowThread, |
514 | test_runner); |
515 | |
516 | + nux::NuxTimerTickSource tick_source; |
517 | + nux::animation::AnimationController animation_controller(tick_source); |
518 | + |
519 | wt->Run (NULL); |
520 | delete wt; |
521 | return 0; |
522 | |
523 | === modified file 'dash/previews/StandaloneMusicPaymentPreview.cpp' |
524 | --- dash/previews/StandaloneMusicPaymentPreview.cpp 2014-07-08 16:50:54 +0000 |
525 | +++ dash/previews/StandaloneMusicPaymentPreview.cpp 2016-07-15 10:12:55 +0000 |
526 | @@ -21,9 +21,11 @@ |
527 | |
528 | #include "Nux/Nux.h" |
529 | #include "Nux/VLayout.h" |
530 | +#include "Nux/NuxTimerTickSource.h" |
531 | #include "Nux/WindowThread.h" |
532 | #include "NuxGraphics/GraphicsEngine.h" |
533 | #include <Nux/Layout.h> |
534 | +#include <NuxCore/AnimationController.h> |
535 | #include <NuxCore/Logger.h> |
536 | #include <UnityCore/Variant.h> |
537 | #include <UnityCore/Preview.h> |
538 | @@ -232,6 +234,9 @@ |
539 | &TestRunner::InitWindowThread, |
540 | test_runner); |
541 | |
542 | + nux::NuxTimerTickSource tick_source; |
543 | + nux::animation::AnimationController animation_controller(tick_source); |
544 | + |
545 | wt->Run (NULL); |
546 | delete wt; |
547 | return 0; |
548 | |
549 | === modified file 'dash/previews/StandaloneSocialPreview.cpp' |
550 | --- dash/previews/StandaloneSocialPreview.cpp 2016-02-09 01:58:11 +0000 |
551 | +++ dash/previews/StandaloneSocialPreview.cpp 2016-07-15 10:12:55 +0000 |
552 | @@ -20,10 +20,12 @@ |
553 | #include "config.h" |
554 | |
555 | #include "Nux/Nux.h" |
556 | +#include "Nux/NuxTimerTickSource.h" |
557 | #include "Nux/VLayout.h" |
558 | #include "Nux/WindowThread.h" |
559 | #include "NuxGraphics/GraphicsEngine.h" |
560 | #include <Nux/Layout.h> |
561 | +#include <NuxCore/AnimationController.h> |
562 | #include <NuxCore/Logger.h> |
563 | #include <UnityCore/Variant.h> |
564 | #include <UnityCore/SocialPreview.h> |
565 | @@ -291,6 +293,9 @@ |
566 | &TestRunner::InitWindowThread, |
567 | test_runner); |
568 | |
569 | + nux::NuxTimerTickSource tick_source; |
570 | + nux::animation::AnimationController animation_controller(tick_source); |
571 | + |
572 | wt->Run (NULL); |
573 | delete wt; |
574 | return 0; |
575 | |
576 | === modified file 'debian/changelog' |
577 | --- debian/changelog 2016-05-26 00:03:25 +0000 |
578 | +++ debian/changelog 2016-07-15 10:12:55 +0000 |
579 | @@ -1,3 +1,50 @@ |
580 | +unity (7.4.0+16.04.20160526.1-0ubuntu2) UNRELEASED; urgency=medium |
581 | + |
582 | + [ Eleni Maria Stea ] |
583 | + * PanelView: Don't draw it if the geo doesn't intersect the monitor |
584 | + geo (as in ezoom) |
585 | + * speeds up the showdesktop plugin in lowgfx mode |
586 | + |
587 | + [ Andrea Azzarone ] |
588 | + * Add whitelist for auto-repated keys. (LP: #1586491) |
589 | + * Fix scale window activation if in show desktop mode. (LP: #1582056) |
590 | + * Order matters in the rendering. Draw launcher shadow after the |
591 | + background in all cases. (LP: #1586374) |
592 | + * Fallback to volume name if no other identifier is available. (LP: |
593 | + #1103593) |
594 | + * Do not trigger screensaver on session inactive. (LP: #1587507) |
595 | + * Use SwitcherController::SetDetail instead of detail=... (LP: |
596 | + #1587618) |
597 | + * UnitySettings: Add an option to enable/disable pam account checking. |
598 | + (LP: #1460649) |
599 | + * Lockscreen: Make sure warning and errors are properly shown to the |
600 | + user (LP: #1593696) |
601 | + * Add missing header to fix compilation error with -Duse_pch=OFF. |
602 | + * Filter out fullscreen window in show desktop mode. (LP: #1597706) |
603 | + * Make sure file manager icon is not removed when unpinned. (LP: |
604 | + #1578792) |
605 | + * Properly calculate the intersection geometry in PanelView::Draw. |
606 | + This is needed to properly call SyncGeometries and to avoid problems |
607 | + such as lp:1595698. (LP: #1595698) |
608 | + |
609 | + [ Alberto Milone ] |
610 | + * UnitySettings: Add dconf keys for disabling multitouch gestures (LP: |
611 | + #1589520) |
612 | + |
613 | + [ Marco Trevisan (Treviño) ] |
614 | + * LockScreenAcceleratorController: use key::Grabber to handle allowed |
615 | + bindings (LP: #1438754) |
616 | + * LockScreenAcceleratorController: check if a setting key is available |
617 | + instead of crashing |
618 | + * ApplicationLauncherIcon: ensure quirks are properly set on icon |
619 | + initialization |
620 | + * Views: Toggle animators durations based on low-gfx setting (LP: |
621 | + #1598770) |
622 | + * unity7.conf: use different compiz profile based on |
623 | + unity_support_test result (LP: #1598770) |
624 | + |
625 | + -- Marco Trevisan (Treviño) <marco@ubuntu.com> Wed, 29 Jun 2016 18:06:42 +0200 |
626 | + |
627 | unity (7.4.0+16.04.20160526.1-0ubuntu1) xenial; urgency=medium |
628 | |
629 | [ Marco Trevisan (Treviño) ] |
630 | |
631 | === modified file 'debian/unity7.conf' |
632 | --- debian/unity7.conf 2014-02-10 12:34:09 +0000 |
633 | +++ debian/unity7.conf 2016-07-15 10:12:55 +0000 |
634 | @@ -1,7 +1,7 @@ |
635 | description "Unity Shell v7" |
636 | -author "Ted Gould <ted@ubuntu.com>" |
637 | +author "Ted Gould <ted@ubuntu.com>, Marco Trevisan <marco@ubuntu.com>" |
638 | |
639 | -start on xsession SESSION=ubuntu and (started gnome-settings-daemon or started unity-settings-daemon) |
640 | +start on xsession SESSION=ubuntu and started unity-settings-daemon |
641 | stop on desktop-end |
642 | |
643 | pre-start script |
644 | @@ -12,11 +12,16 @@ |
645 | echo "GNOME Session is starting Compiz" |
646 | stop ; exit 0 |
647 | fi |
648 | + |
649 | + compiz_profile="ubuntu" |
650 | + |
651 | + if ! /usr/lib/nux/unity_support_test -p; then |
652 | + compiz_profile="ubuntu-lowgfx" |
653 | + fi |
654 | + |
655 | + echo "Using compiz profile '$compiz_profile'" |
656 | + initctl set-env -g COMPIZ_CONFIG_PROFILE="$compiz_profile" |
657 | end script |
658 | |
659 | -env COMPIZ_CONFIG_PROFILE="ubuntu" |
660 | -export COMPIZ_CONFIG_PROFILE |
661 | - |
662 | respawn |
663 | exec compiz |
664 | - |
665 | |
666 | === modified file 'hud/HudController.cpp' |
667 | --- hud/HudController.cpp 2016-03-31 02:50:01 +0000 |
668 | +++ hud/HudController.cpp 2016-07-15 10:12:55 +0000 |
669 | @@ -40,8 +40,11 @@ |
670 | { |
671 | namespace hud |
672 | { |
673 | - |
674 | +namespace |
675 | +{ |
676 | DECLARE_LOGGER(logger, "unity.hud.controller"); |
677 | +const unsigned FADE_DURATION = 90; |
678 | +} |
679 | |
680 | Controller::Controller(Controller::ViewCreator const& create_view, |
681 | Controller::WindowCreator const& create_window) |
682 | @@ -54,7 +57,7 @@ |
683 | , monitor_index_(0) |
684 | , create_view_(create_view) |
685 | , create_window_(create_window) |
686 | - , timeline_animator_(90) |
687 | + , timeline_animator_(Settings::Instance().low_gfx() ? 0 : FADE_DURATION) |
688 | { |
689 | LOG_DEBUG(logger) << "hud startup"; |
690 | |
691 | |
692 | === modified file 'launcher/ApplicationLauncherIcon.cpp' |
693 | --- launcher/ApplicationLauncherIcon.cpp 2016-01-20 15:12:49 +0000 |
694 | +++ launcher/ApplicationLauncherIcon.cpp 2016-07-15 10:12:55 +0000 |
695 | @@ -42,7 +42,6 @@ |
696 | DECLARE_LOGGER(logger, "unity.launcher.icon.application"); |
697 | |
698 | // We use the "application-" prefix since the manager is protected, to avoid name clash |
699 | -const std::string ICON_REMOVE_TIMEOUT = "application-icon-remove"; |
700 | const std::string DEFAULT_ICON = "application-default-icon"; |
701 | |
702 | enum MenuItemType |
703 | @@ -109,14 +108,13 @@ |
704 | app_->visible.changed.emit(app_->visible()); |
705 | app_->active.changed.emit(app_->active()); |
706 | app_->running.changed.emit(app_->running()); |
707 | + app_->urgent.changed.emit(app_->urgent()); |
708 | + app_->starting.changed.emit(app_->starting() || GetQuirk(Quirk::STARTING)); |
709 | app_->desktop_file.changed.emit(app_->desktop_file()); |
710 | |
711 | // Make sure we set the LauncherIcon stick bit too... |
712 | if (app_->sticky() || was_sticky) |
713 | Stick(false); // don't emit the signal |
714 | - |
715 | - if (app_->starting()) |
716 | - SetQuirk(Quirk::STARTING, true); |
717 | } |
718 | |
719 | void ApplicationLauncherIcon::UnsetApplication() |
720 | |
721 | === modified file 'launcher/ApplicationLauncherIcon.h' |
722 | --- launcher/ApplicationLauncherIcon.h 2015-12-07 18:04:33 +0000 |
723 | +++ launcher/ApplicationLauncherIcon.h 2016-07-15 10:12:55 +0000 |
724 | @@ -54,6 +54,9 @@ |
725 | void UnStick() override; |
726 | |
727 | protected: |
728 | + // This must be defined here as it's used both in ApplicationLauncherIcon and in FileManagerLauncherIcon. |
729 | + static constexpr const char* ICON_REMOVE_TIMEOUT = "application-icon-remove"; |
730 | + |
731 | void SetApplication(ApplicationPtr const& app); |
732 | ApplicationPtr GetApplication() const; |
733 | |
734 | |
735 | === modified file 'launcher/CairoBaseWindow.cpp' |
736 | --- launcher/CairoBaseWindow.cpp 2016-03-17 04:22:27 +0000 |
737 | +++ launcher/CairoBaseWindow.cpp 2016-07-15 10:12:55 +0000 |
738 | @@ -44,13 +44,17 @@ |
739 | |
740 | CairoBaseWindow::CairoBaseWindow(int monitor) |
741 | : cv_(Settings::Instance().em(monitor)) |
742 | - , use_blurred_background_(!Settings::Instance().GetLowGfxMode()) |
743 | + , use_blurred_background_(!Settings::Instance().low_gfx()) |
744 | , compute_blur_bkg_(use_blurred_background_) |
745 | - , fade_animator_(FADE_DURATION) |
746 | + , fade_animator_(Settings::Instance().low_gfx() ? 0 : FADE_DURATION) |
747 | { |
748 | SetWindowSizeMatchLayout(true); |
749 | sigVisible.connect([this] (BaseWindow*) { compute_blur_bkg_ = true; }); |
750 | |
751 | + Settings::Instance().low_gfx.changed.connect(sigc::track_obj([this] (bool low_gfx) { |
752 | + fade_animator_.SetDuration(low_gfx ? 0 : FADE_DURATION); |
753 | + }, *this)); |
754 | + |
755 | fade_animator_.updated.connect(sigc::mem_fun(this, &BaseWindow::SetOpacity)); |
756 | fade_animator_.finished.connect([this] { |
757 | if (animation::GetDirection(fade_animator_) == animation::Direction::BACKWARD) |
758 | |
759 | === modified file 'launcher/FileManagerLauncherIcon.cpp' |
760 | --- launcher/FileManagerLauncherIcon.cpp 2016-02-09 10:43:42 +0000 |
761 | +++ launcher/FileManagerLauncherIcon.cpp 2016-07-15 10:12:55 +0000 |
762 | @@ -67,6 +67,14 @@ |
763 | icon_name = (icon.empty() ? DEFAULT_ICON : icon); |
764 | })); |
765 | |
766 | + signals_conn_.Add(app_->running.changed.connect([this](bool running) { |
767 | + LOG_DEBUG(logger) << tooltip_text() << " running now " << (running ? "true" : "false"); |
768 | + |
769 | + if (running) |
770 | + _source_manager.Remove(ICON_REMOVE_TIMEOUT); |
771 | + })); |
772 | + |
773 | + |
774 | UpdateStorageWindows(); |
775 | } |
776 | |
777 | |
778 | === modified file 'launcher/Launcher.cpp' |
779 | --- launcher/Launcher.cpp 2016-03-31 05:57:11 +0000 |
780 | +++ launcher/Launcher.cpp 2016-07-15 10:12:55 +0000 |
781 | @@ -72,6 +72,7 @@ |
782 | const int ANIM_DURATION_SHORT_SHORT = 100; |
783 | const int ANIM_DURATION = 200; |
784 | const int ANIM_DURATION_LONG = 350; |
785 | +const int ANIM_DURATION_DASH_SHOWING = 90; |
786 | const int START_DRAGICON_DURATION = 250; |
787 | |
788 | const RawPixel DEFAULT_ICON_SIZE = 48_em; |
789 | @@ -137,14 +138,14 @@ |
790 | , drag_action_(nux::DNDACTION_NONE) |
791 | , bg_effect_helper_(this) |
792 | , launcher_position_(unity::Settings::Instance().launcher_position()) |
793 | - , auto_hide_animation_(ANIM_DURATION_SHORT) |
794 | - , hover_animation_(ANIM_DURATION) |
795 | - , drag_over_animation_(ANIM_DURATION_LONG) |
796 | - , drag_out_animation_(ANIM_DURATION_SHORT) |
797 | - , drag_icon_animation_(ANIM_DURATION_SHORT) |
798 | - , dnd_hide_animation_(ANIM_DURATION * 3) |
799 | - , dash_showing_animation_(90) |
800 | - , cv_(unity::Settings::Instance().em(monitor)) |
801 | + , auto_hide_animation_(Settings::Instance().low_gfx ? 0 : ANIM_DURATION_SHORT) |
802 | + , hover_animation_(Settings::Instance().low_gfx ? ANIM_DURATION_SHORT_SHORT : ANIM_DURATION) |
803 | + , drag_over_animation_(Settings::Instance().low_gfx ? 0 : ANIM_DURATION_LONG) |
804 | + , drag_out_animation_(Settings::Instance().low_gfx ? 0 : ANIM_DURATION_SHORT) |
805 | + , drag_icon_animation_(Settings::Instance().low_gfx ? 0 : ANIM_DURATION_SHORT) |
806 | + , dnd_hide_animation_(Settings::Instance().low_gfx ? 0 : ANIM_DURATION * 3) |
807 | + , dash_showing_animation_(Settings::Instance().low_gfx ? 0 : ANIM_DURATION_DASH_SHOWING) |
808 | + , cv_(Settings::Instance().em(monitor)) |
809 | { |
810 | icon_renderer_->monitor = monitor(); |
811 | icon_renderer_->scale = cv_->DPIScale(); |
812 | @@ -197,7 +198,17 @@ |
813 | QueueDraw(); |
814 | }); |
815 | |
816 | - unity::Settings::Instance().dpi_changed.connect(sigc::mem_fun(this, &Launcher::OnDPIChanged)); |
817 | + Settings::Instance().dpi_changed.connect(sigc::mem_fun(this, &Launcher::OnDPIChanged)); |
818 | + Settings::Instance().low_gfx.changed.connect(sigc::track_obj([this] (bool low_gfx) { |
819 | + auto_hide_animation_.SetDuration(low_gfx ? 0 : ANIM_DURATION_SHORT); |
820 | + hover_animation_.SetDuration(low_gfx ? ANIM_DURATION_SHORT_SHORT : ANIM_DURATION); |
821 | + drag_over_animation_.SetDuration(low_gfx ? 0 : ANIM_DURATION_LONG); |
822 | + drag_out_animation_.SetDuration(low_gfx ? 0 : ANIM_DURATION_SHORT); |
823 | + drag_icon_animation_.SetDuration(low_gfx ? 0 : ANIM_DURATION_SHORT); |
824 | + dnd_hide_animation_.SetDuration(low_gfx ? 0 : ANIM_DURATION * 3); |
825 | + dash_showing_animation_.SetDuration(low_gfx ? 0 : ANIM_DURATION_DASH_SHOWING); |
826 | + QueueDraw(); |
827 | + }, *this)); |
828 | |
829 | auto_hide_animation_.updated.connect(redraw_cb); |
830 | hover_animation_.updated.connect(redraw_cb); |
831 | @@ -1847,7 +1858,7 @@ |
832 | GfxContext.PushClippingRectangle(base); |
833 | gPainter.PushDrawColorLayer(GfxContext, base, clear_colour, true, ROP); |
834 | |
835 | - if (Settings::Instance().GetLowGfxMode() == false) |
836 | + if (Settings::Instance().low_gfx() == false) |
837 | { |
838 | GfxContext.GetRenderStates().SetBlend(true); |
839 | GfxContext.GetRenderStates().SetPremultipliedBlend(nux::SRC_OVER); |
840 | @@ -1899,7 +1910,7 @@ |
841 | pressure_color); |
842 | } |
843 | |
844 | - if (!Settings::Instance().GetLowGfxMode()) |
845 | + if (!Settings::Instance().low_gfx()) |
846 | { |
847 | if (IsOverlayOpen() && bg_effect_helper_.enabled) |
848 | { |
849 | @@ -2010,27 +2021,6 @@ |
850 | icon_renderer_->PreprocessIcons(args, base); |
851 | EventLogic(); |
852 | |
853 | - if (!IsOverlayOpen() && launcher_position_ == LauncherPosition::BOTTOM) |
854 | - { |
855 | - const double top_line_opacity = 0.15f * launcher_alpha; |
856 | - |
857 | - gPainter.Paint2DQuadColor(GfxContext, |
858 | - nux::Geometry(bkg_box.x, |
859 | - bkg_box.y, |
860 | - bkg_box.width, |
861 | - SIDE_LINE_WIDTH.CP(cv_)), |
862 | - nux::color::White * top_line_opacity); |
863 | - |
864 | - gPainter.Paint2DQuadColor(GfxContext, |
865 | - nux::Geometry(bkg_box.x, |
866 | - bkg_box.y, |
867 | - bkg_box.width, |
868 | - 8), |
869 | - nux::Color(0x70000000), |
870 | - nux::Color(0x00000000), |
871 | - nux::Color(0x00000000), |
872 | - nux::Color(0x70000000)); |
873 | - } |
874 | |
875 | /* draw launcher */ |
876 | for (rev_it = args.rbegin(); rev_it != args.rend(); ++rev_it) |
877 | @@ -2075,6 +2065,28 @@ |
878 | nux::Color(0x70000000)); |
879 | } |
880 | |
881 | + if (!IsOverlayOpen() && launcher_position_ == LauncherPosition::BOTTOM) |
882 | + { |
883 | + const double top_line_opacity = 0.15f * launcher_alpha; |
884 | + |
885 | + gPainter.Paint2DQuadColor(GfxContext, |
886 | + nux::Geometry(bkg_box.x, |
887 | + bkg_box.y, |
888 | + bkg_box.width, |
889 | + SIDE_LINE_WIDTH.CP(cv_)), |
890 | + nux::color::White * top_line_opacity); |
891 | + |
892 | + gPainter.Paint2DQuadColor(GfxContext, |
893 | + nux::Geometry(bkg_box.x, |
894 | + bkg_box.y, |
895 | + bkg_box.width, |
896 | + 8), |
897 | + nux::Color(0x70000000), |
898 | + nux::Color(0x00000000), |
899 | + nux::Color(0x00000000), |
900 | + nux::Color(0x70000000)); |
901 | + } |
902 | + |
903 | // FIXME: can be removed for a bgk_box->SetAlpha once implemented |
904 | GfxContext.GetRenderStates().SetPremultipliedBlend(nux::DST_IN); |
905 | nux::Color alpha_mask = nux::Color(0xFFAAAAAA) * launcher_alpha; |
906 | |
907 | === modified file 'launcher/LauncherController.cpp' |
908 | --- launcher/LauncherController.cpp 2016-05-17 02:55:41 +0000 |
909 | +++ launcher/LauncherController.cpp 2016-07-15 10:12:55 +0000 |
910 | @@ -156,14 +156,10 @@ |
911 | |
912 | WindowManager& wm = WindowManager::Default(); |
913 | wm.window_focus_changed.connect(sigc::mem_fun(this, &Controller::Impl::OnWindowFocusChanged)); |
914 | -#if SIGCXX_MAJOR_VERSION >= 2 && SIGCXX_MINOR_VERSION >= 5 |
915 | wm.viewport_layout_changed.connect(sigc::track_obj([this] (int w, int h) { UpdateNumWorkspaces(w * h); }, *this)); |
916 | -#else |
917 | - wm.viewport_layout_changed.connect(sigc::group(sigc::mem_fun(this, &Controller::Impl::UpdateNumWorkspaces), sigc::_1 * sigc::_2)); |
918 | -#endif |
919 | - average_color_connection_ = wm.average_color.changed.connect([this] (nux::Color const& color) { |
920 | + wm.average_color.changed.connect(sigc::track_obj([this] (nux::Color const& color) { |
921 | parent_->options()->background_color = color; |
922 | - }); |
923 | + }, *this)); |
924 | |
925 | ubus.RegisterInterest(UBUS_QUICKLIST_END_KEY_NAV, [this](GVariant * args) { |
926 | reactivate_index = model_->SelectionIndex(); |
927 | |
928 | === modified file 'launcher/LauncherControllerPrivate.h' |
929 | --- launcher/LauncherControllerPrivate.h 2016-03-18 01:47:08 +0000 |
930 | +++ launcher/LauncherControllerPrivate.h 2016-07-15 10:12:55 +0000 |
931 | @@ -151,7 +151,6 @@ |
932 | connection::Wrapper launcher_key_press_connection_; |
933 | connection::Wrapper launcher_event_outside_connection_; |
934 | connection::Wrapper launcher_key_nav_terminate_; |
935 | - connection::Wrapper average_color_connection_; |
936 | }; |
937 | |
938 | } // launcher namespace |
939 | |
940 | === modified file 'launcher/SwitcherController.cpp' |
941 | --- launcher/SwitcherController.cpp 2016-05-17 02:56:03 +0000 |
942 | +++ launcher/SwitcherController.cpp 2016-07-15 10:12:55 +0000 |
943 | @@ -25,6 +25,7 @@ |
944 | #include "unity-shared/UBusMessages.h" |
945 | #include "unity-shared/WindowManager.h" |
946 | #include "unity-shared/IconRenderer.h" |
947 | +#include "unity-shared/UnitySettings.h" |
948 | #include "unity-shared/UScreen.h" |
949 | |
950 | #include "SwitcherController.h" |
951 | @@ -270,7 +271,7 @@ |
952 | , create_window_(create_window) |
953 | , icon_renderer_(std::make_shared<ui::IconRenderer>()) |
954 | , main_layout_(nullptr) |
955 | - , fade_animator_(FADE_DURATION) |
956 | + , fade_animator_(Settings::Instance().low_gfx() ? 0 : FADE_DURATION) |
957 | { |
958 | WindowManager::Default().average_color.changed.connect(sigc::mem_fun(this, &Impl::OnBackgroundUpdate)); |
959 | |
960 | @@ -291,6 +292,10 @@ |
961 | HideWindow(); |
962 | } |
963 | }); |
964 | + |
965 | + Settings::Instance().low_gfx.changed.connect(sigc::track_obj([this] (bool low_gfx) { |
966 | + fade_animator_.SetDuration(low_gfx ? 0 : FADE_DURATION); |
967 | + }, *this)); |
968 | } |
969 | |
970 | void Controller::Impl::OnBackgroundUpdate(nux::Color const& new_color) |
971 | |
972 | === modified file 'launcher/SwitcherView.cpp' |
973 | --- launcher/SwitcherView.cpp 2016-05-17 02:55:46 +0000 |
974 | +++ launcher/SwitcherView.cpp 2016-07-15 10:12:55 +0000 |
975 | @@ -23,6 +23,7 @@ |
976 | #include "unity-shared/AnimationUtils.h" |
977 | #include "unity-shared/IconRenderer.h" |
978 | #include "unity-shared/TimeUtil.h" |
979 | +#include "unity-shared/UnitySettings.h" |
980 | #include "unity-shared/UScreen.h" |
981 | #include "unity-shared/XKeyboardUtil.h" |
982 | |
983 | @@ -248,6 +249,7 @@ |
984 | render_targets_.clear(); |
985 | } |
986 | |
987 | + animation_.SetDuration(Settings::Instance().low_gfx() ? 0 : animation_length); |
988 | SaveLast(); |
989 | } |
990 | |
991 | @@ -258,6 +260,7 @@ |
992 | |
993 | delta_tracker_.ResetState(); |
994 | |
995 | + animation_.SetDuration(animation_length); |
996 | SaveLast(); |
997 | } |
998 | |
999 | |
1000 | === modified file 'launcher/VolumeImp.cpp' |
1001 | --- launcher/VolumeImp.cpp 2016-01-24 14:35:49 +0000 |
1002 | +++ launcher/VolumeImp.cpp 2016-07-15 10:12:55 +0000 |
1003 | @@ -86,7 +86,10 @@ |
1004 | glib::String label(g_volume_get_identifier(volume_, G_VOLUME_IDENTIFIER_KIND_LABEL)); |
1005 | glib::String uuid(g_volume_get_identifier(volume_, G_VOLUME_IDENTIFIER_KIND_UUID)); |
1006 | |
1007 | - return uuid.Str() + "-" + label.Str(); |
1008 | + if (!label && !uuid) |
1009 | + return GetName(); |
1010 | + else |
1011 | + return uuid.Str() + "-" + label.Str(); |
1012 | } |
1013 | |
1014 | std::string GetUnixDevicePath() const |
1015 | |
1016 | === modified file 'lockscreen/CMakeLists.txt' |
1017 | --- lockscreen/CMakeLists.txt 2016-03-31 09:59:30 +0000 |
1018 | +++ lockscreen/CMakeLists.txt 2016-07-15 10:12:55 +0000 |
1019 | @@ -23,6 +23,7 @@ |
1020 | KylinLockScreenShield.cpp |
1021 | LockScreenController.cpp |
1022 | LockScreenBaseShield.cpp |
1023 | + LockScreenButton.cpp |
1024 | LockScreenSettings.cpp |
1025 | LockScreenShield.cpp |
1026 | LockScreenShieldFactory.cpp |
1027 | |
1028 | === modified file 'lockscreen/LockScreenAcceleratorController.cpp' |
1029 | --- lockscreen/LockScreenAcceleratorController.cpp 2014-05-16 04:51:34 +0000 |
1030 | +++ lockscreen/LockScreenAcceleratorController.cpp 2016-07-15 10:12:55 +0000 |
1031 | @@ -1,6 +1,6 @@ |
1032 | // -*- Mode: C++; indent-tabs-mode: nil; tab-width: 2 -*- |
1033 | /* |
1034 | - * Copyright (C) 2014 Canonical Ltd |
1035 | + * Copyright (C) 2014-2016 Canonical Ltd |
1036 | * |
1037 | * This program is free software: you can redistribute it and/or modify |
1038 | * it under the terms of the GNU General Public License version 3 as |
1039 | @@ -15,10 +15,14 @@ |
1040 | * along with this program. If not, see <http://www.gnu.org/licenses/>. |
1041 | * |
1042 | * Authored by: William Hua <william.hua@canonical.com> |
1043 | + * Marco Trevisan <marco.trevisan@canonical.com> |
1044 | */ |
1045 | |
1046 | #include "LockScreenAcceleratorController.h" |
1047 | |
1048 | +#include <sigc++/bind.h> |
1049 | + |
1050 | +#include <NuxCore/Logger.h> |
1051 | #include <UnityCore/GLibDBusProxy.h> |
1052 | |
1053 | namespace unity |
1054 | @@ -28,157 +32,172 @@ |
1055 | |
1056 | namespace |
1057 | { |
1058 | -const char* const MEDIA_KEYS_SCHEMA = "org.gnome.settings-daemon.plugins.media-keys"; |
1059 | -const char* const MEDIA_KEYS_KEY_VOLUME_MUTE = "volume-mute"; |
1060 | -const char* const MEDIA_KEYS_KEY_VOLUME_DOWN = "volume-down"; |
1061 | -const char* const MEDIA_KEYS_KEY_VOLUME_UP = "volume-up"; |
1062 | - |
1063 | -const char* const POWER_SCHEMA = "org.gnome.settings-daemon.plugins.power"; |
1064 | -const char* const SUSPEND_BUTTON_ACTION_KEY = "button-suspend"; |
1065 | -const char* const SLEEP_BUTTON_ACTION_KEY = "button-sleep"; |
1066 | -const char* const HIBERNATE_BUTTON_ACTION_KEY = "button-hibernate"; |
1067 | -const char* const POWER_BUTTON_ACTION_KEY = "button-power"; |
1068 | -const char* const POWER_KEY_SUSPEND = "XF86Suspend"; |
1069 | -const char* const POWER_KEY_SLEEP = "XF86Sleep"; |
1070 | -const char* const POWER_KEY_HIBERNATE = "XF86Hibernate"; |
1071 | -const char* const POWER_KEY_POWEROFF = "XF86PowerOff"; |
1072 | - |
1073 | -const char* const INPUT_SWITCH_SCHEMA = "org.gnome.desktop.wm.keybindings"; |
1074 | -const char* const INPUT_SWITCH_KEY_PREVIOUS_SOURCE = "switch-input-source-backward"; |
1075 | -const char* const INPUT_SWITCH_KEY_NEXT_SOURCE = "switch-input-source"; |
1076 | - |
1077 | -const char* const INDICATOR_INTERFACE_ACTIONS = "org.gtk.Actions"; |
1078 | -const char* const INDICATOR_METHOD_ACTIVATE = "Activate"; |
1079 | -const char* const INDICATOR_SOUND_BUS_NAME = "com.canonical.indicator.sound"; |
1080 | -const char* const INDICATOR_SOUND_OBJECT_PATH = "/com/canonical/indicator/sound"; |
1081 | -const char* const INDICATOR_SOUND_ACTION_MUTE = "mute"; |
1082 | -const char* const INDICATOR_SOUND_ACTION_SCROLL = "scroll"; |
1083 | -const char* const INDICATOR_KEYBOARD_BUS_NAME = "com.canonical.indicator.keyboard"; |
1084 | -const char* const INDICATOR_KEYBOARD_OBJECT_PATH = "/com/canonical/indicator/keyboard"; |
1085 | -const char* const INDICATOR_KEYBOARD_ACTION_SCROLL = "locked_scroll"; |
1086 | - |
1087 | -void ActivateIndicator(std::string const& bus_name, |
1088 | - std::string const& object_path, |
1089 | - std::string const& action_name, |
1090 | - glib::Variant const& parameters = glib::Variant()) |
1091 | -{ |
1092 | - GVariantBuilder builder; |
1093 | - |
1094 | - g_variant_builder_init(&builder, G_VARIANT_TYPE("(sava{sv})")); |
1095 | - g_variant_builder_add(&builder, "s", action_name.c_str()); |
1096 | - |
1097 | - if (parameters) |
1098 | - g_variant_builder_add_parsed(&builder, "[%v]", static_cast<GVariant*>(parameters)); |
1099 | - else |
1100 | - g_variant_builder_add_parsed(&builder, "@av []"); |
1101 | - |
1102 | - g_variant_builder_add_parsed(&builder, "@a{sv} []"); |
1103 | - |
1104 | - auto proxy = std::make_shared<glib::DBusProxy>(bus_name, object_path, INDICATOR_INTERFACE_ACTIONS); |
1105 | - proxy->CallBegin(INDICATOR_METHOD_ACTIVATE, g_variant_builder_end(&builder), [proxy] (GVariant*, glib::Error const&) {}); |
1106 | -} |
1107 | - |
1108 | -void MuteIndicatorSound() |
1109 | -{ |
1110 | - ActivateIndicator(INDICATOR_SOUND_BUS_NAME, |
1111 | - INDICATOR_SOUND_OBJECT_PATH, |
1112 | - INDICATOR_SOUND_ACTION_MUTE); |
1113 | -} |
1114 | - |
1115 | -void ScrollIndicatorSound(int offset) |
1116 | -{ |
1117 | - ActivateIndicator(INDICATOR_SOUND_BUS_NAME, |
1118 | - INDICATOR_SOUND_OBJECT_PATH, |
1119 | - INDICATOR_SOUND_ACTION_SCROLL, |
1120 | - g_variant_new_int32(offset)); |
1121 | -} |
1122 | - |
1123 | -void ScrollIndicatorKeyboard(int offset) |
1124 | -{ |
1125 | - ActivateIndicator(INDICATOR_KEYBOARD_BUS_NAME, |
1126 | - INDICATOR_KEYBOARD_OBJECT_PATH, |
1127 | - INDICATOR_KEYBOARD_ACTION_SCROLL, |
1128 | - g_variant_new_int32(-offset)); |
1129 | -} |
1130 | - |
1131 | -void PowerAction(session::Manager::Ptr const& session, const char *action_key) |
1132 | -{ |
1133 | - glib::Object<GSettings> settings(g_settings_new(POWER_SCHEMA)); |
1134 | - auto const& action = glib::String(g_settings_get_string(settings, action_key)).Str(); |
1135 | - |
1136 | - if (action == "interactive") |
1137 | - session->shutdown_requested.emit(session->HasInhibitors()); |
1138 | - else if (action == "shutdown") |
1139 | - session->reboot_requested.emit(session->HasInhibitors()); |
1140 | - else if (action == "suspend") |
1141 | - session->Suspend(); |
1142 | - else if (action == "hibernate") |
1143 | - session->Hibernate(); |
1144 | - else if (action == "blank") |
1145 | - session->ScreenSaverActivate(); |
1146 | -} |
1147 | +DECLARE_LOGGER(logger, "unity.lockscreen.accelerator.controller"); |
1148 | + |
1149 | +const std::string MEDIA_KEYS_SCHEMA = "org.gnome.settings-daemon.plugins.media-keys"; |
1150 | +const std::vector<std::string> ALLOWED_MEDIA_KEYS = { |
1151 | + "logout", |
1152 | + "magnifier", |
1153 | + "on-screen-keyboard", |
1154 | + "magnifier-zoom-in", |
1155 | + "screenreader", |
1156 | + "pause", |
1157 | + "stop", |
1158 | + "toggle-contrast", |
1159 | + "video-out", |
1160 | + "volume-down", |
1161 | + "volume-mute", |
1162 | + "volume-up", |
1163 | +}; |
1164 | + |
1165 | +const std::string WM_KEYS_SCHEMA = "org.gnome.desktop.wm.keybindings"; |
1166 | +const std::vector<std::string> ALLOWED_WM_KEYS = { |
1167 | + "switch-input-source", |
1168 | + "switch-input-source-backward", |
1169 | +}; |
1170 | + |
1171 | +const std::vector<std::string> ALLOWED_XF86_KEYS = { |
1172 | + "XF86ScreenSaver", |
1173 | + "XF86Sleep", |
1174 | + "XF86Standby", |
1175 | + "XF86Suspend", |
1176 | + "XF86Hibernate", |
1177 | + "XF86PowerOff", |
1178 | + "XF86MonBrightnessUp", |
1179 | + "XF86MonBrightnessDown", |
1180 | + "XF86KbdBrightnessUp", |
1181 | + "XF86KbdBrightnessDown", |
1182 | + "XF86KbdLightOnOff", |
1183 | + "XF86AudioMicMute", |
1184 | + "XF86Touchpad", |
1185 | +}; |
1186 | + |
1187 | +bool IsSettingKeyAvailable(glib::Object<GSettings> const& settings, std::string const& key) |
1188 | +{ |
1189 | + bool available = false; |
1190 | + GSettingsSchema* schema; |
1191 | + |
1192 | + g_object_get(glib::object_cast<GObject>(settings), "settings-schema", &schema, nullptr); |
1193 | + |
1194 | + if (schema) |
1195 | + { |
1196 | + available = g_settings_schema_has_key(schema, key.c_str()); |
1197 | + g_settings_schema_unref(schema); |
1198 | + } |
1199 | + |
1200 | + return available; |
1201 | +} |
1202 | + |
1203 | +bool IsKeyBindingAllowed(std::string const& key) |
1204 | +{ |
1205 | + if (std::find(begin(ALLOWED_XF86_KEYS), end(ALLOWED_XF86_KEYS), key) != end(ALLOWED_XF86_KEYS)) |
1206 | + return true; |
1207 | + |
1208 | + glib::Object<GSettings> media_settings(g_settings_new(MEDIA_KEYS_SCHEMA.c_str())); |
1209 | + Accelerator key_accelerator(key); |
1210 | + |
1211 | + for (auto const& setting : ALLOWED_MEDIA_KEYS) |
1212 | + { |
1213 | + if (!IsSettingKeyAvailable(media_settings, setting)) |
1214 | + continue; |
1215 | + |
1216 | + Accelerator media_key(glib::String(g_settings_get_string(media_settings, setting.c_str())).Str()); |
1217 | + if (media_key == key_accelerator) |
1218 | + return true; |
1219 | + } |
1220 | + |
1221 | + glib::Object<GSettings> wm_settings(g_settings_new(WM_KEYS_SCHEMA.c_str())); |
1222 | + |
1223 | + for (auto const& setting : ALLOWED_WM_KEYS) |
1224 | + { |
1225 | + if (!IsSettingKeyAvailable(wm_settings, setting)) |
1226 | + continue; |
1227 | + |
1228 | + glib::Variant accels(g_settings_get_value(wm_settings, setting.c_str()), glib::StealRef()); |
1229 | + auto children = g_variant_n_children(accels); |
1230 | + |
1231 | + if (children > 0) |
1232 | + { |
1233 | + glib::String value; |
1234 | + |
1235 | + for (auto i = 0u; i < children; ++i) |
1236 | + { |
1237 | + g_variant_get_child(accels, 0, "s", &value); |
1238 | + |
1239 | + if (Accelerator(value.Str()) == key_accelerator) |
1240 | + return true; |
1241 | + } |
1242 | + } |
1243 | + } |
1244 | + |
1245 | + return false; |
1246 | +} |
1247 | + |
1248 | } // namespace |
1249 | |
1250 | -AcceleratorController::AcceleratorController(session::Manager::Ptr const& session) |
1251 | +AcceleratorController::AcceleratorController(key::Grabber::Ptr const& key_grabber) |
1252 | : accelerators_(new Accelerators) |
1253 | { |
1254 | - auto settings = glib::Object<GSettings>(g_settings_new(MEDIA_KEYS_SCHEMA)); |
1255 | - |
1256 | - auto accelerator = std::make_shared<Accelerator>(glib::String(g_settings_get_string(settings, MEDIA_KEYS_KEY_VOLUME_MUTE))); |
1257 | - accelerator->activated.connect(std::function<void()>(MuteIndicatorSound)); |
1258 | - accelerators_->Add(accelerator); |
1259 | - |
1260 | - accelerator = std::make_shared<Accelerator>(glib::String(g_settings_get_string(settings, MEDIA_KEYS_KEY_VOLUME_DOWN))); |
1261 | - accelerator->activated.connect(std::bind(ScrollIndicatorSound, -1)); |
1262 | - accelerators_->Add(accelerator); |
1263 | - |
1264 | - accelerator = std::make_shared<Accelerator>(glib::String(g_settings_get_string(settings, MEDIA_KEYS_KEY_VOLUME_UP))); |
1265 | - accelerator->activated.connect(std::bind(ScrollIndicatorSound, +1)); |
1266 | - accelerators_->Add(accelerator); |
1267 | - |
1268 | - accelerator = std::make_shared<Accelerator>(POWER_KEY_SUSPEND); |
1269 | - accelerator->activated.connect(std::bind(PowerAction, session, SUSPEND_BUTTON_ACTION_KEY)); |
1270 | - accelerators_->Add(accelerator); |
1271 | - |
1272 | - accelerator = std::make_shared<Accelerator>(POWER_KEY_SLEEP); |
1273 | - accelerator->activated.connect(std::bind(PowerAction, session, SLEEP_BUTTON_ACTION_KEY)); |
1274 | - accelerators_->Add(accelerator); |
1275 | - |
1276 | - accelerator = std::make_shared<Accelerator>(POWER_KEY_HIBERNATE); |
1277 | - accelerator->activated.connect(std::bind(PowerAction, session, HIBERNATE_BUTTON_ACTION_KEY)); |
1278 | - accelerators_->Add(accelerator); |
1279 | - |
1280 | - accelerator = std::make_shared<Accelerator>(POWER_KEY_POWEROFF); |
1281 | - accelerator->activated.connect(std::bind(PowerAction, session, POWER_BUTTON_ACTION_KEY)); |
1282 | - accelerators_->Add(accelerator); |
1283 | - |
1284 | - settings = glib::Object<GSettings>(g_settings_new(INPUT_SWITCH_SCHEMA)); |
1285 | - |
1286 | - auto variant = glib::Variant(g_settings_get_value(settings, INPUT_SWITCH_KEY_PREVIOUS_SOURCE), glib::StealRef()); |
1287 | - |
1288 | - if (g_variant_n_children(variant) > 0) |
1289 | - { |
1290 | - const gchar* string; |
1291 | - |
1292 | - g_variant_get_child(variant, 0, "&s", &string); |
1293 | - |
1294 | - accelerator = std::make_shared<Accelerator>(string); |
1295 | - accelerator->activated.connect(std::bind(ScrollIndicatorKeyboard, -1)); |
1296 | - accelerators_->Add(accelerator); |
1297 | - } |
1298 | - |
1299 | - variant = glib::Variant(g_settings_get_value(settings, INPUT_SWITCH_KEY_NEXT_SOURCE), glib::StealRef()); |
1300 | - |
1301 | - if (g_variant_n_children(variant) > 0) |
1302 | - { |
1303 | - const gchar* string; |
1304 | - |
1305 | - g_variant_get_child(variant, 0, "&s", &string); |
1306 | - |
1307 | - accelerator = std::make_shared<Accelerator>(string); |
1308 | - accelerator->activated.connect(std::bind(ScrollIndicatorKeyboard, +1)); |
1309 | - accelerators_->Add(accelerator); |
1310 | - } |
1311 | + for (auto const& action : key_grabber->GetActions()) |
1312 | + AddAction(action); |
1313 | + |
1314 | + key_grabber->action_added.connect(sigc::mem_fun(this, &AcceleratorController::AddAction)); |
1315 | + key_grabber->action_removed.connect(sigc::mem_fun(this, &AcceleratorController::RemoveAction)); |
1316 | +} |
1317 | + |
1318 | +void AcceleratorController::AddAction(CompAction const& action) |
1319 | +{ |
1320 | + if (action.type() != CompAction::BindingTypeKey) |
1321 | + return; |
1322 | + |
1323 | + auto const& key = action.keyToString(); |
1324 | + |
1325 | + if (!IsKeyBindingAllowed(key)) |
1326 | + { |
1327 | + LOG_DEBUG(logger) << "Action not allowed " << key; |
1328 | + return; |
1329 | + } |
1330 | + |
1331 | + auto accelerator = std::make_shared<Accelerator>(key); |
1332 | + accelerator->activated.connect(sigc::bind(sigc::mem_fun(this, &AcceleratorController::OnActionActivated), action)); |
1333 | + accelerators_->Add(accelerator); |
1334 | + actions_accelerators_.push_back({action, accelerator}); |
1335 | + |
1336 | + LOG_DEBUG(logger) << "Action added " << key; |
1337 | +} |
1338 | + |
1339 | +void AcceleratorController::RemoveAction(CompAction const& action) |
1340 | +{ |
1341 | + if (action.type() != CompAction::BindingTypeKey) |
1342 | + return; |
1343 | + |
1344 | + LOG_DEBUG(logger) << "Removing action " << action.keyToString(); |
1345 | + |
1346 | + for (auto it = begin(actions_accelerators_); it != end(actions_accelerators_);) |
1347 | + { |
1348 | + if (it->first == action) |
1349 | + { |
1350 | + accelerators_->Remove(it->second); |
1351 | + it = actions_accelerators_.erase(it); |
1352 | + } |
1353 | + else |
1354 | + { |
1355 | + ++it; |
1356 | + } |
1357 | + } |
1358 | +} |
1359 | + |
1360 | +void AcceleratorController::OnActionActivated(CompAction& action) |
1361 | +{ |
1362 | + LOG_DEBUG(logger) << "Activating action " << action.keyToString(); |
1363 | + |
1364 | + CompOption::Vector options; |
1365 | + |
1366 | + if (action.state() & CompAction::StateInitKey) |
1367 | + action.initiate()(&action, 0, options); |
1368 | + |
1369 | + if (action.state() & CompAction::StateTermKey) |
1370 | + action.terminate()(&action, CompAction::StateTermTapped, options); |
1371 | } |
1372 | |
1373 | Accelerators::Ptr const& AcceleratorController::GetAccelerators() const |
1374 | |
1375 | === modified file 'lockscreen/LockScreenAcceleratorController.h' |
1376 | --- lockscreen/LockScreenAcceleratorController.h 2016-03-31 09:51:33 +0000 |
1377 | +++ lockscreen/LockScreenAcceleratorController.h 2016-07-15 10:12:55 +0000 |
1378 | @@ -20,7 +20,7 @@ |
1379 | #ifndef UNITY_LOCKSCREEN_ACCELERATOR_CONTROLLER |
1380 | #define UNITY_LOCKSCREEN_ACCELERATOR_CONTROLLER |
1381 | |
1382 | -#include "UnityCore/SessionManager.h" |
1383 | +#include "unity-shared/KeyGrabber.h" |
1384 | #include "LockScreenAccelerators.h" |
1385 | |
1386 | namespace unity |
1387 | @@ -28,16 +28,21 @@ |
1388 | namespace lockscreen |
1389 | { |
1390 | |
1391 | -class AcceleratorController |
1392 | +class AcceleratorController : public sigc::trackable |
1393 | { |
1394 | public: |
1395 | typedef std::shared_ptr<AcceleratorController> Ptr; |
1396 | |
1397 | - AcceleratorController(session::Manager::Ptr const&); |
1398 | + AcceleratorController(key::Grabber::Ptr const&); |
1399 | |
1400 | Accelerators::Ptr const& GetAccelerators() const; |
1401 | |
1402 | private: |
1403 | + void AddAction(CompAction const&); |
1404 | + void RemoveAction(CompAction const&); |
1405 | + void OnActionActivated(CompAction&); |
1406 | + |
1407 | + std::vector<std::pair<CompAction, Accelerator::Ptr>> actions_accelerators_; |
1408 | Accelerators::Ptr accelerators_; |
1409 | }; |
1410 | |
1411 | |
1412 | === modified file 'lockscreen/LockScreenAccelerators.cpp' |
1413 | --- lockscreen/LockScreenAccelerators.cpp 2014-04-30 04:34:40 +0000 |
1414 | +++ lockscreen/LockScreenAccelerators.cpp 2016-07-15 10:12:55 +0000 |
1415 | @@ -417,6 +417,11 @@ |
1416 | { |
1417 | } |
1418 | |
1419 | +Accelerators::Vector Accelerators::GetAccelerators() const |
1420 | +{ |
1421 | + return accelerators_; |
1422 | +} |
1423 | + |
1424 | void Accelerators::Clear() |
1425 | { |
1426 | accelerators_.clear(); |
1427 | |
1428 | === modified file 'lockscreen/LockScreenAccelerators.h' |
1429 | --- lockscreen/LockScreenAccelerators.h 2014-05-12 19:28:48 +0000 |
1430 | +++ lockscreen/LockScreenAccelerators.h 2016-07-15 10:12:55 +0000 |
1431 | @@ -69,9 +69,11 @@ |
1432 | { |
1433 | public: |
1434 | typedef std::shared_ptr<Accelerators> Ptr; |
1435 | + typedef std::vector<Accelerator::Ptr> Vector; |
1436 | |
1437 | Accelerators(); |
1438 | |
1439 | + Accelerators::Vector GetAccelerators() const; |
1440 | void Clear(); |
1441 | |
1442 | void Add(Accelerator::Ptr const& accelerator); |
1443 | @@ -83,7 +85,7 @@ |
1444 | unsigned int modifiers); |
1445 | |
1446 | private: |
1447 | - std::vector<Accelerator::Ptr> accelerators_; |
1448 | + Accelerators::Vector accelerators_; |
1449 | |
1450 | PressedState pressed_state_; |
1451 | }; |
1452 | |
1453 | === added file 'lockscreen/LockScreenButton.cpp' |
1454 | --- lockscreen/LockScreenButton.cpp 1970-01-01 00:00:00 +0000 |
1455 | +++ lockscreen/LockScreenButton.cpp 2016-07-15 10:12:55 +0000 |
1456 | @@ -0,0 +1,148 @@ |
1457 | +/* |
1458 | + * Copyright 2016 Canonical Ltd. |
1459 | + * |
1460 | + * This program is free software: you can redistribute it and/or modify it |
1461 | + * under the terms of the GNU Lesser General Public License version 3, as |
1462 | + * published by the Free Software Foundation. |
1463 | + * |
1464 | + * This program is distributed in the hope that it will be useful, but |
1465 | + * WITHOUT ANY WARRANTY; without even the implied warranties of |
1466 | + * MERCHANTABILITY, SATISFACTORY QUALITY or FITNESS FOR A PARTICULAR |
1467 | + * PURPOSE. See the applicable version of the GNU Lesser General Public |
1468 | + * License for more details. |
1469 | + * |
1470 | + * You should have received a copy of both the GNU Lesser General Public |
1471 | + * License version 3 along with this program. If not, see |
1472 | + * <http://www.gnu.org/licenses/> |
1473 | + * |
1474 | + * Authored by: Andrea Azzarone <andrea.azzarone@canonical.com> |
1475 | + * |
1476 | + */ |
1477 | + |
1478 | +#include "LockScreenButton.h" |
1479 | + |
1480 | +#include <Nux/HLayout.h> |
1481 | + |
1482 | +#include "unity-shared/DashStyle.h" |
1483 | +#include "unity-shared/IconTexture.h" |
1484 | +#include "LockScreenSettings.h" |
1485 | + |
1486 | +namespace unity |
1487 | +{ |
1488 | +namespace lockscreen |
1489 | +{ |
1490 | + |
1491 | +namespace |
1492 | +{ |
1493 | +const RawPixel HLAYOUT_RIGHT_PADDING = 10_em; |
1494 | +const int FONT_PX_SIZE = 17; |
1495 | +} |
1496 | + |
1497 | +NUX_IMPLEMENT_OBJECT_TYPE(LockScreenButton); |
1498 | + |
1499 | +LockScreenButton::LockScreenButton(std::string const& label, NUX_FILE_LINE_DECL) |
1500 | + : nux::Button(NUX_FILE_LINE_PARAM) |
1501 | + , scale(1.0) |
1502 | + , label_(label) |
1503 | +{ |
1504 | + hlayout_ = new nux::HLayout(NUX_TRACKER_LOCATION); |
1505 | + hlayout_->SetLeftAndRightPadding(0, HLAYOUT_RIGHT_PADDING.CP(scale)); |
1506 | + hlayout_->SetContentDistribution(nux::MAJOR_POSITION_END); |
1507 | + SetLayout(hlayout_); |
1508 | + |
1509 | + activator_ = new IconTexture(dash::Style::Instance().GetLockScreenActivator(scale())); |
1510 | + hlayout_->AddView(activator_, 0, nux::MINOR_POSITION_CENTER, nux::MINOR_SIZE_FULL); |
1511 | + |
1512 | + InitTheme(); |
1513 | + |
1514 | + scale.changed.connect([this] (double scale) { |
1515 | + activator_->SetTexture(dash::Style::Instance().GetLockScreenActivator(scale)); |
1516 | + hlayout_->SetLeftAndRightPadding(0, HLAYOUT_RIGHT_PADDING.CP(scale)); |
1517 | + InitTheme(); |
1518 | + }); |
1519 | + |
1520 | + key_down.connect([this] (unsigned long, unsigned long, unsigned long, const char*, unsigned short) { |
1521 | + state_change.emit(this); |
1522 | + }); |
1523 | +} |
1524 | + |
1525 | +void LockScreenButton::InitTheme() |
1526 | +{ |
1527 | + SetMinimumHeight(Settings::GRID_SIZE.CP(scale)); |
1528 | + SetMaximumHeight(Settings::GRID_SIZE.CP(scale)); |
1529 | + |
1530 | + nux::Geometry const& geo = GetGeometry(); |
1531 | + normal_.reset(new nux::CairoWrapper(geo, sigc::mem_fun(this, &LockScreenButton::RedrawTheme))); |
1532 | +} |
1533 | + |
1534 | +void LockScreenButton::RedrawTheme(nux::Geometry const& geom, cairo_t* cr) |
1535 | +{ |
1536 | + cairo_surface_set_device_scale(cairo_get_target(cr), scale, scale); |
1537 | + dash::Style::Instance().LockScreenButton(cr, label_, FONT_PX_SIZE); |
1538 | +} |
1539 | + |
1540 | +long LockScreenButton::ComputeContentSize() |
1541 | +{ |
1542 | + long ret = nux::Button::ComputeContentSize(); |
1543 | + nux::Geometry const& geo = GetGeometry(); |
1544 | + |
1545 | + if (cached_geometry_ != geo) |
1546 | + { |
1547 | + normal_->Invalidate(geo); |
1548 | + cached_geometry_ = geo; |
1549 | + } |
1550 | + |
1551 | + return ret; |
1552 | +} |
1553 | + |
1554 | +void LockScreenButton::DrawContent(nux::GraphicsEngine& GfxContext, bool force_draw) |
1555 | +{ |
1556 | + if (IsFullRedraw()) |
1557 | + { |
1558 | + GfxContext.PushClippingRectangle(GetGeometry()); |
1559 | + hlayout_->ProcessDraw(GfxContext, force_draw); |
1560 | + GfxContext.PopClippingRectangle(); |
1561 | + } |
1562 | +} |
1563 | + |
1564 | +void LockScreenButton::Draw(nux::GraphicsEngine& GfxContext, bool force_draw) |
1565 | +{ |
1566 | + nux::Geometry const& geo = GetGeometry(); |
1567 | + GfxContext.PushClippingRectangle(geo); |
1568 | + gPainter.PaintBackground(GfxContext, geo); |
1569 | + |
1570 | + nux::TexCoordXForm texxform; |
1571 | + texxform.SetWrap(nux::TEXWRAP_CLAMP, nux::TEXWRAP_CLAMP); |
1572 | + texxform.SetTexCoordType(nux::TexCoordXForm::OFFSET_COORD); |
1573 | + |
1574 | + unsigned int alpha = 0, src = 0, dest = 0; |
1575 | + GfxContext.GetRenderStates().GetBlend(alpha, src, dest); |
1576 | + GfxContext.GetRenderStates().SetPremultipliedBlend(nux::SRC_OVER); |
1577 | + GfxContext.GetRenderStates().SetBlend(true); |
1578 | + |
1579 | + nux::Color col(nux::color::Black); |
1580 | + col.alpha = 0; |
1581 | + GfxContext.QRP_Color(geo.x, geo.y, |
1582 | + geo.width, geo.height, |
1583 | + col); |
1584 | + |
1585 | + nux::BaseTexture* texture = normal_->GetTexture(); |
1586 | + GfxContext.QRP_1Tex(geo.x, geo.y, |
1587 | + texture->GetWidth(), texture->GetHeight(), |
1588 | + texture->GetDeviceTexture(), |
1589 | + texxform, nux::color::White); |
1590 | + |
1591 | + GfxContext.GetRenderStates().SetBlend(alpha, src, dest); |
1592 | + GfxContext.PopClippingRectangle(); |
1593 | +} |
1594 | + |
1595 | +bool LockScreenButton::InspectKeyEvent(unsigned int eventType, unsigned int key_sym, const char* character) |
1596 | +{ |
1597 | + if ((eventType == nux::NUX_KEYDOWN) && (key_sym == NUX_VK_ENTER)) |
1598 | + return true; |
1599 | + else |
1600 | + return false; |
1601 | +} |
1602 | + |
1603 | +} // namespace lockscreen |
1604 | +} // namespace unity |
1605 | \ No newline at end of file |
1606 | |
1607 | === added file 'lockscreen/LockScreenButton.h' |
1608 | --- lockscreen/LockScreenButton.h 1970-01-01 00:00:00 +0000 |
1609 | +++ lockscreen/LockScreenButton.h 2016-07-15 10:12:55 +0000 |
1610 | @@ -0,0 +1,70 @@ |
1611 | +/* |
1612 | + * Copyright 2016 Canonical Ltd. |
1613 | + * |
1614 | + * This program is free software: you can redistribute it and/or modify it |
1615 | + * under the terms of the GNU Lesser General Public License version 3, as |
1616 | + * published by the Free Software Foundation. |
1617 | + * |
1618 | + * This program is distributed in the hope that it will be useful, but |
1619 | + * WITHOUT ANY WARRANTY; without even the implied warranties of |
1620 | + * MERCHANTABILITY, SATISFACTORY QUALITY or FITNESS FOR A PARTICULAR |
1621 | + * PURPOSE. See the applicable version of the GNU Lesser General Public |
1622 | + * License for more details. |
1623 | + * |
1624 | + * You should have received a copy of both the GNU Lesser General Public |
1625 | + * License version 3 along with this program. If not, see |
1626 | + * <http://www.gnu.org/licenses/> |
1627 | + * |
1628 | + * Authored by: Andrea Azzarone <andrea.azzarone@canonical.com> |
1629 | + * |
1630 | + */ |
1631 | + |
1632 | +#ifndef UNITY_LOCKSCREEN_BUTTON_H |
1633 | +#define UNITY_LOCKSCREEN_BUTTON_H |
1634 | + |
1635 | +#include <Nux/Nux.h> |
1636 | +#include <Nux/Button.h> |
1637 | +#include <Nux/CairoWrapper.h> |
1638 | + |
1639 | +namespace unity |
1640 | +{ |
1641 | + |
1642 | +class IconTexture; |
1643 | + |
1644 | +namespace lockscreen |
1645 | +{ |
1646 | + |
1647 | +class LockScreenButton : public nux::Button |
1648 | +{ |
1649 | + NUX_DECLARE_OBJECT_TYPE(LockScreenButton, nux::Button); |
1650 | + |
1651 | +public: |
1652 | + LockScreenButton(std::string const&, NUX_FILE_LINE_PROTO); |
1653 | + |
1654 | + nux::Property<double> scale; |
1655 | + |
1656 | +protected: |
1657 | + long ComputeContentSize() override; |
1658 | + void Draw(nux::GraphicsEngine&, bool) override; |
1659 | + void DrawContent(nux::GraphicsEngine&, bool) override; |
1660 | + bool InspectKeyEvent(unsigned int eventType, unsigned int key_sym, const char* character) override; |
1661 | + |
1662 | +private: |
1663 | + void InitTheme(); |
1664 | + void RedrawTheme(nux::Geometry const&, cairo_t*); |
1665 | + |
1666 | + typedef std::unique_ptr<nux::CairoWrapper> NuxCairoPtr; |
1667 | + |
1668 | + std::string label_; |
1669 | + nux::Geometry cached_geometry_; |
1670 | + |
1671 | + NuxCairoPtr normal_; |
1672 | + |
1673 | + nux::HLayout* hlayout_; |
1674 | + IconTexture* activator_; |
1675 | +}; |
1676 | + |
1677 | +} // namespace lockscreen |
1678 | +} // namespace unity |
1679 | + |
1680 | +#endif |
1681 | |
1682 | === modified file 'lockscreen/LockScreenController.cpp' |
1683 | --- lockscreen/LockScreenController.cpp 2016-04-15 05:32:41 +0000 |
1684 | +++ lockscreen/LockScreenController.cpp 2016-07-15 10:12:55 +0000 |
1685 | @@ -28,6 +28,7 @@ |
1686 | #include "LockScreenShield.h" |
1687 | #include "LockScreenSettings.h" |
1688 | #include "unity-shared/AnimationUtils.h" |
1689 | +#include "unity-shared/UnitySettings.h" |
1690 | #include "unity-shared/UScreen.h" |
1691 | #include "unity-shared/WindowManager.h" |
1692 | |
1693 | @@ -54,16 +55,18 @@ |
1694 | |
1695 | Controller::Controller(DBusManager::Ptr const& dbus_manager, |
1696 | session::Manager::Ptr const& session_manager, |
1697 | + key::Grabber::Ptr const& key_grabber, |
1698 | UpstartWrapper::Ptr const& upstart_wrapper, |
1699 | ShieldFactoryInterface::Ptr const& shield_factory, |
1700 | bool test_mode) |
1701 | : opacity([this] { return fade_animator_.GetCurrentValue(); }) |
1702 | , dbus_manager_(dbus_manager) |
1703 | , session_manager_(session_manager) |
1704 | + , key_grabber_(key_grabber) |
1705 | , upstart_wrapper_(upstart_wrapper) |
1706 | , shield_factory_(shield_factory) |
1707 | , suspend_inhibitor_manager_(std::make_shared<SuspendInhibitorManager>()) |
1708 | - , fade_animator_(LOCK_FADE_DURATION) |
1709 | + , fade_animator_(unity::Settings::Instance().low_gfx() ? 0 : LOCK_FADE_DURATION) |
1710 | , blank_window_animator_(IDLE_FADE_DURATION) |
1711 | , test_mode_(test_mode) |
1712 | , prompt_activation_(false) |
1713 | @@ -81,6 +84,7 @@ |
1714 | }); |
1715 | hidden_window_connection_->block(); |
1716 | |
1717 | + suspend_inhibitor_manager_->connected.connect(sigc::mem_fun(this, &Controller::SyncInhibitor)); |
1718 | suspend_inhibitor_manager_->about_to_suspend.connect([this] () { |
1719 | if (Settings::Instance().lock_on_suspend()) |
1720 | session_manager_->PromptLockScreen(); |
1721 | @@ -88,7 +92,9 @@ |
1722 | |
1723 | Settings::Instance().lock_on_suspend.changed.connect(sigc::hide(sigc::mem_fun(this, &Controller::SyncInhibitor))); |
1724 | Settings::Instance().use_legacy.changed.connect(sigc::hide(sigc::mem_fun(this, &Controller::SyncInhibitor))); |
1725 | - suspend_inhibitor_manager_->connected.connect(sigc::mem_fun(this, &Controller::SyncInhibitor)); |
1726 | + unity::Settings::Instance().low_gfx.changed.connect(sigc::track_obj([this] (bool low_gfx) { |
1727 | + fade_animator_.SetDuration(low_gfx ? 0 : LOCK_FADE_DURATION); |
1728 | + }, *this)); |
1729 | |
1730 | dbus_manager_->simulate_activity.connect(sigc::mem_fun(this, &Controller::SimulateActivity)); |
1731 | session_manager_->screensaver_requested.connect(sigc::mem_fun(this, &Controller::OnScreenSaverActivationRequest)); |
1732 | @@ -459,7 +465,7 @@ |
1733 | indicators_ = std::make_shared<indicator::LockScreenDBusIndicators>(); |
1734 | upstart_wrapper_->Emit("desktop-lock"); |
1735 | |
1736 | - accelerator_controller_ = std::make_shared<AcceleratorController>(session_manager_); |
1737 | + accelerator_controller_ = std::make_shared<AcceleratorController>(key_grabber_); |
1738 | auto activate_key = WindowManager::Default().activate_indicators_key(); |
1739 | auto accelerator = std::make_shared<Accelerator>(activate_key.second, 0, activate_key.first); |
1740 | accelerator->activated.connect(std::bind(std::mem_fn(&Controller::ActivatePanel), this)); |
1741 | |
1742 | === modified file 'lockscreen/LockScreenController.h' |
1743 | --- lockscreen/LockScreenController.h 2016-03-31 09:59:30 +0000 |
1744 | +++ lockscreen/LockScreenController.h 2016-07-15 10:12:55 +0000 |
1745 | @@ -30,6 +30,7 @@ |
1746 | #include "SuspendInhibitorManager.h" |
1747 | #include "ScreenSaverDBusManager.h" |
1748 | #include "unity-shared/BackgroundEffectHelper.h" |
1749 | +#include "unity-shared/KeyGrabber.h" |
1750 | #include "unity-shared/UpstartWrapper.h" |
1751 | |
1752 | namespace unity |
1753 | @@ -44,7 +45,7 @@ |
1754 | public: |
1755 | typedef std::shared_ptr<Controller> Ptr; |
1756 | |
1757 | - Controller(DBusManager::Ptr const&, session::Manager::Ptr const&, |
1758 | + Controller(DBusManager::Ptr const&, session::Manager::Ptr const&, key::Grabber::Ptr const&, |
1759 | UpstartWrapper::Ptr const& upstart_wrapper = std::make_shared<UpstartWrapper>(), |
1760 | ShieldFactoryInterface::Ptr const& shield_factory = std::make_shared<ShieldFactory>(), |
1761 | bool test_mode = false); |
1762 | @@ -84,6 +85,7 @@ |
1763 | |
1764 | DBusManager::Ptr dbus_manager_; |
1765 | session::Manager::Ptr session_manager_; |
1766 | + key::Grabber::Ptr key_grabber_; |
1767 | indicator::Indicators::Ptr indicators_; |
1768 | AcceleratorController::Ptr accelerator_controller_; |
1769 | UpstartWrapper::Ptr upstart_wrapper_; |
1770 | |
1771 | === modified file 'lockscreen/UserAuthenticatorPam.cpp' |
1772 | --- lockscreen/UserAuthenticatorPam.cpp 2014-05-27 07:54:04 +0000 |
1773 | +++ lockscreen/UserAuthenticatorPam.cpp 2016-07-15 10:12:55 +0000 |
1774 | @@ -22,6 +22,7 @@ |
1775 | // let's just fallcback to lightdm. |
1776 | |
1777 | #include "UserAuthenticatorPam.h" |
1778 | +#include "unity-shared/UnitySettings.h" |
1779 | |
1780 | #include <cstring> |
1781 | #include <security/pam_appl.h> |
1782 | @@ -52,13 +53,21 @@ |
1783 | |
1784 | g_task_run_in_thread(task, [] (GTask* task, gpointer, gpointer data, GCancellable*) { |
1785 | auto self = static_cast<UserAuthenticatorPam*>(data); |
1786 | + |
1787 | self->status_ = pam_authenticate(self->pam_handle_, 0); |
1788 | - if (self->status_ == PAM_SUCCESS) |
1789 | - self->status_ = pam_acct_mgmt(self->pam_handle_, 0); |
1790 | - if (self->status_ == PAM_NEW_AUTHTOK_REQD) |
1791 | - self->status_ = pam_chauthtok(self->pam_handle_, PAM_CHANGE_EXPIRED_AUTHTOK); |
1792 | - if (self->status_ == PAM_SUCCESS) |
1793 | + |
1794 | + if (self->status_ == PAM_SUCCESS) |
1795 | + { |
1796 | + int status2 = pam_acct_mgmt(self->pam_handle_, 0); |
1797 | + |
1798 | + if (status2 == PAM_NEW_AUTHTOK_REQD) |
1799 | + status2 = pam_chauthtok(self->pam_handle_, PAM_CHANGE_EXPIRED_AUTHTOK); |
1800 | + |
1801 | + if (unity::Settings::Instance().pam_check_account_type()) |
1802 | + self->status_ = status2; |
1803 | + |
1804 | pam_setcred (self->pam_handle_, PAM_REINITIALIZE_CRED); |
1805 | + } |
1806 | }); |
1807 | |
1808 | return true; |
1809 | |
1810 | === modified file 'lockscreen/UserPromptView.cpp' |
1811 | --- lockscreen/UserPromptView.cpp 2016-03-16 10:47:16 +0000 |
1812 | +++ lockscreen/UserPromptView.cpp 2016-07-15 10:12:55 +0000 |
1813 | @@ -26,6 +26,7 @@ |
1814 | #include <Nux/VLayout.h> |
1815 | |
1816 | #include "LockScreenSettings.h" |
1817 | +#include "LockScreenButton.h" |
1818 | #include "unity-shared/CairoTexture.h" |
1819 | #include "unity-shared/TextInput.h" |
1820 | #include "unity-shared/StaticCairoText.h" |
1821 | @@ -41,6 +42,7 @@ |
1822 | const RawPixel LAYOUT_MARGIN = 10_em; |
1823 | const RawPixel MSG_LAYOUT_MARGIN = 15_em; |
1824 | const RawPixel PROMPT_LAYOUT_MARGIN = 5_em; |
1825 | +const RawPixel BUTTON_LAYOUT_MARGIN = 5_em; |
1826 | const int PROMPT_FONT_SIZE = 13; |
1827 | |
1828 | nux::AbstractPaintLayer* CrateBackgroundLayer(double width, double height, double scale) |
1829 | @@ -105,20 +107,29 @@ |
1830 | , username_(nullptr) |
1831 | , msg_layout_(nullptr) |
1832 | , prompt_layout_(nullptr) |
1833 | + , button_layout_(nullptr) |
1834 | + , prompted_(false) |
1835 | + , unacknowledged_messages_(false) |
1836 | { |
1837 | user_authenticator_.echo_on_requested.connect([this](std::string const& message, PromiseAuthCodePtr const& promise){ |
1838 | + prompted_ = true; |
1839 | + unacknowledged_messages_ = false; |
1840 | AddPrompt(message, /* visible */ true, promise); |
1841 | }); |
1842 | |
1843 | user_authenticator_.echo_off_requested.connect([this](std::string const& message, PromiseAuthCodePtr const& promise){ |
1844 | + prompted_ = true; |
1845 | + unacknowledged_messages_ = false; |
1846 | AddPrompt(message, /* visible */ false, promise); |
1847 | }); |
1848 | |
1849 | user_authenticator_.message_requested.connect([this](std::string const& message){ |
1850 | + unacknowledged_messages_ = true; |
1851 | AddMessage(message, nux::color::White); |
1852 | }); |
1853 | |
1854 | user_authenticator_.error_requested.connect([this](std::string const& message){ |
1855 | + unacknowledged_messages_ = true; |
1856 | AddMessage(message, nux::color::Red); |
1857 | }); |
1858 | |
1859 | @@ -131,8 +142,7 @@ |
1860 | UpdateSize(); |
1861 | ResetLayout(); |
1862 | |
1863 | - user_authenticator_.AuthenticateStart(session_manager_->UserName(), |
1864 | - sigc::mem_fun(this, &UserPromptView::AuthenticationCb)); |
1865 | + StartAuthentication(); |
1866 | } |
1867 | |
1868 | void UserPromptView::UpdateSize() |
1869 | @@ -178,6 +188,19 @@ |
1870 | } |
1871 | } |
1872 | |
1873 | + if (button_layout_) |
1874 | + { |
1875 | + button_layout_->SetVerticalInternalMargin(BUTTON_LAYOUT_MARGIN.CP(scale)); |
1876 | + |
1877 | + for (auto* area : button_layout_->GetChildren()) |
1878 | + { |
1879 | + auto* button = static_cast<LockScreenButton*>(area); |
1880 | + button->SetMinimumHeight(Settings::GRID_SIZE.CP(scale)); |
1881 | + button->SetMaximumHeight(Settings::GRID_SIZE.CP(scale)); |
1882 | + button->scale = scale(); |
1883 | + } |
1884 | + } |
1885 | + |
1886 | bg_layer_.reset(); |
1887 | |
1888 | ComputeContentSize(); |
1889 | @@ -200,8 +223,13 @@ |
1890 | |
1891 | void UserPromptView::ResetLayout() |
1892 | { |
1893 | + bool keep_msg_layout = msg_layout_ && (!prompted_ || unacknowledged_messages_); |
1894 | + |
1895 | focus_queue_.clear(); |
1896 | |
1897 | + if (keep_msg_layout) |
1898 | + msg_layout_->Reference(); |
1899 | + |
1900 | SetLayout(new nux::VLayout()); |
1901 | |
1902 | GetLayout()->SetLeftAndRightPadding(PADDING.CP(scale)); |
1903 | @@ -216,34 +244,54 @@ |
1904 | username_->SetFont("Ubuntu "+std::to_string(PROMPT_FONT_SIZE)); |
1905 | GetLayout()->AddView(username_); |
1906 | |
1907 | - msg_layout_ = new nux::VLayout(); |
1908 | - msg_layout_->SetVerticalInternalMargin(MSG_LAYOUT_MARGIN.CP(scale)); |
1909 | - msg_layout_->SetReconfigureParentLayoutOnGeometryChange(true); |
1910 | + if (!keep_msg_layout) |
1911 | + { |
1912 | + msg_layout_ = new nux::VLayout(); |
1913 | + msg_layout_->SetVerticalInternalMargin(MSG_LAYOUT_MARGIN.CP(scale)); |
1914 | + msg_layout_->SetReconfigureParentLayoutOnGeometryChange(true); |
1915 | + } |
1916 | + |
1917 | GetLayout()->AddLayout(msg_layout_); |
1918 | |
1919 | + if (keep_msg_layout) |
1920 | + msg_layout_->UnReference(); |
1921 | + |
1922 | prompt_layout_ = new nux::VLayout(); |
1923 | prompt_layout_->SetVerticalInternalMargin(PROMPT_LAYOUT_MARGIN.CP(scale)); |
1924 | prompt_layout_->SetReconfigureParentLayoutOnGeometryChange(true); |
1925 | GetLayout()->AddLayout(prompt_layout_); |
1926 | |
1927 | + button_layout_ = new nux::VLayout(); |
1928 | + button_layout_->SetVerticalInternalMargin(BUTTON_LAYOUT_MARGIN.CP(scale)); |
1929 | + button_layout_->SetReconfigureParentLayoutOnGeometryChange(true); |
1930 | + |
1931 | QueueRelayout(); |
1932 | QueueDraw(); |
1933 | } |
1934 | |
1935 | -void UserPromptView::AuthenticationCb(bool authenticated) |
1936 | +void UserPromptView::AuthenticationCb(bool is_authenticated) |
1937 | { |
1938 | ResetLayout(); |
1939 | |
1940 | - if (authenticated) |
1941 | + if (is_authenticated) |
1942 | { |
1943 | - session_manager_->unlock_requested.emit(); |
1944 | + if (prompted_ && !unacknowledged_messages_) |
1945 | + DoUnlock(); |
1946 | + else |
1947 | + ShowAuthenticated(true); |
1948 | } |
1949 | else |
1950 | { |
1951 | - AddMessage(_("Invalid password, please try again"), nux::color::Red); |
1952 | - |
1953 | - user_authenticator_.AuthenticateStart(session_manager_->UserName(), |
1954 | - sigc::mem_fun(this, &UserPromptView::AuthenticationCb)); |
1955 | + if (prompted_) |
1956 | + { |
1957 | + AddMessage(_("Invalid password, please try again"), nux::color::Red); |
1958 | + StartAuthentication(); |
1959 | + } |
1960 | + else |
1961 | + { |
1962 | + AddMessage(_("Failed to authenticate"), nux::color::Red); |
1963 | + ShowAuthenticated(false); |
1964 | + } |
1965 | } |
1966 | } |
1967 | |
1968 | @@ -299,7 +347,16 @@ |
1969 | nux::View* UserPromptView::focus_view() |
1970 | { |
1971 | if (focus_queue_.empty()) |
1972 | - return nullptr; |
1973 | + { |
1974 | + if (button_layout_ && button_layout_->GetChildren().size() > 0) |
1975 | + { |
1976 | + return static_cast<nux::View*>(button_layout_->GetChildren().front()); |
1977 | + } |
1978 | + else |
1979 | + { |
1980 | + return nullptr; |
1981 | + } |
1982 | + } |
1983 | |
1984 | for (auto* view : focus_queue_) |
1985 | if (view->text_entry()->HasKeyboardFocus()) |
1986 | @@ -378,5 +435,48 @@ |
1987 | QueueDraw(); |
1988 | } |
1989 | |
1990 | +void UserPromptView::AddButton(std::string const& text, std::function<void()> const& cb) |
1991 | +{ |
1992 | + auto* button = new LockScreenButton (text, NUX_TRACKER_LOCATION); |
1993 | + button->scale = scale(); |
1994 | + button_layout_->AddView(button, 1, nux::MINOR_POSITION_START, nux::MINOR_SIZE_FULL); |
1995 | + |
1996 | + button->state_change.connect ([cb] (nux::View*) { |
1997 | + cb(); |
1998 | + }); |
1999 | + |
2000 | + GetLayout()->ComputeContentPosition(0, 0); |
2001 | + ComputeContentSize(); |
2002 | + QueueRelayout(); |
2003 | + QueueDraw(); |
2004 | +} |
2005 | + |
2006 | +void UserPromptView::ShowAuthenticated(bool successful) |
2007 | +{ |
2008 | + prompted_ = true; |
2009 | + unacknowledged_messages_ = false; |
2010 | + |
2011 | + if (successful) |
2012 | + AddButton(_("Unlock"), sigc::mem_fun(this, &UserPromptView::DoUnlock)); |
2013 | + else |
2014 | + AddButton(_("Retry"), sigc::mem_fun(this, &UserPromptView::StartAuthentication)); |
2015 | + |
2016 | + GetLayout()->AddLayout(button_layout_); |
2017 | +} |
2018 | + |
2019 | +void UserPromptView::StartAuthentication() |
2020 | +{ |
2021 | + prompted_ = false; |
2022 | + unacknowledged_messages_ = false; |
2023 | + |
2024 | + user_authenticator_.AuthenticateStart(session_manager_->UserName(), |
2025 | + sigc::mem_fun(this, &UserPromptView::AuthenticationCb)); |
2026 | +} |
2027 | + |
2028 | +void UserPromptView::DoUnlock() |
2029 | +{ |
2030 | + session_manager_->unlock_requested.emit(); |
2031 | +} |
2032 | + |
2033 | } |
2034 | } |
2035 | |
2036 | === modified file 'lockscreen/UserPromptView.h' |
2037 | --- lockscreen/UserPromptView.h 2016-03-31 09:51:33 +0000 |
2038 | +++ lockscreen/UserPromptView.h 2016-07-15 10:12:55 +0000 |
2039 | @@ -52,6 +52,7 @@ |
2040 | |
2041 | nux::View* focus_view(); |
2042 | |
2043 | + void AddButton(std::string const& text, std::function<void()> const& cb); |
2044 | void AddPrompt(std::string const& message, bool visible, PromiseAuthCodePtr const&); |
2045 | void AddMessage(std::string const& message, nux::Color const& color); |
2046 | void AuthenticationCb(bool authenticated); |
2047 | @@ -59,13 +60,16 @@ |
2048 | protected: |
2049 | void Draw(nux::GraphicsEngine& graphics_engine, bool force_draw) override; |
2050 | void DrawContent(nux::GraphicsEngine& graphics_engine, bool force_draw) override; |
2051 | + bool InspectKeyEvent(unsigned int eventType, unsigned int key_sym, const char* character) override; |
2052 | |
2053 | private: |
2054 | void ResetLayout(); |
2055 | void UpdateSize(); |
2056 | void EnsureBGLayer(); |
2057 | |
2058 | - bool InspectKeyEvent(unsigned int eventType, unsigned int key_sym, const char* character); |
2059 | + void ShowAuthenticated(bool successful); |
2060 | + void StartAuthentication(); |
2061 | + void DoUnlock(); |
2062 | |
2063 | session::Manager::Ptr session_manager_; |
2064 | UserAuthenticatorPam user_authenticator_; |
2065 | @@ -73,9 +77,13 @@ |
2066 | StaticCairoText* username_; |
2067 | nux::VLayout* msg_layout_; |
2068 | nux::VLayout* prompt_layout_; |
2069 | + nux::VLayout* button_layout_; |
2070 | std::deque<TextInput*> focus_queue_; |
2071 | |
2072 | nux::Geometry cached_focused_geo_; |
2073 | + |
2074 | + bool prompted_; |
2075 | + bool unacknowledged_messages_; |
2076 | }; |
2077 | |
2078 | } |
2079 | |
2080 | === modified file 'panel/PanelView.cpp' |
2081 | --- panel/PanelView.cpp 2016-03-31 05:57:11 +0000 |
2082 | +++ panel/PanelView.cpp 2016-07-15 10:12:55 +0000 |
2083 | @@ -64,7 +64,7 @@ |
2084 | auto& wm = WindowManager::Default(); |
2085 | panel::Style::Instance().changed.connect(sigc::mem_fun(this, &PanelView::ForceUpdateBackground)); |
2086 | Settings::Instance().dpi_changed.connect(sigc::mem_fun(this, &PanelView::Resize)); |
2087 | - Settings::Instance().low_gfx_changed.connect(sigc::mem_fun(this, &PanelView::OnLowGfxChanged)); |
2088 | + Settings::Instance().low_gfx.changed.connect(sigc::hide(sigc::mem_fun(this, &PanelView::OnLowGfxChanged))); |
2089 | |
2090 | wm.average_color.changed.connect(sigc::mem_fun(this, &PanelView::OnBackgroundUpdate)); |
2091 | wm.initiate_spread.connect(sigc::mem_fun(this, &PanelView::OnSpreadInitiate)); |
2092 | @@ -76,7 +76,7 @@ |
2093 | rop.Blend = true; |
2094 | nux::Color darken_colour = nux::Color(0.9f, 0.9f, 0.9f, 1.0f); |
2095 | |
2096 | - if (!Settings::Instance().GetLowGfxMode()) |
2097 | + if (!Settings::Instance().low_gfx()) |
2098 | { |
2099 | rop.SrcBlend = GL_ZERO; |
2100 | rop.DstBlend = GL_SRC_COLOR; |
2101 | @@ -258,7 +258,7 @@ |
2102 | |
2103 | void PanelView::OnLowGfxChanged() |
2104 | { |
2105 | - if (!Settings::Instance().GetLowGfxMode()) |
2106 | + if (!Settings::Instance().low_gfx()) |
2107 | { |
2108 | nux::ROPConfig rop; |
2109 | |
2110 | @@ -300,15 +300,20 @@ |
2111 | PanelView::Draw(nux::GraphicsEngine& GfxContext, bool force_draw) |
2112 | { |
2113 | nux::Geometry const& geo = GetGeometry(); |
2114 | + nux::Geometry const& geo_absolute = GetAbsoluteGeometry(); |
2115 | + nux::Geometry const& mgeo = UScreen::GetDefault()->GetMonitorGeometry(monitor_); |
2116 | + nux::Geometry isect = mgeo.Intersect(geo_absolute); |
2117 | + |
2118 | + if(!isect.width || !isect.height) |
2119 | + return; |
2120 | + |
2121 | UpdateBackground(); |
2122 | |
2123 | bool overlay_mode = InOverlayMode(); |
2124 | - GfxContext.PushClippingRectangle(geo); |
2125 | + GfxContext.PushClippingRectangle(isect); |
2126 | |
2127 | if (IsTransparent()) |
2128 | { |
2129 | - nux::Geometry const& geo_absolute = GetAbsoluteGeometry(); |
2130 | - |
2131 | if (BackgroundEffectHelper::blur_type != BLUR_NONE) |
2132 | { |
2133 | bg_blur_texture_ = bg_effect_helper_.GetBlurRegion(); |
2134 | @@ -331,7 +336,7 @@ |
2135 | rop.SrcBlend = GL_ONE; |
2136 | rop.DstBlend = GL_ONE_MINUS_SRC_ALPHA; |
2137 | |
2138 | - GfxContext.PushClippingRectangle(geo); |
2139 | + GfxContext.PushClippingRectangle(isect); |
2140 | |
2141 | #ifndef NUX_OPENGLES_20 |
2142 | if (GfxContext.UsingGLSLCodePath()) |
2143 | @@ -362,7 +367,7 @@ |
2144 | GfxContext.PopClippingRectangle(); |
2145 | } |
2146 | |
2147 | - if (overlay_mode && !Settings::Instance().GetLowGfxMode()) |
2148 | + if (overlay_mode && !Settings::Instance().low_gfx()) |
2149 | { |
2150 | nux::GetPainter().RenderSinglePaintLayer(GfxContext, geo, bg_darken_layer_.get()); |
2151 | |
2152 | @@ -456,7 +461,7 @@ |
2153 | |
2154 | if (overlay_mode) |
2155 | { |
2156 | - if (Settings::Instance().GetLowGfxMode()) |
2157 | + if (Settings::Instance().low_gfx()) |
2158 | { |
2159 | rop.Blend = false; |
2160 | auto const& bg_color = WindowManager::Default().average_color(); |
2161 | @@ -475,7 +480,7 @@ |
2162 | refine_geo.x = refine_x_pos; |
2163 | refine_geo.width = bg_refine_tex_->GetWidth(); |
2164 | |
2165 | - if (!Settings::Instance().GetLowGfxMode()) |
2166 | + if (!Settings::Instance().low_gfx()) |
2167 | { |
2168 | nux::GetPainter().PushLayer(GfxContext, refine_geo, bg_refine_layer_.get()); |
2169 | bgs++; |
2170 | @@ -491,7 +496,7 @@ |
2171 | if (!overlay_mode || !GfxContext.UsingGLSLCodePath()) |
2172 | gPainter.PushLayer(GfxContext, geo, bg_layer_.get()); |
2173 | |
2174 | - if (overlay_mode && !Settings::Instance().GetLowGfxMode()) |
2175 | + if (overlay_mode && !Settings::Instance().low_gfx()) |
2176 | { |
2177 | // apply the shine |
2178 | nux::TexCoordXForm texxform; |
2179 | |
2180 | === modified file 'plugins/unityshell/src/UnityShowdesktopHandler.cpp' |
2181 | --- plugins/unityshell/src/UnityShowdesktopHandler.cpp 2012-11-15 20:03:17 +0000 |
2182 | +++ plugins/unityshell/src/UnityShowdesktopHandler.cpp 2016-07-15 10:12:55 +0000 |
2183 | @@ -21,6 +21,7 @@ |
2184 | |
2185 | #include <glib.h> |
2186 | #include "UnityShowdesktopHandler.h" |
2187 | +#include "unity-shared/UnitySettings.h" |
2188 | |
2189 | namespace unity |
2190 | { |
2191 | @@ -99,7 +100,7 @@ |
2192 | return; |
2193 | |
2194 | state_ = ShowdesktopHandler::StateFadeOut; |
2195 | - progress_ = 0.0f; |
2196 | + progress_ = Settings::Instance().low_gfx() ? 1.0f : 0.0f; |
2197 | |
2198 | was_hidden_ = showdesktop_handler_window_interface_->Hidden(); |
2199 | |
2200 | @@ -143,7 +144,7 @@ |
2201 | |
2202 | if (state_ == ShowdesktopHandler::StateFadeOut) |
2203 | { |
2204 | - progress_ += inc; |
2205 | + progress_ = Settings::Instance().low_gfx() ? 1.0f : progress_ + inc; |
2206 | if (progress_ >= 1.0f) |
2207 | { |
2208 | progress_ = 1.0f; |
2209 | @@ -152,7 +153,7 @@ |
2210 | } |
2211 | else if (state_ == StateFadeIn) |
2212 | { |
2213 | - progress_ -= inc; |
2214 | + progress_ = Settings::Instance().low_gfx() ? 0.0f : progress_ - inc; |
2215 | if (progress_ <= 0.0f) |
2216 | { |
2217 | progress_ = 0.0f; |
2218 | |
2219 | === modified file 'plugins/unityshell/src/unityshell.cpp' |
2220 | --- plugins/unityshell/src/unityshell.cpp 2016-05-17 02:56:14 +0000 |
2221 | +++ plugins/unityshell/src/unityshell.cpp 2016-07-15 10:12:55 +0000 |
2222 | @@ -221,6 +221,7 @@ |
2223 | , key_nav_mode_requested_(false) |
2224 | , big_tick_(0) |
2225 | , back_buffer_age_(0) |
2226 | + , next_active_window_(0) |
2227 | { |
2228 | Timer timer; |
2229 | #ifndef USE_GLES |
2230 | @@ -300,12 +301,12 @@ |
2231 | (getenv("UNITY_LOW_GFX_MODE") != NULL && atoi(getenv("UNITY_LOW_GFX_MODE")) == 1) || |
2232 | optionGetLowGraphicsMode()) |
2233 | { |
2234 | - unity_settings_.SetLowGfxMode(true); |
2235 | + unity_settings_.low_gfx = true; |
2236 | } |
2237 | |
2238 | if (getenv("UNITY_LOW_GFX_MODE") != NULL && atoi(getenv("UNITY_LOW_GFX_MODE")) == 0) |
2239 | { |
2240 | - unity_settings_.SetLowGfxMode(false); |
2241 | + unity_settings_.low_gfx = false; |
2242 | } |
2243 | #endif |
2244 | |
2245 | @@ -445,6 +446,7 @@ |
2246 | auto init_plugins_cb = sigc::mem_fun(this, &UnityScreen::InitPluginActions); |
2247 | sources_.Add(std::make_shared<glib::Idle>(init_plugins_cb, glib::Source::Priority::DEFAULT)); |
2248 | |
2249 | + Settings::Instance().gestures_changed.connect(sigc::mem_fun(this, &UnityScreen::UpdateGesturesSupport)); |
2250 | InitGesturesSupport(); |
2251 | |
2252 | LoadPanelShadowTexture(); |
2253 | @@ -1214,6 +1216,8 @@ |
2254 | |
2255 | void UnityWindow::activate () |
2256 | { |
2257 | + uScreen->SetNextActiveWindow(window->id()); |
2258 | + |
2259 | ShowdesktopHandler::InhibitLeaveShowdesktopMode (window->id ()); |
2260 | window->activate (); |
2261 | ShowdesktopHandler::AllowLeaveShowdesktopMode (window->id ()); |
2262 | @@ -2483,7 +2487,7 @@ |
2263 | } |
2264 | else |
2265 | { |
2266 | - switcher_controller_->detail = true; |
2267 | + switcher_controller_->SetDetail(true); |
2268 | } |
2269 | |
2270 | action->setState(action->state() | CompAction::StateTermKey); |
2271 | @@ -2982,7 +2986,7 @@ |
2272 | uScreen->windows_for_monitor_[monitor] = 1; |
2273 | |
2274 | if (!(mask & nonOcclusionBits) && |
2275 | - (window->state() & CompWindowStateFullscreenMask && !window->minimized()) && |
2276 | + (window->state() & CompWindowStateFullscreenMask && !window->minimized() && !window->inShowDesktopMode()) && |
2277 | uScreen->windows_for_monitor_[monitor] == 1) |
2278 | // And I've been advised to test other things, but they don't work: |
2279 | // && (attrib.opacity == OPAQUE)) <-- Doesn't work; Only set in glDraw |
2280 | @@ -3723,7 +3727,7 @@ |
2281 | else |
2282 | BackgroundEffectHelper::blur_type = (unity::BlurType)optionGetDashBlurExperimental(); |
2283 | |
2284 | - unity::Settings::Instance().SetLowGfxMode(optionGetLowGraphicsMode()); |
2285 | + unity::Settings::Instance().low_gfx = optionGetLowGraphicsMode(); |
2286 | break; |
2287 | case UnityshellOptions::DecayRate: |
2288 | launcher_options->edge_decay_rate = optionGetDecayRate() * 100; |
2289 | @@ -4077,24 +4081,24 @@ |
2290 | ShowFirstRunHints(); |
2291 | |
2292 | // Setup Session Controller |
2293 | - auto manager = std::make_shared<session::GnomeManager>(); |
2294 | - manager->lock_requested.connect(sigc::mem_fun(this, &UnityScreen::OnLockScreenRequested)); |
2295 | - manager->prompt_lock_requested.connect(sigc::mem_fun(this, &UnityScreen::OnLockScreenRequested)); |
2296 | - manager->locked.connect(sigc::mem_fun(this, &UnityScreen::OnScreenLocked)); |
2297 | - manager->unlocked.connect(sigc::mem_fun(this, &UnityScreen::OnScreenUnlocked)); |
2298 | - session_dbus_manager_ = std::make_shared<session::DBusManager>(manager); |
2299 | - session_controller_ = std::make_shared<session::Controller>(manager); |
2300 | + auto session = std::make_shared<session::GnomeManager>(); |
2301 | + session->lock_requested.connect(sigc::mem_fun(this, &UnityScreen::OnLockScreenRequested)); |
2302 | + session->prompt_lock_requested.connect(sigc::mem_fun(this, &UnityScreen::OnLockScreenRequested)); |
2303 | + session->locked.connect(sigc::mem_fun(this, &UnityScreen::OnScreenLocked)); |
2304 | + session->unlocked.connect(sigc::mem_fun(this, &UnityScreen::OnScreenUnlocked)); |
2305 | + session_dbus_manager_ = std::make_shared<session::DBusManager>(session); |
2306 | + session_controller_ = std::make_shared<session::Controller>(session); |
2307 | LOG_INFO(logger) << "InitUnityComponents-Session " << timer.ElapsedSeconds() << "s"; |
2308 | Introspectable::AddChild(session_controller_.get()); |
2309 | |
2310 | // Setup Lockscreen Controller |
2311 | - screensaver_dbus_manager_ = std::make_shared<lockscreen::DBusManager>(manager); |
2312 | - lockscreen_controller_ = std::make_shared<lockscreen::Controller>(screensaver_dbus_manager_, manager); |
2313 | + screensaver_dbus_manager_ = std::make_shared<lockscreen::DBusManager>(session); |
2314 | + lockscreen_controller_ = std::make_shared<lockscreen::Controller>(screensaver_dbus_manager_, session, menus_->KeyGrabber()); |
2315 | UpdateActivateIndicatorsKey(); |
2316 | LOG_INFO(logger) << "InitUnityComponents-Lockscreen " << timer.ElapsedSeconds() << "s"; |
2317 | |
2318 | if (g_file_test((DesktopUtilities::GetUserRuntimeDirectory()+local::LOCKED_STAMP).c_str(), G_FILE_TEST_EXISTS)) |
2319 | - manager->PromptLockScreen(); |
2320 | + session->PromptLockScreen(); |
2321 | |
2322 | auto on_launcher_size_changed = [this] (nux::Area* area, int w, int h) { |
2323 | /* The launcher geometry includes 1px used to draw the right/top margin |
2324 | @@ -4186,22 +4190,26 @@ |
2325 | return lockscreen_controller_; |
2326 | } |
2327 | |
2328 | +void UnityScreen::UpdateGesturesSupport() |
2329 | +{ |
2330 | + Settings::Instance().gestures_launcher_drag() ? gestures_sub_launcher_->Activate() : gestures_sub_launcher_->Deactivate(); |
2331 | + Settings::Instance().gestures_dash_tap() ? gestures_sub_dash_->Activate() : gestures_sub_dash_->Deactivate(); |
2332 | + Settings::Instance().gestures_windows_drag_pinch() ? gestures_sub_windows_->Activate() : gestures_sub_windows_->Deactivate(); |
2333 | +} |
2334 | + |
2335 | void UnityScreen::InitGesturesSupport() |
2336 | { |
2337 | std::unique_ptr<nux::GestureBroker> gesture_broker(new UnityGestureBroker); |
2338 | wt->GetWindowCompositor().SetGestureBroker(std::move(gesture_broker)); |
2339 | - |
2340 | gestures_sub_launcher_.reset(new nux::GesturesSubscription); |
2341 | gestures_sub_launcher_->SetGestureClasses(nux::DRAG_GESTURE); |
2342 | gestures_sub_launcher_->SetNumTouches(4); |
2343 | gestures_sub_launcher_->SetWindowId(GDK_ROOT_WINDOW()); |
2344 | - gestures_sub_launcher_->Activate(); |
2345 | |
2346 | gestures_sub_dash_.reset(new nux::GesturesSubscription); |
2347 | gestures_sub_dash_->SetGestureClasses(nux::TAP_GESTURE); |
2348 | gestures_sub_dash_->SetNumTouches(4); |
2349 | gestures_sub_dash_->SetWindowId(GDK_ROOT_WINDOW()); |
2350 | - gestures_sub_dash_->Activate(); |
2351 | |
2352 | gestures_sub_windows_.reset(new nux::GesturesSubscription); |
2353 | gestures_sub_windows_->SetGestureClasses(nux::TOUCH_GESTURE |
2354 | @@ -4209,7 +4217,9 @@ |
2355 | | nux::PINCH_GESTURE); |
2356 | gestures_sub_windows_->SetNumTouches(3); |
2357 | gestures_sub_windows_->SetWindowId(GDK_ROOT_WINDOW()); |
2358 | - gestures_sub_windows_->Activate(); |
2359 | + |
2360 | + // Apply the user's settings |
2361 | + UpdateGesturesSupport(); |
2362 | } |
2363 | |
2364 | CompAction::Vector& UnityScreen::getActions() |
2365 | @@ -4245,6 +4255,16 @@ |
2366 | }); |
2367 | } |
2368 | |
2369 | +Window UnityScreen::GetNextActiveWindow() const |
2370 | +{ |
2371 | + return next_active_window_; |
2372 | +} |
2373 | + |
2374 | +void UnityScreen::SetNextActiveWindow(Window next_active_window) |
2375 | +{ |
2376 | + next_active_window_ = next_active_window; |
2377 | +} |
2378 | + |
2379 | /* Window init */ |
2380 | |
2381 | namespace |
2382 | @@ -4604,7 +4624,7 @@ |
2383 | |
2384 | if (IsInShowdesktopMode()) |
2385 | { |
2386 | - if (!(screen->activeWindow() == window->id())) |
2387 | + if (uScreen->GetNextActiveWindow() != window->id()) |
2388 | { |
2389 | if (!mShowdesktopHandler) |
2390 | mShowdesktopHandler.reset(new ShowdesktopHandler(static_cast <ShowdesktopHandlerWindowInterface *>(this), |
2391 | |
2392 | === modified file 'plugins/unityshell/src/unityshell.h' |
2393 | --- plugins/unityshell/src/unityshell.h 2016-05-17 02:55:52 +0000 |
2394 | +++ plugins/unityshell/src/unityshell.h 2016-07-15 10:12:55 +0000 |
2395 | @@ -282,6 +282,7 @@ |
2396 | void OnDecorationStyleChanged(); |
2397 | |
2398 | void InitGesturesSupport(); |
2399 | + void UpdateGesturesSupport(); |
2400 | |
2401 | void DrawPanelUnderDash(); |
2402 | |
2403 | @@ -298,6 +299,9 @@ |
2404 | void SpreadAppWindows(bool anywhere); |
2405 | bool queryForShader(); |
2406 | |
2407 | + Window GetNextActiveWindow() const; |
2408 | + void SetNextActiveWindow(Window next_active_window); |
2409 | + |
2410 | /* We store these to avoid unecessary calls to ::get */ |
2411 | CompScreen* screen; |
2412 | CompositeScreen* cScreen; |
2413 | @@ -413,6 +417,8 @@ |
2414 | uint64_t big_tick_; |
2415 | unsigned int back_buffer_age_; |
2416 | |
2417 | + Window next_active_window_; |
2418 | + |
2419 | friend class UnityWindow; |
2420 | friend class debug::ScreenIntrospection; |
2421 | friend class decoration::Manager; |
2422 | |
2423 | === modified file 'shortcuts/ShortcutController.cpp' |
2424 | --- shortcuts/ShortcutController.cpp 2015-11-26 00:06:37 +0000 |
2425 | +++ shortcuts/ShortcutController.cpp 2016-07-15 10:12:55 +0000 |
2426 | @@ -22,6 +22,7 @@ |
2427 | |
2428 | #include "unity-shared/AnimationUtils.h" |
2429 | #include "unity-shared/UBusMessages.h" |
2430 | +#include "unity-shared/UnitySettings.h" |
2431 | #include "unity-shared/UScreen.h" |
2432 | #include "unity-shared/WindowManager.h" |
2433 | |
2434 | @@ -42,7 +43,7 @@ |
2435 | , base_window_raiser_(base_window_raiser) |
2436 | , visible_(false) |
2437 | , enabled_(true) |
2438 | - , fade_animator_(FADE_DURATION) |
2439 | + , fade_animator_(Settings::Instance().low_gfx() ? 0 : FADE_DURATION) |
2440 | { |
2441 | ubus_manager_.RegisterInterest(UBUS_LAUNCHER_START_KEY_SWITCHER, [this] (GVariant*) |
2442 | { SetEnabled(false); }); |
2443 | @@ -57,6 +58,11 @@ |
2444 | if (animation::GetDirection(fade_animator_) == animation::Direction::BACKWARD) |
2445 | view_window_->ShowWindow(false); |
2446 | }); |
2447 | + |
2448 | + Settings::Instance().low_gfx.changed.connect(sigc::track_obj([this] (bool low_gfx) { |
2449 | + fade_animator_.SetDuration(low_gfx ? 0 : FADE_DURATION); |
2450 | + }, *this)); |
2451 | + |
2452 | modeller_->model_changed.connect(sigc::mem_fun(this, &Controller::OnModelUpdated)); |
2453 | } |
2454 | |
2455 | |
2456 | === modified file 'shutdown/SessionController.cpp' |
2457 | --- shutdown/SessionController.cpp 2014-12-10 14:24:06 +0000 |
2458 | +++ shutdown/SessionController.cpp 2016-07-15 10:12:55 +0000 |
2459 | @@ -20,9 +20,10 @@ |
2460 | #include "SessionController.h" |
2461 | |
2462 | #include "unity-shared/AnimationUtils.h" |
2463 | -#include "unity-shared/UScreen.h" |
2464 | #include "unity-shared/UBusMessages.h" |
2465 | #include "unity-shared/UBusWrapper.h" |
2466 | +#include "unity-shared/UnitySettings.h" |
2467 | +#include "unity-shared/UScreen.h" |
2468 | #include "unity-shared/WindowManager.h" |
2469 | |
2470 | namespace na = nux::animation; |
2471 | @@ -38,7 +39,7 @@ |
2472 | |
2473 | Controller::Controller(session::Manager::Ptr const& manager) |
2474 | : manager_(manager) |
2475 | - , fade_animator_(FADE_DURATION) |
2476 | + , fade_animator_(Settings::Instance().low_gfx() ? 0 : FADE_DURATION) |
2477 | { |
2478 | manager_->reboot_requested.connect([this] (bool inhibitors) { |
2479 | Show(View::Mode::SHUTDOWN, inhibitors); |
2480 | @@ -61,6 +62,10 @@ |
2481 | if (animation::GetDirection(fade_animator_) == animation::Direction::BACKWARD) |
2482 | CloseWindow(); |
2483 | }); |
2484 | + |
2485 | + Settings::Instance().low_gfx.changed.connect(sigc::track_obj([this] (bool low_gfx) { |
2486 | + fade_animator_.SetDuration(low_gfx ? 0 : FADE_DURATION); |
2487 | + }, *this)); |
2488 | } |
2489 | |
2490 | void Controller::OnBackgroundUpdate(nux::Color const& new_color) |
2491 | |
2492 | === modified file 'tests/test_lockscreen_controller.cpp' |
2493 | --- tests/test_lockscreen_controller.cpp 2015-12-05 07:03:25 +0000 |
2494 | +++ tests/test_lockscreen_controller.cpp 2016-07-15 10:12:55 +0000 |
2495 | @@ -33,6 +33,7 @@ |
2496 | #include "unity-shared/DashStyle.h" |
2497 | #include "unity-shared/PanelStyle.h" |
2498 | #include "unity-shared/UScreen.h" |
2499 | +#include "mock_key_grabber.h" |
2500 | #include "test_mock_session_manager.h" |
2501 | #include "test_uscreen_mock.h" |
2502 | #include "test_utils.h" |
2503 | @@ -80,19 +81,21 @@ |
2504 | TestLockScreenController() |
2505 | : animation_controller(tick_source) |
2506 | , session_manager(std::make_shared<NiceMock<session::MockManager>>()) |
2507 | + , key_grabber(std::make_shared<key::MockGrabber::Nice>()) |
2508 | , dbus_manager(std::make_shared<DBusManager>(session_manager)) |
2509 | , upstart_wrapper(std::make_shared<UpstartWrapper>()) |
2510 | , shield_factory(std::make_shared<ShieldFactoryMock>()) |
2511 | - , controller(dbus_manager, session_manager, upstart_wrapper, shield_factory) |
2512 | + , controller(dbus_manager, session_manager, key_grabber, upstart_wrapper, shield_factory) |
2513 | {} |
2514 | |
2515 | struct ControllerWrap : Controller |
2516 | { |
2517 | ControllerWrap(DBusManager::Ptr const& dbus_manager, |
2518 | session::Manager::Ptr const& session_manager, |
2519 | + key::Grabber::Ptr const& key_grabber, |
2520 | UpstartWrapper::Ptr const& upstart_wrapper, |
2521 | ShieldFactoryInterface::Ptr const& shield_factory) |
2522 | - : Controller(dbus_manager, session_manager, upstart_wrapper, shield_factory, /* test_mode */ true) |
2523 | + : Controller(dbus_manager, session_manager, key_grabber, upstart_wrapper, shield_factory, /* test_mode */ true) |
2524 | {} |
2525 | |
2526 | using Controller::shields_; |
2527 | @@ -107,6 +110,7 @@ |
2528 | unity::panel::Style panel_style; |
2529 | unity::lockscreen::Settings lockscreen_settings; |
2530 | session::MockManager::Ptr session_manager; |
2531 | + key::MockGrabber::Ptr key_grabber; |
2532 | DBusManager::Ptr dbus_manager; |
2533 | unity::UpstartWrapper::Ptr upstart_wrapper; |
2534 | |
2535 | @@ -123,7 +127,7 @@ |
2536 | { |
2537 | size_t before = uscreen.changed.size(); |
2538 | { |
2539 | - Controller dummy(dbus_manager, session_manager); |
2540 | + Controller dummy(dbus_manager, session_manager, key_grabber); |
2541 | } |
2542 | ASSERT_EQ(before, uscreen.changed.size()); |
2543 | |
2544 | @@ -135,7 +139,7 @@ |
2545 | { |
2546 | size_t before = session_manager->unlock_requested.size(); |
2547 | { |
2548 | - Controller dummy(dbus_manager, session_manager); |
2549 | + Controller dummy(dbus_manager, session_manager, key_grabber); |
2550 | } |
2551 | ASSERT_EQ(before, session_manager->unlock_requested.size()); |
2552 | |
2553 | |
2554 | === modified file 'unity-shared/BGHash.cpp' |
2555 | --- unity-shared/BGHash.cpp 2015-04-23 13:39:31 +0000 |
2556 | +++ unity-shared/BGHash.cpp 2016-07-15 10:12:55 +0000 |
2557 | @@ -20,6 +20,7 @@ |
2558 | #include "BGHash.h" |
2559 | #include <gdk/gdkx.h> |
2560 | #include <NuxCore/Logger.h> |
2561 | +#include "unity-shared/UnitySettings.h" |
2562 | #include "unity-shared/WindowManager.h" |
2563 | |
2564 | #ifndef XA_STRING |
2565 | @@ -38,13 +39,17 @@ |
2566 | } |
2567 | |
2568 | BGHash::BGHash() |
2569 | - : transition_animator_(TRANSITION_DURATION) |
2570 | + : transition_animator_(Settings::Instance().low_gfx() ? 0 : TRANSITION_DURATION) |
2571 | , override_color_(nux::color::Transparent) |
2572 | { |
2573 | COLORS_ATOM = gdk_x11_get_xatom_by_name("_GNOME_BACKGROUND_REPRESENTATIVE_COLORS"); |
2574 | transition_animator_.updated.connect(sigc::mem_fun(this, &BGHash::OnTransitionUpdated)); |
2575 | WindowManager::Default().average_color = unity::colors::Aubergine; |
2576 | RefreshColor(/* skip_animation */ true); |
2577 | + |
2578 | + Settings::Instance().low_gfx.changed.connect(sigc::track_obj([this] (bool low_gfx) { |
2579 | + transition_animator_.SetDuration(low_gfx ? 0 : TRANSITION_DURATION); |
2580 | + }, *this)); |
2581 | } |
2582 | |
2583 | uint64_t BGHash::ColorAtomId() const |
2584 | |
2585 | === modified file 'unity-shared/BGHash.h' |
2586 | --- unity-shared/BGHash.h 2014-12-11 12:54:37 +0000 |
2587 | +++ unity-shared/BGHash.h 2016-07-15 10:12:55 +0000 |
2588 | @@ -30,7 +30,7 @@ |
2589 | |
2590 | namespace unity |
2591 | { |
2592 | - class BGHash |
2593 | + class BGHash : public sigc::trackable |
2594 | { |
2595 | public: |
2596 | BGHash(); |
2597 | |
2598 | === modified file 'unity-shared/BackgroundEffectHelper.cpp' |
2599 | --- unity-shared/BackgroundEffectHelper.cpp 2016-03-31 06:06:15 +0000 |
2600 | +++ unity-shared/BackgroundEffectHelper.cpp 2016-07-15 10:12:55 +0000 |
2601 | @@ -51,7 +51,7 @@ |
2602 | TextureCache::GetDefault().themed_invalidated.connect(sigc::mem_fun(this, &BackgroundEffectHelper::LoadTextures)); |
2603 | LoadTextures(); |
2604 | |
2605 | - if (Settings::Instance().GetLowGfxMode()) |
2606 | + if (Settings::Instance().low_gfx()) |
2607 | blur_type = BLUR_NONE; |
2608 | } |
2609 | |
2610 | |
2611 | === modified file 'unity-shared/DashStyle.cpp' |
2612 | --- unity-shared/DashStyle.cpp 2016-05-17 02:56:09 +0000 |
2613 | +++ unity-shared/DashStyle.cpp 2016-07-15 10:12:55 +0000 |
2614 | @@ -1672,6 +1672,41 @@ |
2615 | return true; |
2616 | } |
2617 | |
2618 | +bool Style::LockScreenButton(cairo_t* cr, std::string const& label, |
2619 | + int font_px_size) |
2620 | +{ |
2621 | + if (cairo_status(cr) != CAIRO_STATUS_SUCCESS) |
2622 | + return false; |
2623 | + |
2624 | + if (cairo_surface_get_type(cairo_get_target(cr)) != CAIRO_SURFACE_TYPE_IMAGE) |
2625 | + return false; |
2626 | + |
2627 | + double w, h; |
2628 | + get_actual_cairo_size(cr, &w, &h); |
2629 | + |
2630 | + cairo_set_line_width(cr, 1); |
2631 | + |
2632 | + double radius = 5.0; |
2633 | + RoundedRect(cr, 1.0, 0.5, 0.5, radius, w - 1.0, h - 1.0); |
2634 | + |
2635 | + cairo_set_source_rgba(cr, 0.0f, 0.0f, 0.0f, 0.35f); |
2636 | + cairo_fill_preserve(cr); |
2637 | + |
2638 | + cairo_set_source_rgba(cr, 1.0f, 1.0f, 1.0f, 0.7f); |
2639 | + cairo_stroke(cr); |
2640 | + |
2641 | + static double internal_padding = 10.0f; |
2642 | + |
2643 | + pimpl->Text(cr, |
2644 | + nux::color::White, |
2645 | + label, |
2646 | + font_px_size, |
2647 | + internal_padding, |
2648 | + dash::Alignment::LEFT); |
2649 | + |
2650 | + return true; |
2651 | +} |
2652 | + |
2653 | nux::AbstractPaintLayer* Style::FocusOverlay(int width, int height) |
2654 | { |
2655 | nux::CairoGraphics cg(CAIRO_FORMAT_ARGB32, width, height); |
2656 | @@ -2211,6 +2246,10 @@ |
2657 | return pimpl->LoadScaledTexture("search_spin", scale); |
2658 | } |
2659 | |
2660 | +BaseTexturePtr Style::GetLockScreenActivator(double scale) const |
2661 | +{ |
2662 | + return pimpl->LoadScaledTexture("arrow_right", scale); |
2663 | +} |
2664 | |
2665 | RawPixel Style::GetButtonGarnishSize() const |
2666 | { |
2667 | |
2668 | === modified file 'unity-shared/DashStyle.h' |
2669 | --- unity-shared/DashStyle.h 2016-03-31 05:53:05 +0000 |
2670 | +++ unity-shared/DashStyle.h 2016-07-15 10:12:55 +0000 |
2671 | @@ -98,6 +98,9 @@ |
2672 | |
2673 | static Style& Instance(); |
2674 | |
2675 | + virtual bool LockScreenButton(cairo_t* cr, std::string const& label, |
2676 | + int font_px_size); |
2677 | + |
2678 | virtual bool Button(cairo_t* cr, nux::ButtonVisualState state, |
2679 | std::string const& label, int font_px_size=-1, |
2680 | Alignment alignment = Alignment::CENTER, |
2681 | @@ -196,6 +199,8 @@ |
2682 | BaseTexturePtr GetSearchCloseIcon(double scale) const; |
2683 | BaseTexturePtr GetSearchSpinIcon(double scale) const; |
2684 | |
2685 | + BaseTexturePtr GetLockScreenActivator(double scale) const; |
2686 | + |
2687 | BaseTexturePtr const& GetGroupUnexpandIcon() const; |
2688 | BaseTexturePtr const& GetGroupExpandIcon() const; |
2689 | |
2690 | |
2691 | === modified file 'unity-shared/GnomeKeyGrabber.cpp' |
2692 | --- unity-shared/GnomeKeyGrabber.cpp 2016-05-17 02:55:23 +0000 |
2693 | +++ unity-shared/GnomeKeyGrabber.cpp 2016-07-15 10:12:55 +0000 |
2694 | @@ -59,19 +59,33 @@ |
2695 | </node>)"; |
2696 | } |
2697 | |
2698 | +namespace |
2699 | +{ |
2700 | +const std::string SETTINGS_NAME = "com.canonical.Unity"; |
2701 | +const std::string WHITELIST_KEY = "whitelist-repeated-keys"; |
2702 | +} |
2703 | + |
2704 | namespace testing |
2705 | { |
2706 | std::string const DBUS_NAME = "com.canonical.Unity.Test.GnomeKeyGrabber"; |
2707 | } |
2708 | |
2709 | -GnomeGrabber::Impl::Impl(bool test_mode) |
2710 | - : screen_(screen) |
2711 | +GnomeGrabber::Impl::Impl(Grabber* parent, bool test_mode) |
2712 | + : parent_(parent) |
2713 | + , screen_(screen) |
2714 | , shell_server_(test_mode ? testing::DBUS_NAME : shell::DBUS_NAME) |
2715 | + , settings_(g_settings_new(SETTINGS_NAME.c_str())) |
2716 | , current_action_id_(0) |
2717 | { |
2718 | shell_server_.AddObjects(shell::INTROSPECTION_XML, shell::DBUS_OBJECT_PATH); |
2719 | shell_object_ = shell_server_.GetObject(shell::DBUS_INTERFACE); |
2720 | shell_object_->SetMethodsCallsHandlerFull(sigc::mem_fun(this, &Impl::OnShellMethodCall)); |
2721 | + |
2722 | + whitelist_changed_signal_.Connect(settings_, "changed::" + WHITELIST_KEY, [this] (GSettings*, gchar*) { |
2723 | + UpdateWhitelist(); |
2724 | + }); |
2725 | + |
2726 | + UpdateWhitelist(); |
2727 | } |
2728 | |
2729 | GnomeGrabber::Impl::~Impl() |
2730 | @@ -110,6 +124,7 @@ |
2731 | actions_ids_.push_back(action_id); |
2732 | actions_.push_back(action); |
2733 | actions_customers_.push_back(1); |
2734 | + parent_->action_added.emit(action); |
2735 | return true; |
2736 | } |
2737 | |
2738 | @@ -165,6 +180,7 @@ |
2739 | LOG_DEBUG(logger) << "RemoveAction (\"" << action->keyToString() << "\")"; |
2740 | |
2741 | screen_->removeAction(action); |
2742 | + parent_->action_removed.emit(*action); |
2743 | actions_.erase(actions_.begin() + index); |
2744 | actions_ids_.erase(actions_ids_.begin() + index); |
2745 | actions_customers_.erase(actions_customers_.begin() + index); |
2746 | @@ -232,7 +248,8 @@ |
2747 | { |
2748 | action.setState(CompAction::StateInitKey); |
2749 | action.setInitiate([this, action_id](CompAction* action, CompAction::State state, CompOption::Vector& options) { |
2750 | - if (!CompOption::getBoolOptionNamed(options, "is_repeated")) |
2751 | + bool is_whitelisted = std::find(whitelist_.begin(), whitelist_.end(), action->keyToString()) != whitelist_.end(); |
2752 | + if (is_whitelisted || !CompOption::getBoolOptionNamed(options, "is_repeated")) |
2753 | { |
2754 | LOG_DEBUG(logger) << "pressed \"" << action->keyToString() << "\""; |
2755 | ActivateDBusAction(*action, action_id, 0, CompOption::getIntOptionNamed(options, "time")); |
2756 | @@ -245,7 +262,6 @@ |
2757 | action.setState(CompAction::StateInitKey | CompAction::StateTermKey); |
2758 | action.setTerminate([this, action_id](CompAction* action, CompAction::State state, CompOption::Vector& options) { |
2759 | auto key = action->keyToString(); |
2760 | - |
2761 | LOG_DEBUG(logger) << "released \"" << key << "\""; |
2762 | |
2763 | if (state & CompAction::StateTermTapped) |
2764 | @@ -326,14 +342,24 @@ |
2765 | return keycode == 0 || modHandler->keycodeToModifiers(keycode) != 0; |
2766 | } |
2767 | |
2768 | +void GnomeGrabber::Impl::UpdateWhitelist() |
2769 | +{ |
2770 | + std::shared_ptr<gchar*> whitelist(g_settings_get_strv(settings_, WHITELIST_KEY.c_str()), g_strfreev); |
2771 | + auto whitelist_raw = whitelist.get(); |
2772 | + |
2773 | + whitelist_.clear(); |
2774 | + for (int i = 0; whitelist_raw[i]; ++i) |
2775 | + whitelist_.push_back(whitelist_raw[i]); |
2776 | +} |
2777 | + |
2778 | // Public implementation |
2779 | |
2780 | GnomeGrabber::GnomeGrabber() |
2781 | - : impl_(new Impl()) |
2782 | + : impl_(new Impl(this)) |
2783 | {} |
2784 | |
2785 | GnomeGrabber::GnomeGrabber(TestMode const& dummy) |
2786 | - : impl_(new Impl(true)) |
2787 | + : impl_(new Impl(this, true)) |
2788 | {} |
2789 | |
2790 | GnomeGrabber::~GnomeGrabber() |
2791 | |
2792 | === modified file 'unity-shared/GnomeKeyGrabberImpl.h' |
2793 | --- unity-shared/GnomeKeyGrabberImpl.h 2015-12-13 10:35:58 +0000 |
2794 | +++ unity-shared/GnomeKeyGrabberImpl.h 2016-07-15 10:12:55 +0000 |
2795 | @@ -28,6 +28,7 @@ |
2796 | #include <UnityCore/GLibDBusProxy.h> |
2797 | #include <UnityCore/GLibDBusServer.h> |
2798 | #include <UnityCore/GLibDBusNameWatcher.h> |
2799 | +#include <UnityCore/GLibSignal.h> |
2800 | |
2801 | namespace unity |
2802 | { |
2803 | @@ -36,7 +37,7 @@ |
2804 | |
2805 | struct GnomeGrabber::Impl |
2806 | { |
2807 | - Impl(bool test_mode = false); |
2808 | + Impl(Grabber*, bool test_mode = false); |
2809 | ~Impl(); |
2810 | |
2811 | uint32_t NextActionID(); |
2812 | @@ -54,12 +55,18 @@ |
2813 | void ActivateDBusAction(CompAction const& action, uint32_t id, uint32_t device, uint32_t timestamp) const; |
2814 | |
2815 | bool IsActionPostponed(CompAction const& action) const; |
2816 | + void UpdateWhitelist(); |
2817 | |
2818 | + Grabber* parent_; |
2819 | CompScreen* screen_; |
2820 | |
2821 | glib::DBusServer shell_server_; |
2822 | glib::DBusObject::Ptr shell_object_; |
2823 | |
2824 | + glib::Object<GSettings> settings_; |
2825 | + glib::Signal<void, GSettings*, gchar*> whitelist_changed_signal_; |
2826 | + std::list<std::string> whitelist_; |
2827 | + |
2828 | uint32_t current_action_id_; |
2829 | std::vector<uint32_t> actions_ids_; |
2830 | std::vector<uint32_t> actions_customers_; |
2831 | |
2832 | === modified file 'unity-shared/KeyGrabber.h' |
2833 | --- unity-shared/KeyGrabber.h 2015-09-29 13:06:46 +0000 |
2834 | +++ unity-shared/KeyGrabber.h 2016-07-15 10:12:55 +0000 |
2835 | @@ -21,6 +21,7 @@ |
2836 | #define __UNITY_KEY_GRABBER__ |
2837 | |
2838 | #include <core/core.h> |
2839 | +#include <sigc++/signal.h> |
2840 | |
2841 | namespace unity |
2842 | { |
2843 | @@ -36,6 +37,9 @@ |
2844 | virtual bool RemoveAction(CompAction const&) = 0; |
2845 | virtual bool RemoveAction(uint32_t id) = 0; |
2846 | |
2847 | + sigc::signal<void, CompAction const&> action_added; |
2848 | + sigc::signal<void, CompAction const&> action_removed; |
2849 | + |
2850 | virtual CompAction::Vector& GetActions() = 0; |
2851 | }; |
2852 | |
2853 | |
2854 | === modified file 'unity-shared/OverlayRenderer.cpp' |
2855 | --- unity-shared/OverlayRenderer.cpp 2016-03-31 05:54:52 +0000 |
2856 | +++ unity-shared/OverlayRenderer.cpp 2016-07-15 10:12:55 +0000 |
2857 | @@ -119,7 +119,7 @@ |
2858 | parent->scale = Settings::Instance().em()->DPIScale(); |
2859 | parent->scale.changed.connect(sigc::hide(sigc::mem_fun(this, &OverlayRendererImpl::LoadScaledTextures))); |
2860 | parent->owner_type.changed.connect(sigc::hide(sigc::mem_fun(this, &OverlayRendererImpl::LoadScaledTextures))); |
2861 | - Settings::Instance().low_gfx_changed.connect(sigc::mem_fun(this, &OverlayRendererImpl::UpdateTextures)); |
2862 | + Settings::Instance().low_gfx.changed.connect(sigc::hide(sigc::mem_fun(this, &OverlayRendererImpl::UpdateTextures))); |
2863 | Settings::Instance().launcher_position.changed.connect(sigc::hide(sigc::mem_fun(this, &OverlayRendererImpl::LoadScaledTextures))); |
2864 | dash::Style::Instance().textures_changed.connect(sigc::mem_fun(this, &OverlayRendererImpl::UpdateTextures)); |
2865 | dash::Style::Instance().textures_changed.connect(sigc::mem_fun(this, &OverlayRendererImpl::LoadScaledTextures)); |
2866 | @@ -157,7 +157,7 @@ |
2867 | bg_layer_->SetColor(new_color); |
2868 | |
2869 | //When we are in low gfx mode then our darken layer will act as a background. |
2870 | - if (Settings::Instance().GetLowGfxMode()) |
2871 | + if (Settings::Instance().low_gfx()) |
2872 | { |
2873 | bg_darken_layer_->SetColor(new_color); |
2874 | } |
2875 | @@ -172,7 +172,7 @@ |
2876 | rop.SrcBlend = GL_ONE; |
2877 | rop.DstBlend = GL_ONE_MINUS_SRC_ALPHA; |
2878 | |
2879 | - if (Settings::Instance().GetLowGfxMode() || !nux::GetWindowThread()->GetGraphicsEngine().UsingGLSLCodePath()) |
2880 | + if (Settings::Instance().low_gfx() || !nux::GetWindowThread()->GetGraphicsEngine().UsingGLSLCodePath()) |
2881 | { |
2882 | auto& avg_color = WindowManager::Default().average_color; |
2883 | bg_layer_ = std::make_shared<nux::ColorLayer>(avg_color(), true, rop); |
2884 | @@ -185,7 +185,7 @@ |
2885 | nux::Color darken_colour = nux::Color(0.9f, 0.9f, 0.9f, 1.0f); |
2886 | |
2887 | //When we are in low gfx mode then our darken layer will act as a background. |
2888 | - if (Settings::Instance().GetLowGfxMode()) |
2889 | + if (Settings::Instance().low_gfx()) |
2890 | { |
2891 | rop.Blend = false; |
2892 | rop.SrcBlend = GL_ONE; |
2893 | @@ -565,7 +565,7 @@ |
2894 | bg_darken_layer_->SetGeometry(larger_content_geo); |
2895 | nux::GetPainter().RenderSinglePaintLayer(gfx_context, larger_content_geo, bg_darken_layer_.get()); |
2896 | |
2897 | - if (!settings.GetLowGfxMode()) |
2898 | + if (!settings.low_gfx()) |
2899 | { |
2900 | #ifndef NUX_OPENGLES_20 |
2901 | if (!gfx_context.UsingGLSLCodePath()) |
2902 | @@ -984,7 +984,7 @@ |
2903 | bgs++; |
2904 | |
2905 | //Only apply shine if we aren't in low gfx mode. |
2906 | - if (!Settings::Instance().GetLowGfxMode()) |
2907 | + if (!Settings::Instance().low_gfx()) |
2908 | { |
2909 | #ifndef NUX_OPENGLES_20 |
2910 | if (!gfx_context.UsingGLSLCodePath()) |
2911 | |
2912 | === modified file 'unity-shared/PlacesOverlayVScrollBar.cpp' |
2913 | --- unity-shared/PlacesOverlayVScrollBar.cpp 2016-02-17 12:37:04 +0000 |
2914 | +++ unity-shared/PlacesOverlayVScrollBar.cpp 2016-07-15 10:12:55 +0000 |
2915 | @@ -23,6 +23,7 @@ |
2916 | #include "AnimationUtils.h" |
2917 | #include "DashStyle.h" |
2918 | #include "PlacesOverlayVScrollBar.h" |
2919 | +#include "UnitySettings.h" |
2920 | |
2921 | namespace unity |
2922 | { |
2923 | @@ -124,7 +125,7 @@ |
2924 | |
2925 | void PlacesOverlayVScrollBar::PerformPageNavigation(ScrollDir dir) |
2926 | { |
2927 | - StartScrollAnimation(dir, _slider->GetBaseHeight(), PAGE_SCROLL_ANIMATION); |
2928 | + StartScrollAnimation(dir, _slider->GetBaseHeight(), Settings::Instance().low_gfx() ? 0 : PAGE_SCROLL_ANIMATION); |
2929 | } |
2930 | |
2931 | void PlacesOverlayVScrollBar::StartScrollAnimation(ScrollDir dir, int stop, unsigned duration) |
2932 | |
2933 | === modified file 'unity-shared/SpreadFilter.cpp' |
2934 | --- unity-shared/SpreadFilter.cpp 2015-12-23 01:16:53 +0000 |
2935 | +++ unity-shared/SpreadFilter.cpp 2016-07-15 10:12:55 +0000 |
2936 | @@ -49,7 +49,7 @@ |
2937 | } |
2938 | |
2939 | Filter::Filter() |
2940 | - : fade_animator_(FADE_DURATION) |
2941 | + : fade_animator_(Settings::Instance().low_gfx() ? 0 : FADE_DURATION) |
2942 | { |
2943 | auto& wm = WindowManager::Default(); |
2944 | auto& settings = Settings::Instance(); |
2945 | @@ -110,6 +110,10 @@ |
2946 | } |
2947 | }); |
2948 | |
2949 | + Settings::Instance().low_gfx.changed.connect(sigc::track_obj([this] (bool low_gfx) { |
2950 | + fade_animator_.SetDuration(low_gfx ? 0 : FADE_DURATION); |
2951 | + }, *this)); |
2952 | + |
2953 | ApplicationManager::Default().window_opened.connect(sigc::hide(sigc::mem_fun(this, &Filter::OnWindowChanged))); |
2954 | } |
2955 | |
2956 | |
2957 | === modified file 'unity-shared/UnitySettings.cpp' |
2958 | --- unity-shared/UnitySettings.cpp 2016-03-18 01:47:08 +0000 |
2959 | +++ unity-shared/UnitySettings.cpp 2016-07-15 10:12:55 +0000 |
2960 | @@ -39,6 +39,7 @@ |
2961 | const std::string FORM_FACTOR = "form-factor"; |
2962 | const std::string DOUBLE_CLICK_ACTIVATE = "double-click-activate"; |
2963 | const std::string DESKTOP_TYPE = "desktop-type"; |
2964 | +const std::string PAM_CHECK_ACCOUNT_TYPE = "pam-check-account-type"; |
2965 | |
2966 | const std::string LAUNCHER_SETTINGS = "com.canonical.Unity.Launcher"; |
2967 | const std::string LAUNCHER_POSITION = "launcher-position"; |
2968 | @@ -66,6 +67,11 @@ |
2969 | const std::string REMOTE_CONTENT_SETTINGS = "com.canonical.Unity.Lenses"; |
2970 | const std::string REMOTE_CONTENT_KEY = "remote-content-search"; |
2971 | |
2972 | +const std::string GESTURES_SETTINGS = "com.canonical.Unity.Gestures"; |
2973 | +const std::string LAUNCHER_DRAG = "launcher-drag"; |
2974 | +const std::string DASH_TAP = "dash-tap"; |
2975 | +const std::string WINDOWS_DRAG_PINCH = "windows-drag-pinch"; |
2976 | + |
2977 | const int DEFAULT_LAUNCHER_SIZE = 64; |
2978 | const int MINIMUM_DESKTOP_HEIGHT = 800; |
2979 | const int GNOME_SETTINGS_CHANGED_WAIT_SECONDS = 1; |
2980 | @@ -83,6 +89,7 @@ |
2981 | , usettings_(g_settings_new(SETTINGS_NAME.c_str())) |
2982 | , launcher_settings_(g_settings_new(LAUNCHER_SETTINGS.c_str())) |
2983 | , lim_settings_(g_settings_new(LIM_SETTINGS.c_str())) |
2984 | + , gestures_settings_(g_settings_new(GESTURES_SETTINGS.c_str())) |
2985 | , ui_settings_(g_settings_new(UI_SETTINGS.c_str())) |
2986 | , ubuntu_ui_settings_(g_settings_new(UBUNTU_UI_SETTINGS.c_str())) |
2987 | , gnome_ui_settings_(g_settings_new(GNOME_UI_SETTINGS.c_str())) |
2988 | @@ -93,7 +100,6 @@ |
2989 | , cursor_scale_(1.0) |
2990 | , cached_double_click_activate_(true) |
2991 | , changing_gnome_settings_(false) |
2992 | - , lowGfx_(false) |
2993 | , remote_content_enabled_(true) |
2994 | { |
2995 | parent_->form_factor.SetGetterFunction(sigc::mem_fun(this, &Impl::GetFormFactor)); |
2996 | @@ -103,6 +109,7 @@ |
2997 | parent_->launcher_position.SetGetterFunction(sigc::mem_fun(this, &Impl::GetLauncherPosition)); |
2998 | parent_->launcher_position.SetSetterFunction(sigc::mem_fun(this, &Impl::SetLauncherPosition)); |
2999 | parent_->desktop_type.SetGetterFunction(sigc::mem_fun(this, &Impl::GetDesktopType)); |
3000 | + parent_->pam_check_account_type.SetGetterFunction(sigc::mem_fun(this, &Impl::GetPamCheckAccountType)); |
3001 | |
3002 | for (unsigned i = 0; i < monitors::MAX; ++i) |
3003 | em_converters_.emplace_back(std::make_shared<EMConverter>()); |
3004 | @@ -160,6 +167,10 @@ |
3005 | UpdateLimSetting(); |
3006 | }); |
3007 | |
3008 | + signals_.Add<void, GSettings*, const gchar*>(gestures_settings_, "changed", [this] (GSettings*, const gchar*) { |
3009 | + UpdateGesturesSetting(); |
3010 | + }); |
3011 | + |
3012 | signals_.Add<void, GSettings*, const gchar*>(remote_content_settings_, "changed::" + REMOTE_CONTENT_KEY, [this] (GSettings*, const gchar* t) { |
3013 | UpdateRemoteContentSearch(); |
3014 | }); |
3015 | @@ -168,6 +179,7 @@ |
3016 | |
3017 | // The order is important here, DPI is the last thing to be updated |
3018 | UpdateLimSetting(); |
3019 | + UpdateGesturesSetting(); |
3020 | UpdateTextScaleFactor(); |
3021 | UpdateCursorScaleFactor(); |
3022 | UpdateFontSize(); |
3023 | @@ -222,6 +234,14 @@ |
3024 | parent_->lim_unfocused_popup = g_settings_get_boolean(lim_settings_, UNFOCUSED_MENU_POPUP.c_str()); |
3025 | } |
3026 | |
3027 | + void UpdateGesturesSetting() |
3028 | + { |
3029 | + parent_->gestures_launcher_drag = g_settings_get_boolean(gestures_settings_, LAUNCHER_DRAG.c_str()); |
3030 | + parent_->gestures_dash_tap = g_settings_get_boolean(gestures_settings_, DASH_TAP.c_str()); |
3031 | + parent_->gestures_windows_drag_pinch = g_settings_get_boolean(gestures_settings_, WINDOWS_DRAG_PINCH.c_str()); |
3032 | + parent_->gestures_changed.emit(); |
3033 | + } |
3034 | + |
3035 | FormFactor GetFormFactor() const |
3036 | { |
3037 | return cached_form_factor_; |
3038 | @@ -254,6 +274,11 @@ |
3039 | return static_cast<DesktopType>(g_settings_get_enum(usettings_, DESKTOP_TYPE.c_str())); |
3040 | } |
3041 | |
3042 | + bool GetPamCheckAccountType() const |
3043 | + { |
3044 | + return g_settings_get_boolean(usettings_, PAM_CHECK_ACCOUNT_TYPE.c_str()); |
3045 | + } |
3046 | + |
3047 | int GetFontSize() const |
3048 | { |
3049 | gint font_size; |
3050 | @@ -384,6 +409,7 @@ |
3051 | glib::Object<GSettings> usettings_; |
3052 | glib::Object<GSettings> launcher_settings_; |
3053 | glib::Object<GSettings> lim_settings_; |
3054 | + glib::Object<GSettings> gestures_settings_; |
3055 | glib::Object<GSettings> ui_settings_; |
3056 | glib::Object<GSettings> ubuntu_ui_settings_; |
3057 | glib::Object<GSettings> gnome_ui_settings_; |
3058 | @@ -397,7 +423,6 @@ |
3059 | double cursor_scale_; |
3060 | bool cached_double_click_activate_; |
3061 | bool changing_gnome_settings_; |
3062 | - bool lowGfx_; |
3063 | bool remote_content_enabled_; |
3064 | }; |
3065 | |
3066 | @@ -406,7 +431,8 @@ |
3067 | // |
3068 | |
3069 | Settings::Settings() |
3070 | - : is_standalone(false) |
3071 | + : low_gfx(false) |
3072 | + , is_standalone(false) |
3073 | , pimpl(new Impl(this)) |
3074 | { |
3075 | if (settings_instance) |
3076 | @@ -434,21 +460,6 @@ |
3077 | return *settings_instance; |
3078 | } |
3079 | |
3080 | -bool Settings::GetLowGfxMode() const |
3081 | -{ |
3082 | - return pimpl->lowGfx_; |
3083 | -} |
3084 | - |
3085 | -void Settings::SetLowGfxMode(const bool low_gfx) |
3086 | -{ |
3087 | - if (pimpl->lowGfx_ != low_gfx) |
3088 | - { |
3089 | - pimpl->lowGfx_ = low_gfx; |
3090 | - |
3091 | - low_gfx_changed.emit(); |
3092 | - } |
3093 | -} |
3094 | - |
3095 | EMConverter::Ptr const& Settings::em(int monitor) const |
3096 | { |
3097 | return pimpl->em(monitor); |
3098 | |
3099 | === modified file 'unity-shared/UnitySettings.h' |
3100 | --- unity-shared/UnitySettings.h 2016-03-18 01:47:08 +0000 |
3101 | +++ unity-shared/UnitySettings.h 2016-07-15 10:12:55 +0000 |
3102 | @@ -54,16 +54,16 @@ |
3103 | ~Settings(); |
3104 | |
3105 | static Settings& Instance(); |
3106 | - bool GetLowGfxMode() const; |
3107 | - void SetLowGfxMode(const bool low_gfx); |
3108 | EMConverter::Ptr const& em(int monitor = 0) const; |
3109 | |
3110 | void SetLauncherSize(int launcher_size, int monitor); |
3111 | int LauncherSize(int mointor) const; |
3112 | |
3113 | + nux::Property<bool> low_gfx; |
3114 | nux::RWProperty<FormFactor> form_factor; |
3115 | nux::Property<bool> is_standalone; |
3116 | nux::ROProperty<DesktopType> desktop_type; |
3117 | + nux::ROProperty<bool> pam_check_account_type; |
3118 | nux::ROProperty<bool> double_click_activate; |
3119 | nux::Property<unsigned> lim_movement_thresold; |
3120 | nux::Property<unsigned> lim_double_click_wait; |
3121 | @@ -71,9 +71,13 @@ |
3122 | nux::Property<double> font_scaling; |
3123 | nux::ROProperty<bool> remote_content; |
3124 | nux::RWProperty<LauncherPosition> launcher_position; |
3125 | + nux::Property<bool> gestures_launcher_drag; |
3126 | + nux::Property<bool> gestures_dash_tap; |
3127 | + nux::Property<bool> gestures_windows_drag_pinch; |
3128 | |
3129 | sigc::signal<void> dpi_changed; |
3130 | sigc::signal<void> low_gfx_changed; |
3131 | + sigc::signal<void> gestures_changed; |
3132 | |
3133 | private: |
3134 | class Impl; |
3135 | |
3136 | === modified file 'unity-shared/UnityWindowView.cpp' |
3137 | --- unity-shared/UnityWindowView.cpp 2016-03-31 03:29:07 +0000 |
3138 | +++ unity-shared/UnityWindowView.cpp 2016-07-15 10:12:55 +0000 |
3139 | @@ -282,7 +282,7 @@ |
3140 | auto temp_background_color = background_color(); |
3141 | auto blend_mode = nux::LAYER_BLEND_MODE_OVERLAY; |
3142 | |
3143 | - if (Settings::Instance().GetLowGfxMode() || BackgroundEffectHelper::blur_type == BLUR_NONE) |
3144 | + if (Settings::Instance().low_gfx() || BackgroundEffectHelper::blur_type == BLUR_NONE) |
3145 | { |
3146 | temp_background_color.alpha = 1.0f; |
3147 | blend_mode = nux::LAYER_BLEND_MODE_NORMAL; |
Looks good thanks.