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