Merge lp:~unity-team/unity/x-sru2 into lp:unity/7.4

Proposed by Marco Trevisan (Treviño) on 2016-06-29
Status: Merged
Approved by: Andrea Azzarone on 2016-07-06
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
Reviewer Review Type Date Requested Status
Andrea Azzarone (community) 2016-06-29 Approve on 2016-07-06
Review via email: mp+298665@code.launchpad.net

Commit message

Releasing SRU2 for Xenial

To post a comment you must log in.
lp:~unity-team/unity/x-sru2 updated on 2016-07-05
4120. By Marco Trevisan (Treviño) on 2016-06-29

debian/changelog: fix author

4121. By Andrea Azzarone on 2016-06-30

Add missing header to fix compilation error with -Duse_pch=OFF.

4122. By Andrea Azzarone on 2016-06-30

Filter out fullscreen window in show desktop mode.

4123. By Andrea Azzarone on 2016-07-05

Make sure file manager icon is not removed when unpinned.

4124. By Andrea Azzarone on 2016-07-05

Properly calculate the intersection geometry in PanelView::Draw. This is needed to properly call SyncGeometries and to avoid problems such as lp:1595698.

4125. By Marco Trevisan (Treviño) on 2016-07-05

LockScreenAcceleratorController: check if a setting key is available instead of crashing

4126. By Marco Trevisan (Treviño) on 2016-07-05

ApplicationLauncherIcon: ensure quirks are properly set on icon initialization

4127. By Eleni Maria Stea on 2016-07-05

speeds up the showdesktop plugin in lowgfx mode

4128. By Marco Trevisan (Treviño) on 2016-07-05

Views: Toggle animators durations based on low-gfx setting

Disable animations based on low_gfx setting (now ported to nux::Property)

4129. By Marco Trevisan (Treviño) on 2016-07-05

unity7.conf: use different compiz profile based on unity_support_test result

Andrea Azzarone (azzar1) wrote :

Looks good thanks.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'UnityCore/GnomeSessionManager.cpp'
--- UnityCore/GnomeSessionManager.cpp 2016-03-31 09:51:33 +0000
+++ UnityCore/GnomeSessionManager.cpp 2016-07-15 10:12:55 +0000
@@ -117,8 +117,9 @@
117117
118 login_proxy_->ConnectProperty("Active", [this] (GVariant* variant) {118 login_proxy_->ConnectProperty("Active", [this] (GVariant* variant) {
119 bool active = glib::Variant(variant).GetBool();119 bool active = glib::Variant(variant).GetBool();
120 manager_->screensaver_requested.emit(!active);
121 manager_->is_session_active.changed.emit(active);120 manager_->is_session_active.changed.emit(active);
121 if (active)
122 manager_->screensaver_requested.emit(false);
122 });123 });
123124
124 manager_->is_session_active.SetGetterFunction([this] {125 manager_->is_session_active.SetGetterFunction([this] {
125126
=== modified file 'com.canonical.Unity.gschema.xml'
--- com.canonical.Unity.gschema.xml 2016-03-18 01:47:08 +0000
+++ com.canonical.Unity.gschema.xml 2016-07-15 10:12:55 +0000
@@ -81,6 +81,25 @@
81 integrated menus are enabled), otherwise they will be shown only when81 integrated menus are enabled), otherwise they will be shown only when
82 the mouse cursor is over the relative mouse area.</description>82 the mouse cursor is over the relative mouse area.</description>
83 </key>83 </key>
84 <key type="as" name="whitelist-repeated-keys">
85 <default>[
86 'XF86KbdBrightnessUp',
87 'XF86KbdBrightnessDown',
88 'XF86MonBrightnessUp',
89 'XF86MonBrightnessDown',
90 'XF86AudioRaiseVolume',
91 'XF86AudioLowerVolume'
92 ]</default>
93 <summary>List of keycodes that should be processed even if auto-repated.</summary>
94 <description>These keycodes are processed even if they are auto-repeated.</description>
95 </key>
96 <key type="b" name="pam-check-account-type">
97 <default>false</default>
98 <summary>Enable/Disable PAM account checking</summary>
99 <description>Whether PAM should check the result of account modules
100 when authenticating. Only do this if you have account
101 configured properly on your system.</description>
102 </key>
84 </schema>103 </schema>
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">
86 <key type="d" name="text-scale-factor">105 <key type="d" name="text-scale-factor">
@@ -208,4 +227,23 @@
208 when clicking over unfocused menu entries</description>227 when clicking over unfocused menu entries</description>
209 </key>228 </key>
210 </schema>229 </schema>
230 <schema path="/com/canonical/unity/gestures/" id="com.canonical.Unity.Gestures" gettext-domain="unity">
231 <key type="b" name="launcher-drag">
232 <default>true</default>
233 <summary>Multi-touch gesture to reveal the launcher.</summary>
234 <description>When this is enabled, a 4 finger swipe from left to right will reveal launcher,
235 provided that the launcher is set to auto-hide.</description>
236 </key>
237 <key type="b" name="dash-tap">
238 <default>true</default>
239 <summary>Multi-touch gesture to open the dash.</summary>
240 <description>When this is enabled, a 4 finger tap will open the dash.</description>
241 </key>
242 <key type="b" name="windows-drag-pinch">
243 <default>true</default>
244 <summary>Multi-touch gestures to manage the windows.</summary>
245 <description>When this is enabled, 3 finger gestures such as drag, and pinch, will
246 help manage the windows.</description>
247 </key>
248 </schema>
211</schemalist>249</schemalist>
212250
=== modified file 'dash/DashController.cpp'
--- dash/DashController.cpp 2016-03-30 14:37:36 +0000
+++ dash/DashController.cpp 2016-07-15 10:12:55 +0000
@@ -43,7 +43,8 @@
4343
44namespace44namespace
45{45{
46unsigned const PRELOAD_TIMEOUT_LENGTH = 40;46const unsigned PRELOAD_TIMEOUT_LENGTH = 40;
47const unsigned FADE_DURATION = 90;
4748
48namespace dbus49namespace dbus
49{50{
@@ -68,7 +69,7 @@
68 , visible_(false)69 , visible_(false)
69 , dbus_server_(dbus::BUS_NAME)70 , dbus_server_(dbus::BUS_NAME)
70 , ensure_timeout_(PRELOAD_TIMEOUT_LENGTH)71 , ensure_timeout_(PRELOAD_TIMEOUT_LENGTH)
71 , timeline_animator_(90)72 , timeline_animator_(Settings::Instance().low_gfx() ? 0 : FADE_DURATION)
72{73{
73 RegisterUBusInterests();74 RegisterUBusInterests();
7475
@@ -91,6 +92,9 @@
91 SetupWindow();92 SetupWindow();
92 UScreen::GetDefault()->changed.connect(sigc::mem_fun(this, &Controller::OnMonitorChanged));93 UScreen::GetDefault()->changed.connect(sigc::mem_fun(this, &Controller::OnMonitorChanged));
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)));
95 Settings::Instance().low_gfx.changed.connect(sigc::track_obj([this] (bool low_gfx) {
96 timeline_animator_.SetDuration(low_gfx ? 0 : FADE_DURATION);
97 }, *this));
9498
95 form_factor_changed_ = Settings::Instance().form_factor.changed.connect([this] (FormFactor)99 form_factor_changed_ = Settings::Instance().form_factor.changed.connect([this] (FormFactor)
96 {100 {
97101
=== modified file 'dash/DashView.cpp'
--- dash/DashView.cpp 2016-03-18 01:47:08 +0000
+++ dash/DashView.cpp 2016-07-15 10:12:55 +0000
@@ -313,13 +313,15 @@
313 preview_animation_.reset();313 preview_animation_.reset();
314 preview_container_animation_.reset();314 preview_container_animation_.reset();
315315
316 double anim_length = Settings::Instance().low_gfx() ? 0 : PREVIEW_ANIMATION_LENGTH;
317
316 // Dash Split Open Animation318 // Dash Split Open Animation
317 split_animation_.reset(new na::AnimateValue<float>());319 split_animation_.reset(new na::AnimateValue<float>());
318 split_animation_->SetDuration((1.0f - animate_split_value_) * PREVIEW_ANIMATION_LENGTH);320 split_animation_->SetDuration((1.0f - animate_split_value_) * anim_length);
319 split_animation_->SetStartValue(animate_split_value_);321 split_animation_->SetStartValue(animate_split_value_);
320 split_animation_->SetFinishValue(1.0f);322 split_animation_->SetFinishValue(1.0f);
321 split_animation_->SetEasingCurve(na::EasingCurve(na::EasingCurve::Type::Linear));323 split_animation_->SetEasingCurve(na::EasingCurve(na::EasingCurve::Type::Linear));
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)
323 {325 {
324 static na::EasingCurve split_animation_curve(na::EasingCurve::Type::InQuad);326 static na::EasingCurve split_animation_curve(na::EasingCurve::Type::InQuad);
325327
@@ -331,11 +333,11 @@
331 {333 {
332 // Preview Container Close Animation334 // Preview Container Close Animation
333 preview_container_animation_.reset(new na::AnimateValue<float>());335 preview_container_animation_.reset(new na::AnimateValue<float>());
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);
335 preview_container_animation_->SetStartValue(animate_preview_container_value_);337 preview_container_animation_->SetStartValue(animate_preview_container_value_);
336 preview_container_animation_->SetFinishValue(1.0f);338 preview_container_animation_->SetFinishValue(1.0f);
337 preview_container_animation_->SetEasingCurve(na::EasingCurve(na::EasingCurve::Type::Linear));339 preview_container_animation_->SetEasingCurve(na::EasingCurve(na::EasingCurve::Type::Linear));
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)
339 {341 {
340 static na::EasingCurve preview_container_animation_curve(na::EasingCurve::Type::InQuad);342 static na::EasingCurve preview_container_animation_curve(na::EasingCurve::Type::InQuad);
341343
@@ -347,7 +349,7 @@
347 {349 {
348 // Preview Close Animation350 // Preview Close Animation
349 preview_animation_.reset(new na::AnimateValue<float>());351 preview_animation_.reset(new na::AnimateValue<float>());
350 preview_animation_->SetDuration((1.0f - animate_preview_value_) * PREVIEW_ANIMATION_LENGTH);352 preview_animation_->SetDuration((1.0f - animate_preview_value_) * anim_length);
351 preview_animation_->SetStartValue(animate_preview_value_);353 preview_animation_->SetStartValue(animate_preview_value_);
352 preview_animation_->SetFinishValue(1.0f);354 preview_animation_->SetFinishValue(1.0f);
353 preview_animation_->SetEasingCurve(na::EasingCurve(na::EasingCurve::Type::Linear));355 preview_animation_->SetEasingCurve(na::EasingCurve(na::EasingCurve::Type::Linear));
@@ -382,13 +384,15 @@
382 split_animation_.reset();384 split_animation_.reset();
383 preview_container_animation_.reset();385 preview_container_animation_.reset();
384386
387 double anim_length = Settings::Instance().low_gfx() ? 0 : PREVIEW_ANIMATION_LENGTH;
388
385 // Preview Close Animation389 // Preview Close Animation
386 preview_animation_.reset(new na::AnimateValue<float>());390 preview_animation_.reset(new na::AnimateValue<float>());
387 preview_animation_->SetDuration(animate_preview_value_ * PREVIEW_ANIMATION_LENGTH);391 preview_animation_->SetDuration(animate_preview_value_ * anim_length);
388 preview_animation_->SetStartValue(1.0f - animate_preview_value_);392 preview_animation_->SetStartValue(1.0f - animate_preview_value_);
389 preview_animation_->SetFinishValue(1.0f);393 preview_animation_->SetFinishValue(1.0f);
390 preview_animation_->SetEasingCurve(na::EasingCurve(na::EasingCurve::Type::Linear));394 preview_animation_->SetEasingCurve(na::EasingCurve(na::EasingCurve::Type::Linear));
391 preview_animation_->updated.connect([this](float const& preview_value)395 preview_animation_->updated.connect([this, anim_length](float const& preview_value)
392 {396 {
393 animate_preview_value_ = 1.0f - preview_value;397 animate_preview_value_ = 1.0f - preview_value;
394 QueueDraw();398 QueueDraw();
@@ -398,11 +402,11 @@
398 {402 {
399 // Preview Container Close Animation403 // Preview Container Close Animation
400 preview_container_animation_.reset(new na::AnimateValue<float>());404 preview_container_animation_.reset(new na::AnimateValue<float>());
401 preview_container_animation_->SetDuration(animate_preview_container_value_ * PREVIEW_ANIMATION_LENGTH);405 preview_container_animation_->SetDuration(animate_preview_container_value_ * anim_length);
402 preview_container_animation_->SetStartValue(1.0f - animate_preview_container_value_);406 preview_container_animation_->SetStartValue(1.0f - animate_preview_container_value_);
403 preview_container_animation_->SetFinishValue(1.0f);407 preview_container_animation_->SetFinishValue(1.0f);
404 preview_container_animation_->SetEasingCurve(na::EasingCurve(na::EasingCurve::Type::Linear));408 preview_container_animation_->SetEasingCurve(na::EasingCurve(na::EasingCurve::Type::Linear));
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)
406 {410 {
407 static na::EasingCurve preview_container_animation_curve(na::EasingCurve::Type::InQuad);411 static na::EasingCurve preview_container_animation_curve(na::EasingCurve::Type::InQuad);
408412
@@ -413,7 +417,7 @@
413 {417 {
414 // Dash Split Close Animation418 // Dash Split Close Animation
415 split_animation_.reset(new na::AnimateValue<float>());419 split_animation_.reset(new na::AnimateValue<float>());
416 split_animation_->SetDuration(animate_split_value_ * PREVIEW_ANIMATION_LENGTH);420 split_animation_->SetDuration(animate_split_value_ * anim_length);
417 split_animation_->SetStartValue(1.0f - animate_split_value_);421 split_animation_->SetStartValue(1.0f - animate_split_value_);
418 split_animation_->SetFinishValue(1.0f);422 split_animation_->SetFinishValue(1.0f);
419 split_animation_->SetEasingCurve(na::EasingCurve(na::EasingCurve::Type::Linear));423 split_animation_->SetEasingCurve(na::EasingCurve(na::EasingCurve::Type::Linear));
420424
=== modified file 'dash/StandaloneDash.cpp'
--- dash/StandaloneDash.cpp 2016-03-17 07:36:44 +0000
+++ dash/StandaloneDash.cpp 2016-07-15 10:12:55 +0000
@@ -93,6 +93,7 @@
93{93{
94 gtk_init (&argc, &argv);94 gtk_init (&argc, &argv);
9595
96 unity::Settings settings;
96 unity::BGHash bghash;97 unity::BGHash bghash;
97 unity::FontSettings font_settings;98 unity::FontSettings font_settings;
9899
@@ -100,7 +101,6 @@
100 nux::logging::configure_logging(::getenv("UNITY_LOG_SEVERITY"));101 nux::logging::configure_logging(::getenv("UNITY_LOG_SEVERITY"));
101 // The instances for the pseudo-singletons.102 // The instances for the pseudo-singletons.
102 unity::ThumbnailGenerator thumb_generator;103 unity::ThumbnailGenerator thumb_generator;
103 unity::Settings settings;
104 unity::dash::Style dash_style;104 unity::dash::Style dash_style;
105 unity::panel::Style panel_style;105 unity::panel::Style panel_style;
106106
107107
=== modified file 'dash/previews/PreviewContainer.cpp'
--- dash/previews/PreviewContainer.cpp 2014-07-30 00:49:35 +0000
+++ dash/previews/PreviewContainer.cpp 2016-07-15 10:12:55 +0000
@@ -23,11 +23,13 @@
23#include "PreviewContainer.h"23#include "PreviewContainer.h"
24#include <Nux/HLayout.h>24#include <Nux/HLayout.h>
2525
26#include "unity-shared/AnimationUtils.h"
26#include "unity-shared/IntrospectableWrappers.h"27#include "unity-shared/IntrospectableWrappers.h"
27#include "unity-shared/TimeUtil.h"28#include "unity-shared/TimeUtil.h"
28#include "unity-shared/PreviewStyle.h"29#include "unity-shared/PreviewStyle.h"
29#include "unity-shared/DashStyle.h"30#include "unity-shared/DashStyle.h"
30#include "unity-shared/GraphicsUtils.h"31#include "unity-shared/GraphicsUtils.h"
32#include "unity-shared/UnitySettings.h"
31#include "PreviewNavigator.h"33#include "PreviewNavigator.h"
32#include <boost/math/constants/constants.hpp>34#include <boost/math/constants/constants.hpp>
33#include "config.h"35#include "config.h"
@@ -49,7 +51,6 @@
49const int ANIM_DURATION_LONG = 500;51const int ANIM_DURATION_LONG = 500;
50const int PREVIEW_SPINNER_WAIT = 2000;52const int PREVIEW_SPINNER_WAIT = 2000;
5153
52const std::string ANIMATION_IDLE = "animation-idle";
53const RawPixel CHILDREN_SPACE = 6_em;54const RawPixel CHILDREN_SPACE = 6_em;
54}55}
5556
@@ -113,7 +114,7 @@
113 StopPreviewWait();114 StopPreviewWait();
114 // the parents layout will not change based on the previews.115 // the parents layout will not change based on the previews.
115 preview->SetReconfigureParentLayoutOnGeometryChange(false);116 preview->SetReconfigureParentLayoutOnGeometryChange(false);
116 117
117 AddChild(preview.GetPointer());118 AddChild(preview.GetPointer());
118 AddView(preview.GetPointer());119 AddView(preview.GetPointer());
119 preview->SetVisible(false);120 preview->SetVisible(false);
@@ -409,23 +410,21 @@
409 , scale(1.0)410 , scale(1.0)
410 , preview_layout_(nullptr)411 , preview_layout_(nullptr)
411 , nav_disabled_(Navigation::NONE)412 , nav_disabled_(Navigation::NONE)
412 , navigation_progress_speed_(0.0)413 , animation_(Settings::Instance().low_gfx() ? 0 : ANIM_DURATION_LONG)
413 , navigation_count_(0)
414{414{
415 SetAcceptKeyNavFocusOnMouseDown(false);415 SetAcceptKeyNavFocusOnMouseDown(false);
416 SetAcceptKeyNavFocusOnMouseEnter(false);416 SetAcceptKeyNavFocusOnMouseEnter(false);
417417
418 SetupViews();418 SetupViews();
419 last_progress_time_.tv_sec = 0;
420 last_progress_time_.tv_nsec = 0;
421419
422 key_down.connect(sigc::mem_fun(this, &PreviewContainer::OnKeyDown));420 key_down.connect(sigc::mem_fun(this, &PreviewContainer::OnKeyDown));
423 mouse_click.connect(sigc::mem_fun(this, &PreviewContainer::OnMouseDown));421 mouse_click.connect(sigc::mem_fun(this, &PreviewContainer::OnMouseDown));
424 scale.changed.connect(sigc::mem_fun(this, &PreviewContainer::UpdateScale));422 scale.changed.connect(sigc::mem_fun(this, &PreviewContainer::UpdateScale));
425}423 animation_.updated.connect(sigc::mem_fun(this, &PreviewContainer::QueueAnimation));
426424
427PreviewContainer::~PreviewContainer()425 Settings::Instance().low_gfx.changed.connect(sigc::track_obj([this] (bool low_gfx) {
428{426 animation_.SetDuration(low_gfx ? 0 : ANIM_DURATION_LONG);
427 }, *this));
429}428}
430429
431void PreviewContainer::Preview(dash::Preview::Ptr preview_model, Navigation direction)430void PreviewContainer::Preview(dash::Preview::Ptr preview_model, Navigation direction)
@@ -503,28 +502,22 @@
503502
504 layout->AddSpace(0, 1);503 layout->AddSpace(0, 1);
505504
506 preview_layout_->start_navigation.connect([this]()505 preview_layout_->start_navigation.connect([this]
507 {506 {
508 // reset animation clock.507 if (animation_.CurrentState() == na::Animation::State::Running)
509 if (navigation_count_ == 0)508 preview_layout_->UpdateAnimationProgress(1, 1);
510 clock_gettime(CLOCK_MONOTONIC, &last_progress_time_);509
511510 animation::Start(animation_, animation::Direction::FORWARD);
512 float navigation_progress_remaining = CLAMP((1.0 - preview_layout_->GetAnimationProgress()) + navigation_count_, 1.0f, 10.0f);511 });
513 navigation_count_++;512
514513 preview_layout_->continue_navigation.connect([this]
515 navigation_progress_speed_ = navigation_progress_remaining / ANIM_DURATION_LONG;514 {
516 QueueAnimation();515 QueueAnimation(animation_.GetCurrentValue());
517 });516 });
518517
519 preview_layout_->continue_navigation.connect([this]()518 preview_layout_->end_navigation.connect([this]
520 {519 {
521 QueueAnimation(); 520 animation_.Stop();
522 });
523
524 preview_layout_->end_navigation.connect([this]()
525 {
526 navigation_count_ = 0;
527 navigation_progress_speed_ = 0;
528 });521 });
529522
530 navigate_right.connect( [this]() { preview_layout_->StartPreviewWait(); } );523 navigate_right.connect( [this]() { preview_layout_->StartPreviewWait(); } );
@@ -551,17 +544,6 @@
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));
552 }545 }
553546
554 // rely on the compiz event loop to come back to us in a nice throttling
555 if (AnimationInProgress())
556 {
557 if (!animation_timer_)
558 animation_timer_.reset(new glib::Timeout(1000/60, sigc::mem_fun(this, &PreviewContainer::QueueAnimation)));
559 }
560 else if (preview_layout_ && preview_layout_->IsAnimating())
561 {
562 preview_layout_->UpdateAnimationProgress(1.0f, 1.0f);
563 }
564
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.
566 if (preview_layout_)548 if (preview_layout_)
567 {549 {
@@ -573,23 +555,9 @@
573 gfx_engine.PopClippingRectangle();555 gfx_engine.PopClippingRectangle();
574}556}
575557
576bool PreviewContainer::AnimationInProgress()558namespace
577{559{
578 // short circuit to avoid unneeded calculations560double easeInOutQuart(double t)
579 struct timespec current;
580 clock_gettime(CLOCK_MONOTONIC, &current);
581
582 if (preview_layout_ == nullptr)
583 return false;
584
585 // hover in animation
586 if (navigation_progress_speed_ > 0)
587 return true;
588
589 return false;
590}
591
592static float easeInOutQuart(float t)
593{561{
594 t = CLAMP(t, 0.0, 1.0);562 t = CLAMP(t, 0.0, 1.0);
595 t*=2.0f;563 t*=2.0f;
@@ -599,28 +567,19 @@
599 return -0.5f * (pow(t, 4)- 2);567 return -0.5f * (pow(t, 4)- 2);
600 }568 }
601}569}
602570}
603float PreviewContainer::GetSwipeAnimationProgress(struct timespec const& current) const571
604{572double PreviewContainer::GetSwipeAnimationProgress(struct timespec const& current) const
605 DeltaTime time_delta = TimeUtil::TimeDelta(&current, &last_progress_time_);573{
606 float progress = preview_layout_->GetAnimationProgress() + (navigation_progress_speed_ * time_delta);574 return preview_layout_ ? preview_layout_->GetAnimationProgress() : 0 + animation_.GetCurrentValue();
607575}
608 return progress;576
609}577void PreviewContainer::QueueAnimation(double progress)
610578{
611bool PreviewContainer::QueueAnimation()
612{
613 animation_timer_.reset();
614
615 timespec current;
616 clock_gettime(CLOCK_MONOTONIC, &current);
617 float progress = GetSwipeAnimationProgress(current);
618 if (preview_layout_)579 if (preview_layout_)
619 preview_layout_->UpdateAnimationProgress(progress, easeInOutQuart(progress)); // ease in/out.580 preview_layout_->UpdateAnimationProgress(progress, easeInOutQuart(progress)); // ease in/out.
620 last_progress_time_ = current;
621581
622 QueueDraw();582 QueueDraw();
623 return false;
624}583}
625584
626bool PreviewContainer::AcceptKeyNavFocus()585bool PreviewContainer::AcceptKeyNavFocus()
627586
=== modified file 'dash/previews/PreviewContainer.h'
--- dash/previews/PreviewContainer.h 2014-07-07 18:51:45 +0000
+++ dash/previews/PreviewContainer.h 2016-07-15 10:12:55 +0000
@@ -26,6 +26,7 @@
26#include <Nux/Nux.h>26#include <Nux/Nux.h>
27#include <Nux/View.h>27#include <Nux/View.h>
28#include <Nux/VLayout.h>28#include <Nux/VLayout.h>
29#include <NuxCore/Animation.h>
29#include <UnityCore/Preview.h>30#include <UnityCore/Preview.h>
30#include "Preview.h"31#include "Preview.h"
31#include "unity-shared/Introspectable.h"32#include "unity-shared/Introspectable.h"
@@ -57,7 +58,6 @@
57 NUX_DECLARE_OBJECT_TYPE(PreviewContainer, nux::View);58 NUX_DECLARE_OBJECT_TYPE(PreviewContainer, nux::View);
5859
59 PreviewContainer(NUX_FILE_LINE_PROTO);60 PreviewContainer(NUX_FILE_LINE_PROTO);
60 virtual ~PreviewContainer();
6161
62 void Preview(dash::Preview::Ptr preview_model, Navigation direction);62 void Preview(dash::Preview::Ptr preview_model, Navigation direction);
6363
@@ -98,10 +98,8 @@
98private:98private:
99 void SetupViews();99 void SetupViews();
100100
101 bool AnimationInProgress();101 void QueueAnimation(double progress);
102 float GetSwipeAnimationProgress(struct timespec const& current) const;102 double GetSwipeAnimationProgress(struct timespec const& current) const;
103
104 bool QueueAnimation();
105103
106private:104private:
107 void UpdateScale(double scale);105 void UpdateScale(double scale);
@@ -114,11 +112,8 @@
114 Navigation nav_disabled_;112 Navigation nav_disabled_;
115113
116 // Animation114 // Animation
117 struct timespec last_progress_time_;115 nux::animation::AnimateValue<double> animation_;
118 float navigation_progress_speed_;
119 int navigation_count_;
120116
121 glib::Source::UniquePtr animation_timer_;
122 friend class PreviewContent;117 friend class PreviewContent;
123};118};
124119
125120
=== modified file 'dash/previews/StandaloneApplicationPreview.cpp'
--- dash/previews/StandaloneApplicationPreview.cpp 2016-02-09 01:58:11 +0000
+++ dash/previews/StandaloneApplicationPreview.cpp 2016-07-15 10:12:55 +0000
@@ -21,10 +21,12 @@
21#include "config.h"21#include "config.h"
2222
23#include "Nux/Nux.h"23#include "Nux/Nux.h"
24#include "Nux/NuxTimerTickSource.h"
24#include "Nux/VLayout.h"25#include "Nux/VLayout.h"
25#include "Nux/WindowThread.h"26#include "Nux/WindowThread.h"
26#include "NuxGraphics/GraphicsEngine.h"27#include "NuxGraphics/GraphicsEngine.h"
27#include <Nux/Layout.h>28#include <Nux/Layout.h>
29#include <NuxCore/AnimationController.h>
28#include <NuxCore/Logger.h>30#include <NuxCore/Logger.h>
29#include <UnityCore/Variant.h>31#include <UnityCore/Variant.h>
30#include <UnityCore/ApplicationPreview.h>32#include <UnityCore/ApplicationPreview.h>
@@ -341,6 +343,9 @@
341 &TestRunner::InitWindowThread,343 &TestRunner::InitWindowThread,
342 test_runner);344 test_runner);
343345
346 nux::NuxTimerTickSource tick_source;
347 nux::animation::AnimationController animation_controller(tick_source);
348
344 wt->Run (NULL);349 wt->Run (NULL);
345 delete wt;350 delete wt;
346 return 0;351 return 0;
347352
=== modified file 'dash/previews/StandaloneErrorPreview.cpp'
--- dash/previews/StandaloneErrorPreview.cpp 2014-07-08 16:50:54 +0000
+++ dash/previews/StandaloneErrorPreview.cpp 2016-07-15 10:12:55 +0000
@@ -24,6 +24,8 @@
24#include "Nux/VLayout.h"24#include "Nux/VLayout.h"
25#include "Nux/WindowThread.h"25#include "Nux/WindowThread.h"
26#include "NuxGraphics/GraphicsEngine.h"26#include "NuxGraphics/GraphicsEngine.h"
27#include "Nux/NuxTimerTickSource.h"
28#include <NuxCore/AnimationController.h>
27#include <Nux/Layout.h>29#include <Nux/Layout.h>
28#include <NuxCore/Logger.h>30#include <NuxCore/Logger.h>
29#include <UnityCore/Variant.h>31#include <UnityCore/Variant.h>
@@ -228,6 +230,9 @@
228 &TestRunner::InitWindowThread,230 &TestRunner::InitWindowThread,
229 test_runner);231 test_runner);
230232
233 nux::NuxTimerTickSource tick_source;
234 nux::animation::AnimationController animation_controller(tick_source);
235
231 wt->Run (NULL);236 wt->Run (NULL);
232 delete wt;237 delete wt;
233 return 0;238 return 0;
234239
=== modified file 'dash/previews/StandaloneMoviePreview.cpp'
--- dash/previews/StandaloneMoviePreview.cpp 2014-07-08 16:50:54 +0000
+++ dash/previews/StandaloneMoviePreview.cpp 2016-07-15 10:12:55 +0000
@@ -20,10 +20,12 @@
20#include <gtk/gtk.h>20#include <gtk/gtk.h>
2121
22#include "Nux/Nux.h"22#include "Nux/Nux.h"
23#include "Nux/NuxTimerTickSource.h"
23#include "Nux/VLayout.h"24#include "Nux/VLayout.h"
24#include "Nux/WindowThread.h"25#include "Nux/WindowThread.h"
25#include "NuxGraphics/GraphicsEngine.h"26#include "NuxGraphics/GraphicsEngine.h"
26#include <Nux/Layout.h>27#include <Nux/Layout.h>
28#include <NuxCore/AnimationController.h>
27#include <NuxCore/Logger.h>29#include <NuxCore/Logger.h>
28#include <UnityCore/Variant.h>30#include <UnityCore/Variant.h>
29#include <UnityCore/ApplicationPreview.h>31#include <UnityCore/ApplicationPreview.h>
@@ -257,6 +259,9 @@
257 &TestRunner::InitWindowThread,259 &TestRunner::InitWindowThread,
258 test_runner);260 test_runner);
259261
262 nux::NuxTimerTickSource tick_source;
263 nux::animation::AnimationController animation_controller(tick_source);
264
260 wt->Run (NULL);265 wt->Run (NULL);
261 delete wt;266 delete wt;
262 return 0;267 return 0;
263268
=== modified file 'dash/previews/StandaloneMusicPaymentPreview.cpp'
--- dash/previews/StandaloneMusicPaymentPreview.cpp 2014-07-08 16:50:54 +0000
+++ dash/previews/StandaloneMusicPaymentPreview.cpp 2016-07-15 10:12:55 +0000
@@ -21,9 +21,11 @@
2121
22#include "Nux/Nux.h"22#include "Nux/Nux.h"
23#include "Nux/VLayout.h"23#include "Nux/VLayout.h"
24#include "Nux/NuxTimerTickSource.h"
24#include "Nux/WindowThread.h"25#include "Nux/WindowThread.h"
25#include "NuxGraphics/GraphicsEngine.h"26#include "NuxGraphics/GraphicsEngine.h"
26#include <Nux/Layout.h>27#include <Nux/Layout.h>
28#include <NuxCore/AnimationController.h>
27#include <NuxCore/Logger.h>29#include <NuxCore/Logger.h>
28#include <UnityCore/Variant.h>30#include <UnityCore/Variant.h>
29#include <UnityCore/Preview.h>31#include <UnityCore/Preview.h>
@@ -232,6 +234,9 @@
232 &TestRunner::InitWindowThread,234 &TestRunner::InitWindowThread,
233 test_runner);235 test_runner);
234236
237 nux::NuxTimerTickSource tick_source;
238 nux::animation::AnimationController animation_controller(tick_source);
239
235 wt->Run (NULL);240 wt->Run (NULL);
236 delete wt;241 delete wt;
237 return 0;242 return 0;
238243
=== modified file 'dash/previews/StandaloneSocialPreview.cpp'
--- dash/previews/StandaloneSocialPreview.cpp 2016-02-09 01:58:11 +0000
+++ dash/previews/StandaloneSocialPreview.cpp 2016-07-15 10:12:55 +0000
@@ -20,10 +20,12 @@
20#include "config.h"20#include "config.h"
2121
22#include "Nux/Nux.h"22#include "Nux/Nux.h"
23#include "Nux/NuxTimerTickSource.h"
23#include "Nux/VLayout.h"24#include "Nux/VLayout.h"
24#include "Nux/WindowThread.h"25#include "Nux/WindowThread.h"
25#include "NuxGraphics/GraphicsEngine.h"26#include "NuxGraphics/GraphicsEngine.h"
26#include <Nux/Layout.h>27#include <Nux/Layout.h>
28#include <NuxCore/AnimationController.h>
27#include <NuxCore/Logger.h>29#include <NuxCore/Logger.h>
28#include <UnityCore/Variant.h>30#include <UnityCore/Variant.h>
29#include <UnityCore/SocialPreview.h>31#include <UnityCore/SocialPreview.h>
@@ -291,6 +293,9 @@
291 &TestRunner::InitWindowThread,293 &TestRunner::InitWindowThread,
292 test_runner);294 test_runner);
293295
296 nux::NuxTimerTickSource tick_source;
297 nux::animation::AnimationController animation_controller(tick_source);
298
294 wt->Run (NULL);299 wt->Run (NULL);
295 delete wt;300 delete wt;
296 return 0;301 return 0;
297302
=== modified file 'debian/changelog'
--- debian/changelog 2016-05-26 00:03:25 +0000
+++ debian/changelog 2016-07-15 10:12:55 +0000
@@ -1,3 +1,50 @@
1unity (7.4.0+16.04.20160526.1-0ubuntu2) UNRELEASED; urgency=medium
2
3 [ Eleni Maria Stea ]
4 * PanelView: Don't draw it if the geo doesn't intersect the monitor
5 geo (as in ezoom)
6 * speeds up the showdesktop plugin in lowgfx mode
7
8 [ Andrea Azzarone ]
9 * Add whitelist for auto-repated keys. (LP: #1586491)
10 * Fix scale window activation if in show desktop mode. (LP: #1582056)
11 * Order matters in the rendering. Draw launcher shadow after the
12 background in all cases. (LP: #1586374)
13 * Fallback to volume name if no other identifier is available. (LP:
14 #1103593)
15 * Do not trigger screensaver on session inactive. (LP: #1587507)
16 * Use SwitcherController::SetDetail instead of detail=... (LP:
17 #1587618)
18 * UnitySettings: Add an option to enable/disable pam account checking.
19 (LP: #1460649)
20 * Lockscreen: Make sure warning and errors are properly shown to the
21 user (LP: #1593696)
22 * Add missing header to fix compilation error with -Duse_pch=OFF.
23 * Filter out fullscreen window in show desktop mode. (LP: #1597706)
24 * Make sure file manager icon is not removed when unpinned. (LP:
25 #1578792)
26 * Properly calculate the intersection geometry in PanelView::Draw.
27 This is needed to properly call SyncGeometries and to avoid problems
28 such as lp:1595698. (LP: #1595698)
29
30 [ Alberto Milone ]
31 * UnitySettings: Add dconf keys for disabling multitouch gestures (LP:
32 #1589520)
33
34 [ Marco Trevisan (Treviño) ]
35 * LockScreenAcceleratorController: use key::Grabber to handle allowed
36 bindings (LP: #1438754)
37 * LockScreenAcceleratorController: check if a setting key is available
38 instead of crashing
39 * ApplicationLauncherIcon: ensure quirks are properly set on icon
40 initialization
41 * Views: Toggle animators durations based on low-gfx setting (LP:
42 #1598770)
43 * unity7.conf: use different compiz profile based on
44 unity_support_test result (LP: #1598770)
45
46 -- Marco Trevisan (Treviño) <marco@ubuntu.com> Wed, 29 Jun 2016 18:06:42 +0200
47
1unity (7.4.0+16.04.20160526.1-0ubuntu1) xenial; urgency=medium48unity (7.4.0+16.04.20160526.1-0ubuntu1) xenial; urgency=medium
249
3 [ Marco Trevisan (Treviño) ]50 [ Marco Trevisan (Treviño) ]
451
=== modified file 'debian/unity7.conf'
--- debian/unity7.conf 2014-02-10 12:34:09 +0000
+++ debian/unity7.conf 2016-07-15 10:12:55 +0000
@@ -1,7 +1,7 @@
1description "Unity Shell v7"1description "Unity Shell v7"
2author "Ted Gould <ted@ubuntu.com>"2author "Ted Gould <ted@ubuntu.com>, Marco Trevisan <marco@ubuntu.com>"
33
4start on xsession SESSION=ubuntu and (started gnome-settings-daemon or started unity-settings-daemon)4start on xsession SESSION=ubuntu and started unity-settings-daemon
5stop on desktop-end5stop on desktop-end
66
7pre-start script7pre-start script
@@ -12,11 +12,16 @@
12 echo "GNOME Session is starting Compiz"12 echo "GNOME Session is starting Compiz"
13 stop ; exit 013 stop ; exit 0
14 fi14 fi
15
16 compiz_profile="ubuntu"
17
18 if ! /usr/lib/nux/unity_support_test -p; then
19 compiz_profile="ubuntu-lowgfx"
20 fi
21
22 echo "Using compiz profile '$compiz_profile'"
23 initctl set-env -g COMPIZ_CONFIG_PROFILE="$compiz_profile"
15end script24end script
1625
17env COMPIZ_CONFIG_PROFILE="ubuntu"
18export COMPIZ_CONFIG_PROFILE
19
20respawn26respawn
21exec compiz27exec compiz
22
2328
=== modified file 'hud/HudController.cpp'
--- hud/HudController.cpp 2016-03-31 02:50:01 +0000
+++ hud/HudController.cpp 2016-07-15 10:12:55 +0000
@@ -40,8 +40,11 @@
40{40{
41namespace hud41namespace hud
42{42{
4343namespace
44{
44DECLARE_LOGGER(logger, "unity.hud.controller");45DECLARE_LOGGER(logger, "unity.hud.controller");
46const unsigned FADE_DURATION = 90;
47}
4548
46Controller::Controller(Controller::ViewCreator const& create_view,49Controller::Controller(Controller::ViewCreator const& create_view,
47 Controller::WindowCreator const& create_window)50 Controller::WindowCreator const& create_window)
@@ -54,7 +57,7 @@
54 , monitor_index_(0)57 , monitor_index_(0)
55 , create_view_(create_view)58 , create_view_(create_view)
56 , create_window_(create_window)59 , create_window_(create_window)
57 , timeline_animator_(90)60 , timeline_animator_(Settings::Instance().low_gfx() ? 0 : FADE_DURATION)
58{61{
59 LOG_DEBUG(logger) << "hud startup";62 LOG_DEBUG(logger) << "hud startup";
6063
6164
=== modified file 'launcher/ApplicationLauncherIcon.cpp'
--- launcher/ApplicationLauncherIcon.cpp 2016-01-20 15:12:49 +0000
+++ launcher/ApplicationLauncherIcon.cpp 2016-07-15 10:12:55 +0000
@@ -42,7 +42,6 @@
42DECLARE_LOGGER(logger, "unity.launcher.icon.application");42DECLARE_LOGGER(logger, "unity.launcher.icon.application");
4343
44// We use the "application-" prefix since the manager is protected, to avoid name clash44// We use the "application-" prefix since the manager is protected, to avoid name clash
45const std::string ICON_REMOVE_TIMEOUT = "application-icon-remove";
46const std::string DEFAULT_ICON = "application-default-icon";45const std::string DEFAULT_ICON = "application-default-icon";
4746
48enum MenuItemType47enum MenuItemType
@@ -109,14 +108,13 @@
109 app_->visible.changed.emit(app_->visible());108 app_->visible.changed.emit(app_->visible());
110 app_->active.changed.emit(app_->active());109 app_->active.changed.emit(app_->active());
111 app_->running.changed.emit(app_->running());110 app_->running.changed.emit(app_->running());
111 app_->urgent.changed.emit(app_->urgent());
112 app_->starting.changed.emit(app_->starting() || GetQuirk(Quirk::STARTING));
112 app_->desktop_file.changed.emit(app_->desktop_file());113 app_->desktop_file.changed.emit(app_->desktop_file());
113114
114 // Make sure we set the LauncherIcon stick bit too...115 // Make sure we set the LauncherIcon stick bit too...
115 if (app_->sticky() || was_sticky)116 if (app_->sticky() || was_sticky)
116 Stick(false); // don't emit the signal117 Stick(false); // don't emit the signal
117
118 if (app_->starting())
119 SetQuirk(Quirk::STARTING, true);
120}118}
121119
122void ApplicationLauncherIcon::UnsetApplication()120void ApplicationLauncherIcon::UnsetApplication()
123121
=== modified file 'launcher/ApplicationLauncherIcon.h'
--- launcher/ApplicationLauncherIcon.h 2015-12-07 18:04:33 +0000
+++ launcher/ApplicationLauncherIcon.h 2016-07-15 10:12:55 +0000
@@ -54,6 +54,9 @@
54 void UnStick() override;54 void UnStick() override;
5555
56protected:56protected:
57 // This must be defined here as it's used both in ApplicationLauncherIcon and in FileManagerLauncherIcon.
58 static constexpr const char* ICON_REMOVE_TIMEOUT = "application-icon-remove";
59
57 void SetApplication(ApplicationPtr const& app);60 void SetApplication(ApplicationPtr const& app);
58 ApplicationPtr GetApplication() const;61 ApplicationPtr GetApplication() const;
5962
6063
=== modified file 'launcher/CairoBaseWindow.cpp'
--- launcher/CairoBaseWindow.cpp 2016-03-17 04:22:27 +0000
+++ launcher/CairoBaseWindow.cpp 2016-07-15 10:12:55 +0000
@@ -44,13 +44,17 @@
4444
45CairoBaseWindow::CairoBaseWindow(int monitor)45CairoBaseWindow::CairoBaseWindow(int monitor)
46 : cv_(Settings::Instance().em(monitor))46 : cv_(Settings::Instance().em(monitor))
47 , use_blurred_background_(!Settings::Instance().GetLowGfxMode())47 , use_blurred_background_(!Settings::Instance().low_gfx())
48 , compute_blur_bkg_(use_blurred_background_)48 , compute_blur_bkg_(use_blurred_background_)
49 , fade_animator_(FADE_DURATION)49 , fade_animator_(Settings::Instance().low_gfx() ? 0 : FADE_DURATION)
50{50{
51 SetWindowSizeMatchLayout(true);51 SetWindowSizeMatchLayout(true);
52 sigVisible.connect([this] (BaseWindow*) { compute_blur_bkg_ = true; });52 sigVisible.connect([this] (BaseWindow*) { compute_blur_bkg_ = true; });
5353
54 Settings::Instance().low_gfx.changed.connect(sigc::track_obj([this] (bool low_gfx) {
55 fade_animator_.SetDuration(low_gfx ? 0 : FADE_DURATION);
56 }, *this));
57
54 fade_animator_.updated.connect(sigc::mem_fun(this, &BaseWindow::SetOpacity));58 fade_animator_.updated.connect(sigc::mem_fun(this, &BaseWindow::SetOpacity));
55 fade_animator_.finished.connect([this] {59 fade_animator_.finished.connect([this] {
56 if (animation::GetDirection(fade_animator_) == animation::Direction::BACKWARD)60 if (animation::GetDirection(fade_animator_) == animation::Direction::BACKWARD)
5761
=== modified file 'launcher/FileManagerLauncherIcon.cpp'
--- launcher/FileManagerLauncherIcon.cpp 2016-02-09 10:43:42 +0000
+++ launcher/FileManagerLauncherIcon.cpp 2016-07-15 10:12:55 +0000
@@ -67,6 +67,14 @@
67 icon_name = (icon.empty() ? DEFAULT_ICON : icon);67 icon_name = (icon.empty() ? DEFAULT_ICON : icon);
68 }));68 }));
6969
70 signals_conn_.Add(app_->running.changed.connect([this](bool running) {
71 LOG_DEBUG(logger) << tooltip_text() << " running now " << (running ? "true" : "false");
72
73 if (running)
74 _source_manager.Remove(ICON_REMOVE_TIMEOUT);
75 }));
76
77
70 UpdateStorageWindows();78 UpdateStorageWindows();
71}79}
7280
7381
=== modified file 'launcher/Launcher.cpp'
--- launcher/Launcher.cpp 2016-03-31 05:57:11 +0000
+++ launcher/Launcher.cpp 2016-07-15 10:12:55 +0000
@@ -72,6 +72,7 @@
72const int ANIM_DURATION_SHORT_SHORT = 100;72const int ANIM_DURATION_SHORT_SHORT = 100;
73const int ANIM_DURATION = 200;73const int ANIM_DURATION = 200;
74const int ANIM_DURATION_LONG = 350;74const int ANIM_DURATION_LONG = 350;
75const int ANIM_DURATION_DASH_SHOWING = 90;
75const int START_DRAGICON_DURATION = 250;76const int START_DRAGICON_DURATION = 250;
7677
77const RawPixel DEFAULT_ICON_SIZE = 48_em;78const RawPixel DEFAULT_ICON_SIZE = 48_em;
@@ -137,14 +138,14 @@
137 , drag_action_(nux::DNDACTION_NONE)138 , drag_action_(nux::DNDACTION_NONE)
138 , bg_effect_helper_(this)139 , bg_effect_helper_(this)
139 , launcher_position_(unity::Settings::Instance().launcher_position())140 , launcher_position_(unity::Settings::Instance().launcher_position())
140 , auto_hide_animation_(ANIM_DURATION_SHORT)141 , auto_hide_animation_(Settings::Instance().low_gfx ? 0 : ANIM_DURATION_SHORT)
141 , hover_animation_(ANIM_DURATION)142 , hover_animation_(Settings::Instance().low_gfx ? ANIM_DURATION_SHORT_SHORT : ANIM_DURATION)
142 , drag_over_animation_(ANIM_DURATION_LONG)143 , drag_over_animation_(Settings::Instance().low_gfx ? 0 : ANIM_DURATION_LONG)
143 , drag_out_animation_(ANIM_DURATION_SHORT)144 , drag_out_animation_(Settings::Instance().low_gfx ? 0 : ANIM_DURATION_SHORT)
144 , drag_icon_animation_(ANIM_DURATION_SHORT)145 , drag_icon_animation_(Settings::Instance().low_gfx ? 0 : ANIM_DURATION_SHORT)
145 , dnd_hide_animation_(ANIM_DURATION * 3)146 , dnd_hide_animation_(Settings::Instance().low_gfx ? 0 : ANIM_DURATION * 3)
146 , dash_showing_animation_(90)147 , dash_showing_animation_(Settings::Instance().low_gfx ? 0 : ANIM_DURATION_DASH_SHOWING)
147 , cv_(unity::Settings::Instance().em(monitor))148 , cv_(Settings::Instance().em(monitor))
148{149{
149 icon_renderer_->monitor = monitor();150 icon_renderer_->monitor = monitor();
150 icon_renderer_->scale = cv_->DPIScale();151 icon_renderer_->scale = cv_->DPIScale();
@@ -197,7 +198,17 @@
197 QueueDraw();198 QueueDraw();
198 });199 });
199200
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));
202 Settings::Instance().low_gfx.changed.connect(sigc::track_obj([this] (bool low_gfx) {
203 auto_hide_animation_.SetDuration(low_gfx ? 0 : ANIM_DURATION_SHORT);
204 hover_animation_.SetDuration(low_gfx ? ANIM_DURATION_SHORT_SHORT : ANIM_DURATION);
205 drag_over_animation_.SetDuration(low_gfx ? 0 : ANIM_DURATION_LONG);
206 drag_out_animation_.SetDuration(low_gfx ? 0 : ANIM_DURATION_SHORT);
207 drag_icon_animation_.SetDuration(low_gfx ? 0 : ANIM_DURATION_SHORT);
208 dnd_hide_animation_.SetDuration(low_gfx ? 0 : ANIM_DURATION * 3);
209 dash_showing_animation_.SetDuration(low_gfx ? 0 : ANIM_DURATION_DASH_SHOWING);
210 QueueDraw();
211 }, *this));
201212
202 auto_hide_animation_.updated.connect(redraw_cb);213 auto_hide_animation_.updated.connect(redraw_cb);
203 hover_animation_.updated.connect(redraw_cb);214 hover_animation_.updated.connect(redraw_cb);
@@ -1847,7 +1858,7 @@
1847 GfxContext.PushClippingRectangle(base);1858 GfxContext.PushClippingRectangle(base);
1848 gPainter.PushDrawColorLayer(GfxContext, base, clear_colour, true, ROP);1859 gPainter.PushDrawColorLayer(GfxContext, base, clear_colour, true, ROP);
18491860
1850 if (Settings::Instance().GetLowGfxMode() == false)1861 if (Settings::Instance().low_gfx() == false)
1851 {1862 {
1852 GfxContext.GetRenderStates().SetBlend(true);1863 GfxContext.GetRenderStates().SetBlend(true);
1853 GfxContext.GetRenderStates().SetPremultipliedBlend(nux::SRC_OVER);1864 GfxContext.GetRenderStates().SetPremultipliedBlend(nux::SRC_OVER);
@@ -1899,7 +1910,7 @@
1899 pressure_color);1910 pressure_color);
1900 }1911 }
19011912
1902 if (!Settings::Instance().GetLowGfxMode())1913 if (!Settings::Instance().low_gfx())
1903 {1914 {
1904 if (IsOverlayOpen() && bg_effect_helper_.enabled)1915 if (IsOverlayOpen() && bg_effect_helper_.enabled)
1905 {1916 {
@@ -2010,27 +2021,6 @@
2010 icon_renderer_->PreprocessIcons(args, base);2021 icon_renderer_->PreprocessIcons(args, base);
2011 EventLogic();2022 EventLogic();
20122023
2013 if (!IsOverlayOpen() && launcher_position_ == LauncherPosition::BOTTOM)
2014 {
2015 const double top_line_opacity = 0.15f * launcher_alpha;
2016
2017 gPainter.Paint2DQuadColor(GfxContext,
2018 nux::Geometry(bkg_box.x,
2019 bkg_box.y,
2020 bkg_box.width,
2021 SIDE_LINE_WIDTH.CP(cv_)),
2022 nux::color::White * top_line_opacity);
2023
2024 gPainter.Paint2DQuadColor(GfxContext,
2025 nux::Geometry(bkg_box.x,
2026 bkg_box.y,
2027 bkg_box.width,
2028 8),
2029 nux::Color(0x70000000),
2030 nux::Color(0x00000000),
2031 nux::Color(0x00000000),
2032 nux::Color(0x70000000));
2033 }
20342024
2035 /* draw launcher */2025 /* draw launcher */
2036 for (rev_it = args.rbegin(); rev_it != args.rend(); ++rev_it)2026 for (rev_it = args.rbegin(); rev_it != args.rend(); ++rev_it)
@@ -2075,6 +2065,28 @@
2075 nux::Color(0x70000000));2065 nux::Color(0x70000000));
2076 }2066 }
20772067
2068 if (!IsOverlayOpen() && launcher_position_ == LauncherPosition::BOTTOM)
2069 {
2070 const double top_line_opacity = 0.15f * launcher_alpha;
2071
2072 gPainter.Paint2DQuadColor(GfxContext,
2073 nux::Geometry(bkg_box.x,
2074 bkg_box.y,
2075 bkg_box.width,
2076 SIDE_LINE_WIDTH.CP(cv_)),
2077 nux::color::White * top_line_opacity);
2078
2079 gPainter.Paint2DQuadColor(GfxContext,
2080 nux::Geometry(bkg_box.x,
2081 bkg_box.y,
2082 bkg_box.width,
2083 8),
2084 nux::Color(0x70000000),
2085 nux::Color(0x00000000),
2086 nux::Color(0x00000000),
2087 nux::Color(0x70000000));
2088 }
2089
2078 // FIXME: can be removed for a bgk_box->SetAlpha once implemented2090 // FIXME: can be removed for a bgk_box->SetAlpha once implemented
2079 GfxContext.GetRenderStates().SetPremultipliedBlend(nux::DST_IN);2091 GfxContext.GetRenderStates().SetPremultipliedBlend(nux::DST_IN);
2080 nux::Color alpha_mask = nux::Color(0xFFAAAAAA) * launcher_alpha;2092 nux::Color alpha_mask = nux::Color(0xFFAAAAAA) * launcher_alpha;
20812093
=== modified file 'launcher/LauncherController.cpp'
--- launcher/LauncherController.cpp 2016-05-17 02:55:41 +0000
+++ launcher/LauncherController.cpp 2016-07-15 10:12:55 +0000
@@ -156,14 +156,10 @@
156156
157 WindowManager& wm = WindowManager::Default();157 WindowManager& wm = WindowManager::Default();
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));
159#if SIGCXX_MAJOR_VERSION >= 2 && SIGCXX_MINOR_VERSION >= 5
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));
161#else160 wm.average_color.changed.connect(sigc::track_obj([this] (nux::Color const& color) {
162 wm.viewport_layout_changed.connect(sigc::group(sigc::mem_fun(this, &Controller::Impl::UpdateNumWorkspaces), sigc::_1 * sigc::_2));
163#endif
164 average_color_connection_ = wm.average_color.changed.connect([this] (nux::Color const& color) {
165 parent_->options()->background_color = color;161 parent_->options()->background_color = color;
166 });162 }, *this));
167163
168 ubus.RegisterInterest(UBUS_QUICKLIST_END_KEY_NAV, [this](GVariant * args) {164 ubus.RegisterInterest(UBUS_QUICKLIST_END_KEY_NAV, [this](GVariant * args) {
169 reactivate_index = model_->SelectionIndex();165 reactivate_index = model_->SelectionIndex();
170166
=== modified file 'launcher/LauncherControllerPrivate.h'
--- launcher/LauncherControllerPrivate.h 2016-03-18 01:47:08 +0000
+++ launcher/LauncherControllerPrivate.h 2016-07-15 10:12:55 +0000
@@ -151,7 +151,6 @@
151 connection::Wrapper launcher_key_press_connection_;151 connection::Wrapper launcher_key_press_connection_;
152 connection::Wrapper launcher_event_outside_connection_;152 connection::Wrapper launcher_event_outside_connection_;
153 connection::Wrapper launcher_key_nav_terminate_;153 connection::Wrapper launcher_key_nav_terminate_;
154 connection::Wrapper average_color_connection_;
155};154};
156155
157} // launcher namespace156} // launcher namespace
158157
=== modified file 'launcher/SwitcherController.cpp'
--- launcher/SwitcherController.cpp 2016-05-17 02:56:03 +0000
+++ launcher/SwitcherController.cpp 2016-07-15 10:12:55 +0000
@@ -25,6 +25,7 @@
25#include "unity-shared/UBusMessages.h"25#include "unity-shared/UBusMessages.h"
26#include "unity-shared/WindowManager.h"26#include "unity-shared/WindowManager.h"
27#include "unity-shared/IconRenderer.h"27#include "unity-shared/IconRenderer.h"
28#include "unity-shared/UnitySettings.h"
28#include "unity-shared/UScreen.h"29#include "unity-shared/UScreen.h"
2930
30#include "SwitcherController.h"31#include "SwitcherController.h"
@@ -270,7 +271,7 @@
270 , create_window_(create_window)271 , create_window_(create_window)
271 , icon_renderer_(std::make_shared<ui::IconRenderer>())272 , icon_renderer_(std::make_shared<ui::IconRenderer>())
272 , main_layout_(nullptr)273 , main_layout_(nullptr)
273 , fade_animator_(FADE_DURATION)274 , fade_animator_(Settings::Instance().low_gfx() ? 0 : FADE_DURATION)
274{275{
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));
276277
@@ -291,6 +292,10 @@
291 HideWindow();292 HideWindow();
292 }293 }
293 });294 });
295
296 Settings::Instance().low_gfx.changed.connect(sigc::track_obj([this] (bool low_gfx) {
297 fade_animator_.SetDuration(low_gfx ? 0 : FADE_DURATION);
298 }, *this));
294}299}
295300
296void Controller::Impl::OnBackgroundUpdate(nux::Color const& new_color)301void Controller::Impl::OnBackgroundUpdate(nux::Color const& new_color)
297302
=== modified file 'launcher/SwitcherView.cpp'
--- launcher/SwitcherView.cpp 2016-05-17 02:55:46 +0000
+++ launcher/SwitcherView.cpp 2016-07-15 10:12:55 +0000
@@ -23,6 +23,7 @@
23#include "unity-shared/AnimationUtils.h"23#include "unity-shared/AnimationUtils.h"
24#include "unity-shared/IconRenderer.h"24#include "unity-shared/IconRenderer.h"
25#include "unity-shared/TimeUtil.h"25#include "unity-shared/TimeUtil.h"
26#include "unity-shared/UnitySettings.h"
26#include "unity-shared/UScreen.h"27#include "unity-shared/UScreen.h"
27#include "unity-shared/XKeyboardUtil.h"28#include "unity-shared/XKeyboardUtil.h"
2829
@@ -248,6 +249,7 @@
248 render_targets_.clear();249 render_targets_.clear();
249 }250 }
250251
252 animation_.SetDuration(Settings::Instance().low_gfx() ? 0 : animation_length);
251 SaveLast();253 SaveLast();
252}254}
253255
@@ -258,6 +260,7 @@
258260
259 delta_tracker_.ResetState();261 delta_tracker_.ResetState();
260262
263 animation_.SetDuration(animation_length);
261 SaveLast();264 SaveLast();
262}265}
263266
264267
=== modified file 'launcher/VolumeImp.cpp'
--- launcher/VolumeImp.cpp 2016-01-24 14:35:49 +0000
+++ launcher/VolumeImp.cpp 2016-07-15 10:12:55 +0000
@@ -86,7 +86,10 @@
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));
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));
8888
89 return uuid.Str() + "-" + label.Str();89 if (!label && !uuid)
90 return GetName();
91 else
92 return uuid.Str() + "-" + label.Str();
90 }93 }
9194
92 std::string GetUnixDevicePath() const95 std::string GetUnixDevicePath() const
9396
=== modified file 'lockscreen/CMakeLists.txt'
--- lockscreen/CMakeLists.txt 2016-03-31 09:59:30 +0000
+++ lockscreen/CMakeLists.txt 2016-07-15 10:12:55 +0000
@@ -23,6 +23,7 @@
23 KylinLockScreenShield.cpp23 KylinLockScreenShield.cpp
24 LockScreenController.cpp24 LockScreenController.cpp
25 LockScreenBaseShield.cpp25 LockScreenBaseShield.cpp
26 LockScreenButton.cpp
26 LockScreenSettings.cpp27 LockScreenSettings.cpp
27 LockScreenShield.cpp28 LockScreenShield.cpp
28 LockScreenShieldFactory.cpp29 LockScreenShieldFactory.cpp
2930
=== modified file 'lockscreen/LockScreenAcceleratorController.cpp'
--- lockscreen/LockScreenAcceleratorController.cpp 2014-05-16 04:51:34 +0000
+++ lockscreen/LockScreenAcceleratorController.cpp 2016-07-15 10:12:55 +0000
@@ -1,6 +1,6 @@
1// -*- Mode: C++; indent-tabs-mode: nil; tab-width: 2 -*-1// -*- Mode: C++; indent-tabs-mode: nil; tab-width: 2 -*-
2/*2/*
3 * Copyright (C) 2014 Canonical Ltd3 * Copyright (C) 2014-2016 Canonical Ltd
4 *4 *
5 * This program is free software: you can redistribute it and/or modify5 * This program is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License version 3 as6 * it under the terms of the GNU General Public License version 3 as
@@ -15,10 +15,14 @@
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/>.
16 *16 *
17 * Authored by: William Hua <william.hua@canonical.com>17 * Authored by: William Hua <william.hua@canonical.com>
18 * Marco Trevisan <marco.trevisan@canonical.com>
18 */19 */
1920
20#include "LockScreenAcceleratorController.h"21#include "LockScreenAcceleratorController.h"
2122
23#include <sigc++/bind.h>
24
25#include <NuxCore/Logger.h>
22#include <UnityCore/GLibDBusProxy.h>26#include <UnityCore/GLibDBusProxy.h>
2327
24namespace unity28namespace unity
@@ -28,157 +32,172 @@
2832
29namespace33namespace
30{34{
31const char* const MEDIA_KEYS_SCHEMA = "org.gnome.settings-daemon.plugins.media-keys";35DECLARE_LOGGER(logger, "unity.lockscreen.accelerator.controller");
32const char* const MEDIA_KEYS_KEY_VOLUME_MUTE = "volume-mute";36
33const char* const MEDIA_KEYS_KEY_VOLUME_DOWN = "volume-down";37const std::string MEDIA_KEYS_SCHEMA = "org.gnome.settings-daemon.plugins.media-keys";
34const char* const MEDIA_KEYS_KEY_VOLUME_UP = "volume-up";38const std::vector<std::string> ALLOWED_MEDIA_KEYS = {
3539 "logout",
36const char* const POWER_SCHEMA = "org.gnome.settings-daemon.plugins.power";40 "magnifier",
37const char* const SUSPEND_BUTTON_ACTION_KEY = "button-suspend";41 "on-screen-keyboard",
38const char* const SLEEP_BUTTON_ACTION_KEY = "button-sleep";42 "magnifier-zoom-in",
39const char* const HIBERNATE_BUTTON_ACTION_KEY = "button-hibernate";43 "screenreader",
40const char* const POWER_BUTTON_ACTION_KEY = "button-power";44 "pause",
41const char* const POWER_KEY_SUSPEND = "XF86Suspend";45 "stop",
42const char* const POWER_KEY_SLEEP = "XF86Sleep";46 "toggle-contrast",
43const char* const POWER_KEY_HIBERNATE = "XF86Hibernate";47 "video-out",
44const char* const POWER_KEY_POWEROFF = "XF86PowerOff";48 "volume-down",
4549 "volume-mute",
46const char* const INPUT_SWITCH_SCHEMA = "org.gnome.desktop.wm.keybindings";50 "volume-up",
47const char* const INPUT_SWITCH_KEY_PREVIOUS_SOURCE = "switch-input-source-backward";51};
48const char* const INPUT_SWITCH_KEY_NEXT_SOURCE = "switch-input-source";52
4953const std::string WM_KEYS_SCHEMA = "org.gnome.desktop.wm.keybindings";
50const char* const INDICATOR_INTERFACE_ACTIONS = "org.gtk.Actions";54const std::vector<std::string> ALLOWED_WM_KEYS = {
51const char* const INDICATOR_METHOD_ACTIVATE = "Activate";55 "switch-input-source",
52const char* const INDICATOR_SOUND_BUS_NAME = "com.canonical.indicator.sound";56 "switch-input-source-backward",
53const char* const INDICATOR_SOUND_OBJECT_PATH = "/com/canonical/indicator/sound";57};
54const char* const INDICATOR_SOUND_ACTION_MUTE = "mute";58
55const char* const INDICATOR_SOUND_ACTION_SCROLL = "scroll";59const std::vector<std::string> ALLOWED_XF86_KEYS = {
56const char* const INDICATOR_KEYBOARD_BUS_NAME = "com.canonical.indicator.keyboard";60 "XF86ScreenSaver",
57const char* const INDICATOR_KEYBOARD_OBJECT_PATH = "/com/canonical/indicator/keyboard";61 "XF86Sleep",
58const char* const INDICATOR_KEYBOARD_ACTION_SCROLL = "locked_scroll";62 "XF86Standby",
5963 "XF86Suspend",
60void ActivateIndicator(std::string const& bus_name,64 "XF86Hibernate",
61 std::string const& object_path,65 "XF86PowerOff",
62 std::string const& action_name,66 "XF86MonBrightnessUp",
63 glib::Variant const& parameters = glib::Variant())67 "XF86MonBrightnessDown",
64{68 "XF86KbdBrightnessUp",
65 GVariantBuilder builder;69 "XF86KbdBrightnessDown",
6670 "XF86KbdLightOnOff",
67 g_variant_builder_init(&builder, G_VARIANT_TYPE("(sava{sv})"));71 "XF86AudioMicMute",
68 g_variant_builder_add(&builder, "s", action_name.c_str());72 "XF86Touchpad",
6973};
70 if (parameters)74
71 g_variant_builder_add_parsed(&builder, "[%v]", static_cast<GVariant*>(parameters));75bool IsSettingKeyAvailable(glib::Object<GSettings> const& settings, std::string const& key)
72 else76{
73 g_variant_builder_add_parsed(&builder, "@av []");77 bool available = false;
7478 GSettingsSchema* schema;
75 g_variant_builder_add_parsed(&builder, "@a{sv} []");79
7680 g_object_get(glib::object_cast<GObject>(settings), "settings-schema", &schema, nullptr);
77 auto proxy = std::make_shared<glib::DBusProxy>(bus_name, object_path, INDICATOR_INTERFACE_ACTIONS);81
78 proxy->CallBegin(INDICATOR_METHOD_ACTIVATE, g_variant_builder_end(&builder), [proxy] (GVariant*, glib::Error const&) {});82 if (schema)
79}83 {
8084 available = g_settings_schema_has_key(schema, key.c_str());
81void MuteIndicatorSound()85 g_settings_schema_unref(schema);
82{86 }
83 ActivateIndicator(INDICATOR_SOUND_BUS_NAME,87
84 INDICATOR_SOUND_OBJECT_PATH,88 return available;
85 INDICATOR_SOUND_ACTION_MUTE);89}
86}90
8791bool IsKeyBindingAllowed(std::string const& key)
88void ScrollIndicatorSound(int offset)92{
89{93 if (std::find(begin(ALLOWED_XF86_KEYS), end(ALLOWED_XF86_KEYS), key) != end(ALLOWED_XF86_KEYS))
90 ActivateIndicator(INDICATOR_SOUND_BUS_NAME,94 return true;
91 INDICATOR_SOUND_OBJECT_PATH,95
92 INDICATOR_SOUND_ACTION_SCROLL,96 glib::Object<GSettings> media_settings(g_settings_new(MEDIA_KEYS_SCHEMA.c_str()));
93 g_variant_new_int32(offset));97 Accelerator key_accelerator(key);
94}98
9599 for (auto const& setting : ALLOWED_MEDIA_KEYS)
96void ScrollIndicatorKeyboard(int offset)100 {
97{101 if (!IsSettingKeyAvailable(media_settings, setting))
98 ActivateIndicator(INDICATOR_KEYBOARD_BUS_NAME,102 continue;
99 INDICATOR_KEYBOARD_OBJECT_PATH,103
100 INDICATOR_KEYBOARD_ACTION_SCROLL,104 Accelerator media_key(glib::String(g_settings_get_string(media_settings, setting.c_str())).Str());
101 g_variant_new_int32(-offset));105 if (media_key == key_accelerator)
102}106 return true;
103107 }
104void PowerAction(session::Manager::Ptr const& session, const char *action_key)108
105{109 glib::Object<GSettings> wm_settings(g_settings_new(WM_KEYS_SCHEMA.c_str()));
106 glib::Object<GSettings> settings(g_settings_new(POWER_SCHEMA));110
107 auto const& action = glib::String(g_settings_get_string(settings, action_key)).Str();111 for (auto const& setting : ALLOWED_WM_KEYS)
108112 {
109 if (action == "interactive")113 if (!IsSettingKeyAvailable(wm_settings, setting))
110 session->shutdown_requested.emit(session->HasInhibitors());114 continue;
111 else if (action == "shutdown")115
112 session->reboot_requested.emit(session->HasInhibitors());116 glib::Variant accels(g_settings_get_value(wm_settings, setting.c_str()), glib::StealRef());
113 else if (action == "suspend")117 auto children = g_variant_n_children(accels);
114 session->Suspend();118
115 else if (action == "hibernate")119 if (children > 0)
116 session->Hibernate();120 {
117 else if (action == "blank")121 glib::String value;
118 session->ScreenSaverActivate();122
119}123 for (auto i = 0u; i < children; ++i)
124 {
125 g_variant_get_child(accels, 0, "s", &value);
126
127 if (Accelerator(value.Str()) == key_accelerator)
128 return true;
129 }
130 }
131 }
132
133 return false;
134}
135
120} // namespace136} // namespace
121137
122AcceleratorController::AcceleratorController(session::Manager::Ptr const& session)138AcceleratorController::AcceleratorController(key::Grabber::Ptr const& key_grabber)
123 : accelerators_(new Accelerators)139 : accelerators_(new Accelerators)
124{140{
125 auto settings = glib::Object<GSettings>(g_settings_new(MEDIA_KEYS_SCHEMA));141 for (auto const& action : key_grabber->GetActions())
126142 AddAction(action);
127 auto accelerator = std::make_shared<Accelerator>(glib::String(g_settings_get_string(settings, MEDIA_KEYS_KEY_VOLUME_MUTE)));143
128 accelerator->activated.connect(std::function<void()>(MuteIndicatorSound));144 key_grabber->action_added.connect(sigc::mem_fun(this, &AcceleratorController::AddAction));
129 accelerators_->Add(accelerator);145 key_grabber->action_removed.connect(sigc::mem_fun(this, &AcceleratorController::RemoveAction));
130146}
131 accelerator = std::make_shared<Accelerator>(glib::String(g_settings_get_string(settings, MEDIA_KEYS_KEY_VOLUME_DOWN)));147
132 accelerator->activated.connect(std::bind(ScrollIndicatorSound, -1));148void AcceleratorController::AddAction(CompAction const& action)
133 accelerators_->Add(accelerator);149{
134150 if (action.type() != CompAction::BindingTypeKey)
135 accelerator = std::make_shared<Accelerator>(glib::String(g_settings_get_string(settings, MEDIA_KEYS_KEY_VOLUME_UP)));151 return;
136 accelerator->activated.connect(std::bind(ScrollIndicatorSound, +1));152
137 accelerators_->Add(accelerator);153 auto const& key = action.keyToString();
138154
139 accelerator = std::make_shared<Accelerator>(POWER_KEY_SUSPEND);155 if (!IsKeyBindingAllowed(key))
140 accelerator->activated.connect(std::bind(PowerAction, session, SUSPEND_BUTTON_ACTION_KEY));156 {
141 accelerators_->Add(accelerator);157 LOG_DEBUG(logger) << "Action not allowed " << key;
142158 return;
143 accelerator = std::make_shared<Accelerator>(POWER_KEY_SLEEP);159 }
144 accelerator->activated.connect(std::bind(PowerAction, session, SLEEP_BUTTON_ACTION_KEY));160
145 accelerators_->Add(accelerator);161 auto accelerator = std::make_shared<Accelerator>(key);
146162 accelerator->activated.connect(sigc::bind(sigc::mem_fun(this, &AcceleratorController::OnActionActivated), action));
147 accelerator = std::make_shared<Accelerator>(POWER_KEY_HIBERNATE);163 accelerators_->Add(accelerator);
148 accelerator->activated.connect(std::bind(PowerAction, session, HIBERNATE_BUTTON_ACTION_KEY));164 actions_accelerators_.push_back({action, accelerator});
149 accelerators_->Add(accelerator);165
150166 LOG_DEBUG(logger) << "Action added " << key;
151 accelerator = std::make_shared<Accelerator>(POWER_KEY_POWEROFF);167}
152 accelerator->activated.connect(std::bind(PowerAction, session, POWER_BUTTON_ACTION_KEY));168
153 accelerators_->Add(accelerator);169void AcceleratorController::RemoveAction(CompAction const& action)
154170{
155 settings = glib::Object<GSettings>(g_settings_new(INPUT_SWITCH_SCHEMA));171 if (action.type() != CompAction::BindingTypeKey)
156172 return;
157 auto variant = glib::Variant(g_settings_get_value(settings, INPUT_SWITCH_KEY_PREVIOUS_SOURCE), glib::StealRef());173
158174 LOG_DEBUG(logger) << "Removing action " << action.keyToString();
159 if (g_variant_n_children(variant) > 0)175
160 {176 for (auto it = begin(actions_accelerators_); it != end(actions_accelerators_);)
161 const gchar* string;177 {
162178 if (it->first == action)
163 g_variant_get_child(variant, 0, "&s", &string);179 {
164180 accelerators_->Remove(it->second);
165 accelerator = std::make_shared<Accelerator>(string);181 it = actions_accelerators_.erase(it);
166 accelerator->activated.connect(std::bind(ScrollIndicatorKeyboard, -1));182 }
167 accelerators_->Add(accelerator);183 else
168 }184 {
169185 ++it;
170 variant = glib::Variant(g_settings_get_value(settings, INPUT_SWITCH_KEY_NEXT_SOURCE), glib::StealRef());186 }
171187 }
172 if (g_variant_n_children(variant) > 0)188}
173 {189
174 const gchar* string;190void AcceleratorController::OnActionActivated(CompAction& action)
175191{
176 g_variant_get_child(variant, 0, "&s", &string);192 LOG_DEBUG(logger) << "Activating action " << action.keyToString();
177193
178 accelerator = std::make_shared<Accelerator>(string);194 CompOption::Vector options;
179 accelerator->activated.connect(std::bind(ScrollIndicatorKeyboard, +1));195
180 accelerators_->Add(accelerator);196 if (action.state() & CompAction::StateInitKey)
181 }197 action.initiate()(&action, 0, options);
198
199 if (action.state() & CompAction::StateTermKey)
200 action.terminate()(&action, CompAction::StateTermTapped, options);
182}201}
183202
184Accelerators::Ptr const& AcceleratorController::GetAccelerators() const203Accelerators::Ptr const& AcceleratorController::GetAccelerators() const
185204
=== modified file 'lockscreen/LockScreenAcceleratorController.h'
--- lockscreen/LockScreenAcceleratorController.h 2016-03-31 09:51:33 +0000
+++ lockscreen/LockScreenAcceleratorController.h 2016-07-15 10:12:55 +0000
@@ -20,7 +20,7 @@
20#ifndef UNITY_LOCKSCREEN_ACCELERATOR_CONTROLLER20#ifndef UNITY_LOCKSCREEN_ACCELERATOR_CONTROLLER
21#define UNITY_LOCKSCREEN_ACCELERATOR_CONTROLLER21#define UNITY_LOCKSCREEN_ACCELERATOR_CONTROLLER
2222
23#include "UnityCore/SessionManager.h"23#include "unity-shared/KeyGrabber.h"
24#include "LockScreenAccelerators.h"24#include "LockScreenAccelerators.h"
2525
26namespace unity26namespace unity
@@ -28,16 +28,21 @@
28namespace lockscreen28namespace lockscreen
29{29{
3030
31class AcceleratorController31class AcceleratorController : public sigc::trackable
32{32{
33public:33public:
34 typedef std::shared_ptr<AcceleratorController> Ptr;34 typedef std::shared_ptr<AcceleratorController> Ptr;
3535
36 AcceleratorController(session::Manager::Ptr const&);36 AcceleratorController(key::Grabber::Ptr const&);
3737
38 Accelerators::Ptr const& GetAccelerators() const;38 Accelerators::Ptr const& GetAccelerators() const;
3939
40private:40private:
41 void AddAction(CompAction const&);
42 void RemoveAction(CompAction const&);
43 void OnActionActivated(CompAction&);
44
45 std::vector<std::pair<CompAction, Accelerator::Ptr>> actions_accelerators_;
41 Accelerators::Ptr accelerators_;46 Accelerators::Ptr accelerators_;
42};47};
4348
4449
=== modified file 'lockscreen/LockScreenAccelerators.cpp'
--- lockscreen/LockScreenAccelerators.cpp 2014-04-30 04:34:40 +0000
+++ lockscreen/LockScreenAccelerators.cpp 2016-07-15 10:12:55 +0000
@@ -417,6 +417,11 @@
417{417{
418}418}
419419
420Accelerators::Vector Accelerators::GetAccelerators() const
421{
422 return accelerators_;
423}
424
420void Accelerators::Clear()425void Accelerators::Clear()
421{426{
422 accelerators_.clear();427 accelerators_.clear();
423428
=== modified file 'lockscreen/LockScreenAccelerators.h'
--- lockscreen/LockScreenAccelerators.h 2014-05-12 19:28:48 +0000
+++ lockscreen/LockScreenAccelerators.h 2016-07-15 10:12:55 +0000
@@ -69,9 +69,11 @@
69{69{
70public:70public:
71 typedef std::shared_ptr<Accelerators> Ptr;71 typedef std::shared_ptr<Accelerators> Ptr;
72 typedef std::vector<Accelerator::Ptr> Vector;
7273
73 Accelerators();74 Accelerators();
7475
76 Accelerators::Vector GetAccelerators() const;
75 void Clear();77 void Clear();
7678
77 void Add(Accelerator::Ptr const& accelerator);79 void Add(Accelerator::Ptr const& accelerator);
@@ -83,7 +85,7 @@
83 unsigned int modifiers);85 unsigned int modifiers);
8486
85private:87private:
86 std::vector<Accelerator::Ptr> accelerators_;88 Accelerators::Vector accelerators_;
8789
88 PressedState pressed_state_;90 PressedState pressed_state_;
89};91};
9092
=== added file 'lockscreen/LockScreenButton.cpp'
--- lockscreen/LockScreenButton.cpp 1970-01-01 00:00:00 +0000
+++ lockscreen/LockScreenButton.cpp 2016-07-15 10:12:55 +0000
@@ -0,0 +1,148 @@
1/*
2 * Copyright 2016 Canonical Ltd.
3 *
4 * This program is free software: you can redistribute it and/or modify it
5 * under the terms of the GNU Lesser General Public License version 3, as
6 * published by the Free Software Foundation.
7 *
8 * This program is distributed in the hope that it will be useful, but
9 * WITHOUT ANY WARRANTY; without even the implied warranties of
10 * MERCHANTABILITY, SATISFACTORY QUALITY or FITNESS FOR A PARTICULAR
11 * PURPOSE. See the applicable version of the GNU Lesser General Public
12 * License for more details.
13 *
14 * You should have received a copy of both the GNU Lesser General Public
15 * License version 3 along with this program. If not, see
16 * <http://www.gnu.org/licenses/>
17 *
18 * Authored by: Andrea Azzarone <andrea.azzarone@canonical.com>
19 *
20 */
21
22#include "LockScreenButton.h"
23
24#include <Nux/HLayout.h>
25
26#include "unity-shared/DashStyle.h"
27#include "unity-shared/IconTexture.h"
28#include "LockScreenSettings.h"
29
30namespace unity
31{
32namespace lockscreen
33{
34
35namespace
36{
37const RawPixel HLAYOUT_RIGHT_PADDING = 10_em;
38const int FONT_PX_SIZE = 17;
39}
40
41NUX_IMPLEMENT_OBJECT_TYPE(LockScreenButton);
42
43LockScreenButton::LockScreenButton(std::string const& label, NUX_FILE_LINE_DECL)
44 : nux::Button(NUX_FILE_LINE_PARAM)
45 , scale(1.0)
46 , label_(label)
47{
48 hlayout_ = new nux::HLayout(NUX_TRACKER_LOCATION);
49 hlayout_->SetLeftAndRightPadding(0, HLAYOUT_RIGHT_PADDING.CP(scale));
50 hlayout_->SetContentDistribution(nux::MAJOR_POSITION_END);
51 SetLayout(hlayout_);
52
53 activator_ = new IconTexture(dash::Style::Instance().GetLockScreenActivator(scale()));
54 hlayout_->AddView(activator_, 0, nux::MINOR_POSITION_CENTER, nux::MINOR_SIZE_FULL);
55
56 InitTheme();
57
58 scale.changed.connect([this] (double scale) {
59 activator_->SetTexture(dash::Style::Instance().GetLockScreenActivator(scale));
60 hlayout_->SetLeftAndRightPadding(0, HLAYOUT_RIGHT_PADDING.CP(scale));
61 InitTheme();
62 });
63
64 key_down.connect([this] (unsigned long, unsigned long, unsigned long, const char*, unsigned short) {
65 state_change.emit(this);
66 });
67}
68
69void LockScreenButton::InitTheme()
70{
71 SetMinimumHeight(Settings::GRID_SIZE.CP(scale));
72 SetMaximumHeight(Settings::GRID_SIZE.CP(scale));
73
74 nux::Geometry const& geo = GetGeometry();
75 normal_.reset(new nux::CairoWrapper(geo, sigc::mem_fun(this, &LockScreenButton::RedrawTheme)));
76}
77
78void LockScreenButton::RedrawTheme(nux::Geometry const& geom, cairo_t* cr)
79{
80 cairo_surface_set_device_scale(cairo_get_target(cr), scale, scale);
81 dash::Style::Instance().LockScreenButton(cr, label_, FONT_PX_SIZE);
82}
83
84long LockScreenButton::ComputeContentSize()
85{
86 long ret = nux::Button::ComputeContentSize();
87 nux::Geometry const& geo = GetGeometry();
88
89 if (cached_geometry_ != geo)
90 {
91 normal_->Invalidate(geo);
92 cached_geometry_ = geo;
93 }
94
95 return ret;
96}
97
98void LockScreenButton::DrawContent(nux::GraphicsEngine& GfxContext, bool force_draw)
99{
100 if (IsFullRedraw())
101 {
102 GfxContext.PushClippingRectangle(GetGeometry());
103 hlayout_->ProcessDraw(GfxContext, force_draw);
104 GfxContext.PopClippingRectangle();
105 }
106}
107
108void LockScreenButton::Draw(nux::GraphicsEngine& GfxContext, bool force_draw)
109{
110 nux::Geometry const& geo = GetGeometry();
111 GfxContext.PushClippingRectangle(geo);
112 gPainter.PaintBackground(GfxContext, geo);
113
114 nux::TexCoordXForm texxform;
115 texxform.SetWrap(nux::TEXWRAP_CLAMP, nux::TEXWRAP_CLAMP);
116 texxform.SetTexCoordType(nux::TexCoordXForm::OFFSET_COORD);
117
118 unsigned int alpha = 0, src = 0, dest = 0;
119 GfxContext.GetRenderStates().GetBlend(alpha, src, dest);
120 GfxContext.GetRenderStates().SetPremultipliedBlend(nux::SRC_OVER);
121 GfxContext.GetRenderStates().SetBlend(true);
122
123 nux::Color col(nux::color::Black);
124 col.alpha = 0;
125 GfxContext.QRP_Color(geo.x, geo.y,
126 geo.width, geo.height,
127 col);
128
129 nux::BaseTexture* texture = normal_->GetTexture();
130 GfxContext.QRP_1Tex(geo.x, geo.y,
131 texture->GetWidth(), texture->GetHeight(),
132 texture->GetDeviceTexture(),
133 texxform, nux::color::White);
134
135 GfxContext.GetRenderStates().SetBlend(alpha, src, dest);
136 GfxContext.PopClippingRectangle();
137}
138
139bool LockScreenButton::InspectKeyEvent(unsigned int eventType, unsigned int key_sym, const char* character)
140{
141 if ((eventType == nux::NUX_KEYDOWN) && (key_sym == NUX_VK_ENTER))
142 return true;
143 else
144 return false;
145}
146
147} // namespace lockscreen
148} // namespace unity
0\ No newline at end of file149\ No newline at end of file
1150
=== added file 'lockscreen/LockScreenButton.h'
--- lockscreen/LockScreenButton.h 1970-01-01 00:00:00 +0000
+++ lockscreen/LockScreenButton.h 2016-07-15 10:12:55 +0000
@@ -0,0 +1,70 @@
1/*
2 * Copyright 2016 Canonical Ltd.
3 *
4 * This program is free software: you can redistribute it and/or modify it
5 * under the terms of the GNU Lesser General Public License version 3, as
6 * published by the Free Software Foundation.
7 *
8 * This program is distributed in the hope that it will be useful, but
9 * WITHOUT ANY WARRANTY; without even the implied warranties of
10 * MERCHANTABILITY, SATISFACTORY QUALITY or FITNESS FOR A PARTICULAR
11 * PURPOSE. See the applicable version of the GNU Lesser General Public
12 * License for more details.
13 *
14 * You should have received a copy of both the GNU Lesser General Public
15 * License version 3 along with this program. If not, see
16 * <http://www.gnu.org/licenses/>
17 *
18 * Authored by: Andrea Azzarone <andrea.azzarone@canonical.com>
19 *
20 */
21
22#ifndef UNITY_LOCKSCREEN_BUTTON_H
23#define UNITY_LOCKSCREEN_BUTTON_H
24
25#include <Nux/Nux.h>
26#include <Nux/Button.h>
27#include <Nux/CairoWrapper.h>
28
29namespace unity
30{
31
32class IconTexture;
33
34namespace lockscreen
35{
36
37class LockScreenButton : public nux::Button
38{
39 NUX_DECLARE_OBJECT_TYPE(LockScreenButton, nux::Button);
40
41public:
42 LockScreenButton(std::string const&, NUX_FILE_LINE_PROTO);
43
44 nux::Property<double> scale;
45
46protected:
47 long ComputeContentSize() override;
48 void Draw(nux::GraphicsEngine&, bool) override;
49 void DrawContent(nux::GraphicsEngine&, bool) override;
50 bool InspectKeyEvent(unsigned int eventType, unsigned int key_sym, const char* character) override;
51
52private:
53 void InitTheme();
54 void RedrawTheme(nux::Geometry const&, cairo_t*);
55
56 typedef std::unique_ptr<nux::CairoWrapper> NuxCairoPtr;
57
58 std::string label_;
59 nux::Geometry cached_geometry_;
60
61 NuxCairoPtr normal_;
62
63 nux::HLayout* hlayout_;
64 IconTexture* activator_;
65};
66
67} // namespace lockscreen
68} // namespace unity
69
70#endif
071
=== modified file 'lockscreen/LockScreenController.cpp'
--- lockscreen/LockScreenController.cpp 2016-04-15 05:32:41 +0000
+++ lockscreen/LockScreenController.cpp 2016-07-15 10:12:55 +0000
@@ -28,6 +28,7 @@
28#include "LockScreenShield.h"28#include "LockScreenShield.h"
29#include "LockScreenSettings.h"29#include "LockScreenSettings.h"
30#include "unity-shared/AnimationUtils.h"30#include "unity-shared/AnimationUtils.h"
31#include "unity-shared/UnitySettings.h"
31#include "unity-shared/UScreen.h"32#include "unity-shared/UScreen.h"
32#include "unity-shared/WindowManager.h"33#include "unity-shared/WindowManager.h"
3334
@@ -54,16 +55,18 @@
5455
55Controller::Controller(DBusManager::Ptr const& dbus_manager,56Controller::Controller(DBusManager::Ptr const& dbus_manager,
56 session::Manager::Ptr const& session_manager,57 session::Manager::Ptr const& session_manager,
58 key::Grabber::Ptr const& key_grabber,
57 UpstartWrapper::Ptr const& upstart_wrapper,59 UpstartWrapper::Ptr const& upstart_wrapper,
58 ShieldFactoryInterface::Ptr const& shield_factory,60 ShieldFactoryInterface::Ptr const& shield_factory,
59 bool test_mode)61 bool test_mode)
60 : opacity([this] { return fade_animator_.GetCurrentValue(); })62 : opacity([this] { return fade_animator_.GetCurrentValue(); })
61 , dbus_manager_(dbus_manager)63 , dbus_manager_(dbus_manager)
62 , session_manager_(session_manager)64 , session_manager_(session_manager)
65 , key_grabber_(key_grabber)
63 , upstart_wrapper_(upstart_wrapper)66 , upstart_wrapper_(upstart_wrapper)
64 , shield_factory_(shield_factory)67 , shield_factory_(shield_factory)
65 , suspend_inhibitor_manager_(std::make_shared<SuspendInhibitorManager>())68 , suspend_inhibitor_manager_(std::make_shared<SuspendInhibitorManager>())
66 , fade_animator_(LOCK_FADE_DURATION)69 , fade_animator_(unity::Settings::Instance().low_gfx() ? 0 : LOCK_FADE_DURATION)
67 , blank_window_animator_(IDLE_FADE_DURATION)70 , blank_window_animator_(IDLE_FADE_DURATION)
68 , test_mode_(test_mode)71 , test_mode_(test_mode)
69 , prompt_activation_(false)72 , prompt_activation_(false)
@@ -81,6 +84,7 @@
81 });84 });
82 hidden_window_connection_->block();85 hidden_window_connection_->block();
8386
87 suspend_inhibitor_manager_->connected.connect(sigc::mem_fun(this, &Controller::SyncInhibitor));
84 suspend_inhibitor_manager_->about_to_suspend.connect([this] () {88 suspend_inhibitor_manager_->about_to_suspend.connect([this] () {
85 if (Settings::Instance().lock_on_suspend())89 if (Settings::Instance().lock_on_suspend())
86 session_manager_->PromptLockScreen();90 session_manager_->PromptLockScreen();
@@ -88,7 +92,9 @@
8892
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)));
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)));
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) {
96 fade_animator_.SetDuration(low_gfx ? 0 : LOCK_FADE_DURATION);
97 }, *this));
9298
93 dbus_manager_->simulate_activity.connect(sigc::mem_fun(this, &Controller::SimulateActivity));99 dbus_manager_->simulate_activity.connect(sigc::mem_fun(this, &Controller::SimulateActivity));
94 session_manager_->screensaver_requested.connect(sigc::mem_fun(this, &Controller::OnScreenSaverActivationRequest));100 session_manager_->screensaver_requested.connect(sigc::mem_fun(this, &Controller::OnScreenSaverActivationRequest));
@@ -459,7 +465,7 @@
459 indicators_ = std::make_shared<indicator::LockScreenDBusIndicators>();465 indicators_ = std::make_shared<indicator::LockScreenDBusIndicators>();
460 upstart_wrapper_->Emit("desktop-lock");466 upstart_wrapper_->Emit("desktop-lock");
461467
462 accelerator_controller_ = std::make_shared<AcceleratorController>(session_manager_);468 accelerator_controller_ = std::make_shared<AcceleratorController>(key_grabber_);
463 auto activate_key = WindowManager::Default().activate_indicators_key();469 auto activate_key = WindowManager::Default().activate_indicators_key();
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);
465 accelerator->activated.connect(std::bind(std::mem_fn(&Controller::ActivatePanel), this));471 accelerator->activated.connect(std::bind(std::mem_fn(&Controller::ActivatePanel), this));
466472
=== modified file 'lockscreen/LockScreenController.h'
--- lockscreen/LockScreenController.h 2016-03-31 09:59:30 +0000
+++ lockscreen/LockScreenController.h 2016-07-15 10:12:55 +0000
@@ -30,6 +30,7 @@
30#include "SuspendInhibitorManager.h"30#include "SuspendInhibitorManager.h"
31#include "ScreenSaverDBusManager.h"31#include "ScreenSaverDBusManager.h"
32#include "unity-shared/BackgroundEffectHelper.h"32#include "unity-shared/BackgroundEffectHelper.h"
33#include "unity-shared/KeyGrabber.h"
33#include "unity-shared/UpstartWrapper.h"34#include "unity-shared/UpstartWrapper.h"
3435
35namespace unity36namespace unity
@@ -44,7 +45,7 @@
44public:45public:
45 typedef std::shared_ptr<Controller> Ptr;46 typedef std::shared_ptr<Controller> Ptr;
4647
47 Controller(DBusManager::Ptr const&, session::Manager::Ptr const&,48 Controller(DBusManager::Ptr const&, session::Manager::Ptr const&, key::Grabber::Ptr const&,
48 UpstartWrapper::Ptr const& upstart_wrapper = std::make_shared<UpstartWrapper>(),49 UpstartWrapper::Ptr const& upstart_wrapper = std::make_shared<UpstartWrapper>(),
49 ShieldFactoryInterface::Ptr const& shield_factory = std::make_shared<ShieldFactory>(),50 ShieldFactoryInterface::Ptr const& shield_factory = std::make_shared<ShieldFactory>(),
50 bool test_mode = false);51 bool test_mode = false);
@@ -84,6 +85,7 @@
8485
85 DBusManager::Ptr dbus_manager_;86 DBusManager::Ptr dbus_manager_;
86 session::Manager::Ptr session_manager_;87 session::Manager::Ptr session_manager_;
88 key::Grabber::Ptr key_grabber_;
87 indicator::Indicators::Ptr indicators_;89 indicator::Indicators::Ptr indicators_;
88 AcceleratorController::Ptr accelerator_controller_;90 AcceleratorController::Ptr accelerator_controller_;
89 UpstartWrapper::Ptr upstart_wrapper_;91 UpstartWrapper::Ptr upstart_wrapper_;
9092
=== modified file 'lockscreen/UserAuthenticatorPam.cpp'
--- lockscreen/UserAuthenticatorPam.cpp 2014-05-27 07:54:04 +0000
+++ lockscreen/UserAuthenticatorPam.cpp 2016-07-15 10:12:55 +0000
@@ -22,6 +22,7 @@
22// let's just fallcback to lightdm.22// let's just fallcback to lightdm.
2323
24#include "UserAuthenticatorPam.h"24#include "UserAuthenticatorPam.h"
25#include "unity-shared/UnitySettings.h"
2526
26#include <cstring>27#include <cstring>
27#include <security/pam_appl.h>28#include <security/pam_appl.h>
@@ -52,13 +53,21 @@
5253
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*) {
54 auto self = static_cast<UserAuthenticatorPam*>(data);55 auto self = static_cast<UserAuthenticatorPam*>(data);
56
55 self->status_ = pam_authenticate(self->pam_handle_, 0);57 self->status_ = pam_authenticate(self->pam_handle_, 0);
56 if (self->status_ == PAM_SUCCESS)58
57 self->status_ = pam_acct_mgmt(self->pam_handle_, 0);59 if (self->status_ == PAM_SUCCESS)
58 if (self->status_ == PAM_NEW_AUTHTOK_REQD)60 {
59 self->status_ = pam_chauthtok(self->pam_handle_, PAM_CHANGE_EXPIRED_AUTHTOK);61 int status2 = pam_acct_mgmt(self->pam_handle_, 0);
60 if (self->status_ == PAM_SUCCESS)62
63 if (status2 == PAM_NEW_AUTHTOK_REQD)
64 status2 = pam_chauthtok(self->pam_handle_, PAM_CHANGE_EXPIRED_AUTHTOK);
65
66 if (unity::Settings::Instance().pam_check_account_type())
67 self->status_ = status2;
68
61 pam_setcred (self->pam_handle_, PAM_REINITIALIZE_CRED);69 pam_setcred (self->pam_handle_, PAM_REINITIALIZE_CRED);
70 }
62 });71 });
6372
64 return true;73 return true;
6574
=== modified file 'lockscreen/UserPromptView.cpp'
--- lockscreen/UserPromptView.cpp 2016-03-16 10:47:16 +0000
+++ lockscreen/UserPromptView.cpp 2016-07-15 10:12:55 +0000
@@ -26,6 +26,7 @@
26#include <Nux/VLayout.h>26#include <Nux/VLayout.h>
2727
28#include "LockScreenSettings.h"28#include "LockScreenSettings.h"
29#include "LockScreenButton.h"
29#include "unity-shared/CairoTexture.h"30#include "unity-shared/CairoTexture.h"
30#include "unity-shared/TextInput.h"31#include "unity-shared/TextInput.h"
31#include "unity-shared/StaticCairoText.h"32#include "unity-shared/StaticCairoText.h"
@@ -41,6 +42,7 @@
41const RawPixel LAYOUT_MARGIN = 10_em;42const RawPixel LAYOUT_MARGIN = 10_em;
42const RawPixel MSG_LAYOUT_MARGIN = 15_em;43const RawPixel MSG_LAYOUT_MARGIN = 15_em;
43const RawPixel PROMPT_LAYOUT_MARGIN = 5_em;44const RawPixel PROMPT_LAYOUT_MARGIN = 5_em;
45const RawPixel BUTTON_LAYOUT_MARGIN = 5_em;
44const int PROMPT_FONT_SIZE = 13;46const int PROMPT_FONT_SIZE = 13;
4547
46nux::AbstractPaintLayer* CrateBackgroundLayer(double width, double height, double scale)48nux::AbstractPaintLayer* CrateBackgroundLayer(double width, double height, double scale)
@@ -105,20 +107,29 @@
105 , username_(nullptr)107 , username_(nullptr)
106 , msg_layout_(nullptr)108 , msg_layout_(nullptr)
107 , prompt_layout_(nullptr)109 , prompt_layout_(nullptr)
110 , button_layout_(nullptr)
111 , prompted_(false)
112 , unacknowledged_messages_(false)
108{113{
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){
115 prompted_ = true;
116 unacknowledged_messages_ = false;
110 AddPrompt(message, /* visible */ true, promise);117 AddPrompt(message, /* visible */ true, promise);
111 });118 });
112119
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){
121 prompted_ = true;
122 unacknowledged_messages_ = false;
114 AddPrompt(message, /* visible */ false, promise);123 AddPrompt(message, /* visible */ false, promise);
115 });124 });
116125
117 user_authenticator_.message_requested.connect([this](std::string const& message){126 user_authenticator_.message_requested.connect([this](std::string const& message){
127 unacknowledged_messages_ = true;
118 AddMessage(message, nux::color::White);128 AddMessage(message, nux::color::White);
119 });129 });
120130
121 user_authenticator_.error_requested.connect([this](std::string const& message){131 user_authenticator_.error_requested.connect([this](std::string const& message){
132 unacknowledged_messages_ = true;
122 AddMessage(message, nux::color::Red);133 AddMessage(message, nux::color::Red);
123 });134 });
124135
@@ -131,8 +142,7 @@
131 UpdateSize();142 UpdateSize();
132 ResetLayout();143 ResetLayout();
133144
134 user_authenticator_.AuthenticateStart(session_manager_->UserName(),145 StartAuthentication();
135 sigc::mem_fun(this, &UserPromptView::AuthenticationCb));
136}146}
137147
138void UserPromptView::UpdateSize()148void UserPromptView::UpdateSize()
@@ -178,6 +188,19 @@
178 }188 }
179 }189 }
180190
191 if (button_layout_)
192 {
193 button_layout_->SetVerticalInternalMargin(BUTTON_LAYOUT_MARGIN.CP(scale));
194
195 for (auto* area : button_layout_->GetChildren())
196 {
197 auto* button = static_cast<LockScreenButton*>(area);
198 button->SetMinimumHeight(Settings::GRID_SIZE.CP(scale));
199 button->SetMaximumHeight(Settings::GRID_SIZE.CP(scale));
200 button->scale = scale();
201 }
202 }
203
181 bg_layer_.reset();204 bg_layer_.reset();
182205
183 ComputeContentSize();206 ComputeContentSize();
@@ -200,8 +223,13 @@
200223
201void UserPromptView::ResetLayout()224void UserPromptView::ResetLayout()
202{225{
226 bool keep_msg_layout = msg_layout_ && (!prompted_ || unacknowledged_messages_);
227
203 focus_queue_.clear();228 focus_queue_.clear();
204229
230 if (keep_msg_layout)
231 msg_layout_->Reference();
232
205 SetLayout(new nux::VLayout());233 SetLayout(new nux::VLayout());
206234
207 GetLayout()->SetLeftAndRightPadding(PADDING.CP(scale));235 GetLayout()->SetLeftAndRightPadding(PADDING.CP(scale));
@@ -216,34 +244,54 @@
216 username_->SetFont("Ubuntu "+std::to_string(PROMPT_FONT_SIZE));244 username_->SetFont("Ubuntu "+std::to_string(PROMPT_FONT_SIZE));
217 GetLayout()->AddView(username_);245 GetLayout()->AddView(username_);
218246
219 msg_layout_ = new nux::VLayout();247 if (!keep_msg_layout)
220 msg_layout_->SetVerticalInternalMargin(MSG_LAYOUT_MARGIN.CP(scale));248 {
221 msg_layout_->SetReconfigureParentLayoutOnGeometryChange(true);249 msg_layout_ = new nux::VLayout();
250 msg_layout_->SetVerticalInternalMargin(MSG_LAYOUT_MARGIN.CP(scale));
251 msg_layout_->SetReconfigureParentLayoutOnGeometryChange(true);
252 }
253
222 GetLayout()->AddLayout(msg_layout_);254 GetLayout()->AddLayout(msg_layout_);
223255
256 if (keep_msg_layout)
257 msg_layout_->UnReference();
258
224 prompt_layout_ = new nux::VLayout();259 prompt_layout_ = new nux::VLayout();
225 prompt_layout_->SetVerticalInternalMargin(PROMPT_LAYOUT_MARGIN.CP(scale));260 prompt_layout_->SetVerticalInternalMargin(PROMPT_LAYOUT_MARGIN.CP(scale));
226 prompt_layout_->SetReconfigureParentLayoutOnGeometryChange(true);261 prompt_layout_->SetReconfigureParentLayoutOnGeometryChange(true);
227 GetLayout()->AddLayout(prompt_layout_);262 GetLayout()->AddLayout(prompt_layout_);
228263
264 button_layout_ = new nux::VLayout();
265 button_layout_->SetVerticalInternalMargin(BUTTON_LAYOUT_MARGIN.CP(scale));
266 button_layout_->SetReconfigureParentLayoutOnGeometryChange(true);
267
229 QueueRelayout();268 QueueRelayout();
230 QueueDraw();269 QueueDraw();
231}270}
232271
233void UserPromptView::AuthenticationCb(bool authenticated)272void UserPromptView::AuthenticationCb(bool is_authenticated)
234{273{
235 ResetLayout();274 ResetLayout();
236275
237 if (authenticated)276 if (is_authenticated)
238 {277 {
239 session_manager_->unlock_requested.emit();278 if (prompted_ && !unacknowledged_messages_)
279 DoUnlock();
280 else
281 ShowAuthenticated(true);
240 }282 }
241 else283 else
242 {284 {
243 AddMessage(_("Invalid password, please try again"), nux::color::Red);285 if (prompted_)
244286 {
245 user_authenticator_.AuthenticateStart(session_manager_->UserName(),287 AddMessage(_("Invalid password, please try again"), nux::color::Red);
246 sigc::mem_fun(this, &UserPromptView::AuthenticationCb));288 StartAuthentication();
289 }
290 else
291 {
292 AddMessage(_("Failed to authenticate"), nux::color::Red);
293 ShowAuthenticated(false);
294 }
247 }295 }
248}296}
249297
@@ -299,7 +347,16 @@
299nux::View* UserPromptView::focus_view()347nux::View* UserPromptView::focus_view()
300{348{
301 if (focus_queue_.empty())349 if (focus_queue_.empty())
302 return nullptr;350 {
351 if (button_layout_ && button_layout_->GetChildren().size() > 0)
352 {
353 return static_cast<nux::View*>(button_layout_->GetChildren().front());
354 }
355 else
356 {
357 return nullptr;
358 }
359 }
303360
304 for (auto* view : focus_queue_)361 for (auto* view : focus_queue_)
305 if (view->text_entry()->HasKeyboardFocus())362 if (view->text_entry()->HasKeyboardFocus())
@@ -378,5 +435,48 @@
378 QueueDraw();435 QueueDraw();
379}436}
380437
438void UserPromptView::AddButton(std::string const& text, std::function<void()> const& cb)
439{
440 auto* button = new LockScreenButton (text, NUX_TRACKER_LOCATION);
441 button->scale = scale();
442 button_layout_->AddView(button, 1, nux::MINOR_POSITION_START, nux::MINOR_SIZE_FULL);
443
444 button->state_change.connect ([cb] (nux::View*) {
445 cb();
446 });
447
448 GetLayout()->ComputeContentPosition(0, 0);
449 ComputeContentSize();
450 QueueRelayout();
451 QueueDraw();
452}
453
454void UserPromptView::ShowAuthenticated(bool successful)
455{
456 prompted_ = true;
457 unacknowledged_messages_ = false;
458
459 if (successful)
460 AddButton(_("Unlock"), sigc::mem_fun(this, &UserPromptView::DoUnlock));
461 else
462 AddButton(_("Retry"), sigc::mem_fun(this, &UserPromptView::StartAuthentication));
463
464 GetLayout()->AddLayout(button_layout_);
465}
466
467void UserPromptView::StartAuthentication()
468{
469 prompted_ = false;
470 unacknowledged_messages_ = false;
471
472 user_authenticator_.AuthenticateStart(session_manager_->UserName(),
473 sigc::mem_fun(this, &UserPromptView::AuthenticationCb));
474}
475
476void UserPromptView::DoUnlock()
477{
478 session_manager_->unlock_requested.emit();
479}
480
381}481}
382}482}
383483
=== modified file 'lockscreen/UserPromptView.h'
--- lockscreen/UserPromptView.h 2016-03-31 09:51:33 +0000
+++ lockscreen/UserPromptView.h 2016-07-15 10:12:55 +0000
@@ -52,6 +52,7 @@
5252
53 nux::View* focus_view();53 nux::View* focus_view();
5454
55 void AddButton(std::string const& text, std::function<void()> const& cb);
55 void AddPrompt(std::string const& message, bool visible, PromiseAuthCodePtr const&);56 void AddPrompt(std::string const& message, bool visible, PromiseAuthCodePtr const&);
56 void AddMessage(std::string const& message, nux::Color const& color);57 void AddMessage(std::string const& message, nux::Color const& color);
57 void AuthenticationCb(bool authenticated);58 void AuthenticationCb(bool authenticated);
@@ -59,13 +60,16 @@
59protected:60protected:
60 void Draw(nux::GraphicsEngine& graphics_engine, bool force_draw) override;61 void Draw(nux::GraphicsEngine& graphics_engine, bool force_draw) override;
61 void DrawContent(nux::GraphicsEngine& graphics_engine, bool force_draw) override;62 void DrawContent(nux::GraphicsEngine& graphics_engine, bool force_draw) override;
63 bool InspectKeyEvent(unsigned int eventType, unsigned int key_sym, const char* character) override;
6264
63private:65private:
64 void ResetLayout();66 void ResetLayout();
65 void UpdateSize();67 void UpdateSize();
66 void EnsureBGLayer();68 void EnsureBGLayer();
6769
68 bool InspectKeyEvent(unsigned int eventType, unsigned int key_sym, const char* character);70 void ShowAuthenticated(bool successful);
71 void StartAuthentication();
72 void DoUnlock();
6973
70 session::Manager::Ptr session_manager_;74 session::Manager::Ptr session_manager_;
71 UserAuthenticatorPam user_authenticator_;75 UserAuthenticatorPam user_authenticator_;
@@ -73,9 +77,13 @@
73 StaticCairoText* username_;77 StaticCairoText* username_;
74 nux::VLayout* msg_layout_;78 nux::VLayout* msg_layout_;
75 nux::VLayout* prompt_layout_;79 nux::VLayout* prompt_layout_;
80 nux::VLayout* button_layout_;
76 std::deque<TextInput*> focus_queue_;81 std::deque<TextInput*> focus_queue_;
7782
78 nux::Geometry cached_focused_geo_;83 nux::Geometry cached_focused_geo_;
84
85 bool prompted_;
86 bool unacknowledged_messages_;
79};87};
8088
81}89}
8290
=== modified file 'panel/PanelView.cpp'
--- panel/PanelView.cpp 2016-03-31 05:57:11 +0000
+++ panel/PanelView.cpp 2016-07-15 10:12:55 +0000
@@ -64,7 +64,7 @@
64 auto& wm = WindowManager::Default();64 auto& wm = WindowManager::Default();
65 panel::Style::Instance().changed.connect(sigc::mem_fun(this, &PanelView::ForceUpdateBackground));65 panel::Style::Instance().changed.connect(sigc::mem_fun(this, &PanelView::ForceUpdateBackground));
66 Settings::Instance().dpi_changed.connect(sigc::mem_fun(this, &PanelView::Resize));66 Settings::Instance().dpi_changed.connect(sigc::mem_fun(this, &PanelView::Resize));
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)));
6868
69 wm.average_color.changed.connect(sigc::mem_fun(this, &PanelView::OnBackgroundUpdate));69 wm.average_color.changed.connect(sigc::mem_fun(this, &PanelView::OnBackgroundUpdate));
70 wm.initiate_spread.connect(sigc::mem_fun(this, &PanelView::OnSpreadInitiate));70 wm.initiate_spread.connect(sigc::mem_fun(this, &PanelView::OnSpreadInitiate));
@@ -76,7 +76,7 @@
76 rop.Blend = true;76 rop.Blend = true;
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);
7878
79 if (!Settings::Instance().GetLowGfxMode())79 if (!Settings::Instance().low_gfx())
80 {80 {
81 rop.SrcBlend = GL_ZERO;81 rop.SrcBlend = GL_ZERO;
82 rop.DstBlend = GL_SRC_COLOR;82 rop.DstBlend = GL_SRC_COLOR;
@@ -258,7 +258,7 @@
258258
259void PanelView::OnLowGfxChanged()259void PanelView::OnLowGfxChanged()
260{260{
261 if (!Settings::Instance().GetLowGfxMode())261 if (!Settings::Instance().low_gfx())
262 {262 {
263 nux::ROPConfig rop;263 nux::ROPConfig rop;
264264
@@ -300,15 +300,20 @@
300PanelView::Draw(nux::GraphicsEngine& GfxContext, bool force_draw)300PanelView::Draw(nux::GraphicsEngine& GfxContext, bool force_draw)
301{301{
302 nux::Geometry const& geo = GetGeometry();302 nux::Geometry const& geo = GetGeometry();
303 nux::Geometry const& geo_absolute = GetAbsoluteGeometry();
304 nux::Geometry const& mgeo = UScreen::GetDefault()->GetMonitorGeometry(monitor_);
305 nux::Geometry isect = mgeo.Intersect(geo_absolute);
306
307 if(!isect.width || !isect.height)
308 return;
309
303 UpdateBackground();310 UpdateBackground();
304311
305 bool overlay_mode = InOverlayMode();312 bool overlay_mode = InOverlayMode();
306 GfxContext.PushClippingRectangle(geo);313 GfxContext.PushClippingRectangle(isect);
307314
308 if (IsTransparent())315 if (IsTransparent())
309 {316 {
310 nux::Geometry const& geo_absolute = GetAbsoluteGeometry();
311
312 if (BackgroundEffectHelper::blur_type != BLUR_NONE)317 if (BackgroundEffectHelper::blur_type != BLUR_NONE)
313 {318 {
314 bg_blur_texture_ = bg_effect_helper_.GetBlurRegion();319 bg_blur_texture_ = bg_effect_helper_.GetBlurRegion();
@@ -331,7 +336,7 @@
331 rop.SrcBlend = GL_ONE;336 rop.SrcBlend = GL_ONE;
332 rop.DstBlend = GL_ONE_MINUS_SRC_ALPHA;337 rop.DstBlend = GL_ONE_MINUS_SRC_ALPHA;
333338
334 GfxContext.PushClippingRectangle(geo);339 GfxContext.PushClippingRectangle(isect);
335340
336#ifndef NUX_OPENGLES_20341#ifndef NUX_OPENGLES_20
337 if (GfxContext.UsingGLSLCodePath())342 if (GfxContext.UsingGLSLCodePath())
@@ -362,7 +367,7 @@
362 GfxContext.PopClippingRectangle();367 GfxContext.PopClippingRectangle();
363 }368 }
364369
365 if (overlay_mode && !Settings::Instance().GetLowGfxMode())370 if (overlay_mode && !Settings::Instance().low_gfx())
366 {371 {
367 nux::GetPainter().RenderSinglePaintLayer(GfxContext, geo, bg_darken_layer_.get());372 nux::GetPainter().RenderSinglePaintLayer(GfxContext, geo, bg_darken_layer_.get());
368373
@@ -456,7 +461,7 @@
456461
457 if (overlay_mode)462 if (overlay_mode)
458 {463 {
459 if (Settings::Instance().GetLowGfxMode())464 if (Settings::Instance().low_gfx())
460 {465 {
461 rop.Blend = false;466 rop.Blend = false;
462 auto const& bg_color = WindowManager::Default().average_color();467 auto const& bg_color = WindowManager::Default().average_color();
@@ -475,7 +480,7 @@
475 refine_geo.x = refine_x_pos;480 refine_geo.x = refine_x_pos;
476 refine_geo.width = bg_refine_tex_->GetWidth();481 refine_geo.width = bg_refine_tex_->GetWidth();
477482
478 if (!Settings::Instance().GetLowGfxMode())483 if (!Settings::Instance().low_gfx())
479 {484 {
480 nux::GetPainter().PushLayer(GfxContext, refine_geo, bg_refine_layer_.get());485 nux::GetPainter().PushLayer(GfxContext, refine_geo, bg_refine_layer_.get());
481 bgs++;486 bgs++;
@@ -491,7 +496,7 @@
491 if (!overlay_mode || !GfxContext.UsingGLSLCodePath())496 if (!overlay_mode || !GfxContext.UsingGLSLCodePath())
492 gPainter.PushLayer(GfxContext, geo, bg_layer_.get());497 gPainter.PushLayer(GfxContext, geo, bg_layer_.get());
493498
494 if (overlay_mode && !Settings::Instance().GetLowGfxMode())499 if (overlay_mode && !Settings::Instance().low_gfx())
495 {500 {
496 // apply the shine501 // apply the shine
497 nux::TexCoordXForm texxform;502 nux::TexCoordXForm texxform;
498503
=== modified file 'plugins/unityshell/src/UnityShowdesktopHandler.cpp'
--- plugins/unityshell/src/UnityShowdesktopHandler.cpp 2012-11-15 20:03:17 +0000
+++ plugins/unityshell/src/UnityShowdesktopHandler.cpp 2016-07-15 10:12:55 +0000
@@ -21,6 +21,7 @@
2121
22#include <glib.h>22#include <glib.h>
23#include "UnityShowdesktopHandler.h"23#include "UnityShowdesktopHandler.h"
24#include "unity-shared/UnitySettings.h"
2425
25namespace unity26namespace unity
26{27{
@@ -99,7 +100,7 @@
99 return;100 return;
100101
101 state_ = ShowdesktopHandler::StateFadeOut;102 state_ = ShowdesktopHandler::StateFadeOut;
102 progress_ = 0.0f;103 progress_ = Settings::Instance().low_gfx() ? 1.0f : 0.0f;
103104
104 was_hidden_ = showdesktop_handler_window_interface_->Hidden();105 was_hidden_ = showdesktop_handler_window_interface_->Hidden();
105106
@@ -143,7 +144,7 @@
143144
144 if (state_ == ShowdesktopHandler::StateFadeOut)145 if (state_ == ShowdesktopHandler::StateFadeOut)
145 {146 {
146 progress_ += inc;147 progress_ = Settings::Instance().low_gfx() ? 1.0f : progress_ + inc;
147 if (progress_ >= 1.0f)148 if (progress_ >= 1.0f)
148 {149 {
149 progress_ = 1.0f;150 progress_ = 1.0f;
@@ -152,7 +153,7 @@
152 }153 }
153 else if (state_ == StateFadeIn)154 else if (state_ == StateFadeIn)
154 {155 {
155 progress_ -= inc;156 progress_ = Settings::Instance().low_gfx() ? 0.0f : progress_ - inc;
156 if (progress_ <= 0.0f)157 if (progress_ <= 0.0f)
157 {158 {
158 progress_ = 0.0f;159 progress_ = 0.0f;
159160
=== modified file 'plugins/unityshell/src/unityshell.cpp'
--- plugins/unityshell/src/unityshell.cpp 2016-05-17 02:56:14 +0000
+++ plugins/unityshell/src/unityshell.cpp 2016-07-15 10:12:55 +0000
@@ -221,6 +221,7 @@
221 , key_nav_mode_requested_(false)221 , key_nav_mode_requested_(false)
222 , big_tick_(0)222 , big_tick_(0)
223 , back_buffer_age_(0)223 , back_buffer_age_(0)
224 , next_active_window_(0)
224{225{
225 Timer timer;226 Timer timer;
226#ifndef USE_GLES227#ifndef USE_GLES
@@ -300,12 +301,12 @@
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) ||
301 optionGetLowGraphicsMode())302 optionGetLowGraphicsMode())
302 {303 {
303 unity_settings_.SetLowGfxMode(true);304 unity_settings_.low_gfx = true;
304 }305 }
305306
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)
307 {308 {
308 unity_settings_.SetLowGfxMode(false);309 unity_settings_.low_gfx = false;
309 }310 }
310#endif311#endif
311312
@@ -445,6 +446,7 @@
445 auto init_plugins_cb = sigc::mem_fun(this, &UnityScreen::InitPluginActions);446 auto init_plugins_cb = sigc::mem_fun(this, &UnityScreen::InitPluginActions);
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));
447448
449 Settings::Instance().gestures_changed.connect(sigc::mem_fun(this, &UnityScreen::UpdateGesturesSupport));
448 InitGesturesSupport();450 InitGesturesSupport();
449451
450 LoadPanelShadowTexture();452 LoadPanelShadowTexture();
@@ -1214,6 +1216,8 @@
12141216
1215void UnityWindow::activate ()1217void UnityWindow::activate ()
1216{1218{
1219 uScreen->SetNextActiveWindow(window->id());
1220
1217 ShowdesktopHandler::InhibitLeaveShowdesktopMode (window->id ());1221 ShowdesktopHandler::InhibitLeaveShowdesktopMode (window->id ());
1218 window->activate ();1222 window->activate ();
1219 ShowdesktopHandler::AllowLeaveShowdesktopMode (window->id ());1223 ShowdesktopHandler::AllowLeaveShowdesktopMode (window->id ());
@@ -2483,7 +2487,7 @@
2483 }2487 }
2484 else2488 else
2485 {2489 {
2486 switcher_controller_->detail = true;2490 switcher_controller_->SetDetail(true);
2487 }2491 }
24882492
2489 action->setState(action->state() | CompAction::StateTermKey);2493 action->setState(action->state() | CompAction::StateTermKey);
@@ -2982,7 +2986,7 @@
2982 uScreen->windows_for_monitor_[monitor] = 1;2986 uScreen->windows_for_monitor_[monitor] = 1;
29832987
2984 if (!(mask & nonOcclusionBits) &&2988 if (!(mask & nonOcclusionBits) &&
2985 (window->state() & CompWindowStateFullscreenMask && !window->minimized()) &&2989 (window->state() & CompWindowStateFullscreenMask && !window->minimized() && !window->inShowDesktopMode()) &&
2986 uScreen->windows_for_monitor_[monitor] == 1)2990 uScreen->windows_for_monitor_[monitor] == 1)
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:
2988 // && (attrib.opacity == OPAQUE)) <-- Doesn't work; Only set in glDraw2992 // && (attrib.opacity == OPAQUE)) <-- Doesn't work; Only set in glDraw
@@ -3723,7 +3727,7 @@
3723 else3727 else
3724 BackgroundEffectHelper::blur_type = (unity::BlurType)optionGetDashBlurExperimental();3728 BackgroundEffectHelper::blur_type = (unity::BlurType)optionGetDashBlurExperimental();
37253729
3726 unity::Settings::Instance().SetLowGfxMode(optionGetLowGraphicsMode());3730 unity::Settings::Instance().low_gfx = optionGetLowGraphicsMode();
3727 break;3731 break;
3728 case UnityshellOptions::DecayRate:3732 case UnityshellOptions::DecayRate:
3729 launcher_options->edge_decay_rate = optionGetDecayRate() * 100;3733 launcher_options->edge_decay_rate = optionGetDecayRate() * 100;
@@ -4077,24 +4081,24 @@
4077 ShowFirstRunHints();4081 ShowFirstRunHints();
40784082
4079 // Setup Session Controller4083 // Setup Session Controller
4080 auto manager = std::make_shared<session::GnomeManager>();4084 auto session = std::make_shared<session::GnomeManager>();
4081 manager->lock_requested.connect(sigc::mem_fun(this, &UnityScreen::OnLockScreenRequested));4085 session->lock_requested.connect(sigc::mem_fun(this, &UnityScreen::OnLockScreenRequested));
4082 manager->prompt_lock_requested.connect(sigc::mem_fun(this, &UnityScreen::OnLockScreenRequested));4086 session->prompt_lock_requested.connect(sigc::mem_fun(this, &UnityScreen::OnLockScreenRequested));
4083 manager->locked.connect(sigc::mem_fun(this, &UnityScreen::OnScreenLocked));4087 session->locked.connect(sigc::mem_fun(this, &UnityScreen::OnScreenLocked));
4084 manager->unlocked.connect(sigc::mem_fun(this, &UnityScreen::OnScreenUnlocked));4088 session->unlocked.connect(sigc::mem_fun(this, &UnityScreen::OnScreenUnlocked));
4085 session_dbus_manager_ = std::make_shared<session::DBusManager>(manager);4089 session_dbus_manager_ = std::make_shared<session::DBusManager>(session);
4086 session_controller_ = std::make_shared<session::Controller>(manager);4090 session_controller_ = std::make_shared<session::Controller>(session);
4087 LOG_INFO(logger) << "InitUnityComponents-Session " << timer.ElapsedSeconds() << "s";4091 LOG_INFO(logger) << "InitUnityComponents-Session " << timer.ElapsedSeconds() << "s";
4088 Introspectable::AddChild(session_controller_.get());4092 Introspectable::AddChild(session_controller_.get());
40894093
4090 // Setup Lockscreen Controller4094 // Setup Lockscreen Controller
4091 screensaver_dbus_manager_ = std::make_shared<lockscreen::DBusManager>(manager);4095 screensaver_dbus_manager_ = std::make_shared<lockscreen::DBusManager>(session);
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());
4093 UpdateActivateIndicatorsKey();4097 UpdateActivateIndicatorsKey();
4094 LOG_INFO(logger) << "InitUnityComponents-Lockscreen " << timer.ElapsedSeconds() << "s";4098 LOG_INFO(logger) << "InitUnityComponents-Lockscreen " << timer.ElapsedSeconds() << "s";
40954099
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))
4097 manager->PromptLockScreen();4101 session->PromptLockScreen();
40984102
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) {
4100 /* The launcher geometry includes 1px used to draw the right/top margin4104 /* The launcher geometry includes 1px used to draw the right/top margin
@@ -4186,22 +4190,26 @@
4186 return lockscreen_controller_;4190 return lockscreen_controller_;
4187}4191}
41884192
4193void UnityScreen::UpdateGesturesSupport()
4194{
4195 Settings::Instance().gestures_launcher_drag() ? gestures_sub_launcher_->Activate() : gestures_sub_launcher_->Deactivate();
4196 Settings::Instance().gestures_dash_tap() ? gestures_sub_dash_->Activate() : gestures_sub_dash_->Deactivate();
4197 Settings::Instance().gestures_windows_drag_pinch() ? gestures_sub_windows_->Activate() : gestures_sub_windows_->Deactivate();
4198}
4199
4189void UnityScreen::InitGesturesSupport()4200void UnityScreen::InitGesturesSupport()
4190{4201{
4191 std::unique_ptr<nux::GestureBroker> gesture_broker(new UnityGestureBroker);4202 std::unique_ptr<nux::GestureBroker> gesture_broker(new UnityGestureBroker);
4192 wt->GetWindowCompositor().SetGestureBroker(std::move(gesture_broker));4203 wt->GetWindowCompositor().SetGestureBroker(std::move(gesture_broker));
4193
4194 gestures_sub_launcher_.reset(new nux::GesturesSubscription);4204 gestures_sub_launcher_.reset(new nux::GesturesSubscription);
4195 gestures_sub_launcher_->SetGestureClasses(nux::DRAG_GESTURE);4205 gestures_sub_launcher_->SetGestureClasses(nux::DRAG_GESTURE);
4196 gestures_sub_launcher_->SetNumTouches(4);4206 gestures_sub_launcher_->SetNumTouches(4);
4197 gestures_sub_launcher_->SetWindowId(GDK_ROOT_WINDOW());4207 gestures_sub_launcher_->SetWindowId(GDK_ROOT_WINDOW());
4198 gestures_sub_launcher_->Activate();
41994208
4200 gestures_sub_dash_.reset(new nux::GesturesSubscription);4209 gestures_sub_dash_.reset(new nux::GesturesSubscription);
4201 gestures_sub_dash_->SetGestureClasses(nux::TAP_GESTURE);4210 gestures_sub_dash_->SetGestureClasses(nux::TAP_GESTURE);
4202 gestures_sub_dash_->SetNumTouches(4);4211 gestures_sub_dash_->SetNumTouches(4);
4203 gestures_sub_dash_->SetWindowId(GDK_ROOT_WINDOW());4212 gestures_sub_dash_->SetWindowId(GDK_ROOT_WINDOW());
4204 gestures_sub_dash_->Activate();
42054213
4206 gestures_sub_windows_.reset(new nux::GesturesSubscription);4214 gestures_sub_windows_.reset(new nux::GesturesSubscription);
4207 gestures_sub_windows_->SetGestureClasses(nux::TOUCH_GESTURE4215 gestures_sub_windows_->SetGestureClasses(nux::TOUCH_GESTURE
@@ -4209,7 +4217,9 @@
4209 | nux::PINCH_GESTURE);4217 | nux::PINCH_GESTURE);
4210 gestures_sub_windows_->SetNumTouches(3);4218 gestures_sub_windows_->SetNumTouches(3);
4211 gestures_sub_windows_->SetWindowId(GDK_ROOT_WINDOW());4219 gestures_sub_windows_->SetWindowId(GDK_ROOT_WINDOW());
4212 gestures_sub_windows_->Activate();4220
4221 // Apply the user's settings
4222 UpdateGesturesSupport();
4213}4223}
42144224
4215CompAction::Vector& UnityScreen::getActions()4225CompAction::Vector& UnityScreen::getActions()
@@ -4245,6 +4255,16 @@
4245 });4255 });
4246}4256}
42474257
4258Window UnityScreen::GetNextActiveWindow() const
4259{
4260 return next_active_window_;
4261}
4262
4263void UnityScreen::SetNextActiveWindow(Window next_active_window)
4264{
4265 next_active_window_ = next_active_window;
4266}
4267
4248/* Window init */4268/* Window init */
42494269
4250namespace4270namespace
@@ -4604,7 +4624,7 @@
46044624
4605 if (IsInShowdesktopMode())4625 if (IsInShowdesktopMode())
4606 {4626 {
4607 if (!(screen->activeWindow() == window->id()))4627 if (uScreen->GetNextActiveWindow() != window->id())
4608 {4628 {
4609 if (!mShowdesktopHandler)4629 if (!mShowdesktopHandler)
4610 mShowdesktopHandler.reset(new ShowdesktopHandler(static_cast <ShowdesktopHandlerWindowInterface *>(this),4630 mShowdesktopHandler.reset(new ShowdesktopHandler(static_cast <ShowdesktopHandlerWindowInterface *>(this),
46114631
=== modified file 'plugins/unityshell/src/unityshell.h'
--- plugins/unityshell/src/unityshell.h 2016-05-17 02:55:52 +0000
+++ plugins/unityshell/src/unityshell.h 2016-07-15 10:12:55 +0000
@@ -282,6 +282,7 @@
282 void OnDecorationStyleChanged();282 void OnDecorationStyleChanged();
283283
284 void InitGesturesSupport();284 void InitGesturesSupport();
285 void UpdateGesturesSupport();
285286
286 void DrawPanelUnderDash();287 void DrawPanelUnderDash();
287288
@@ -298,6 +299,9 @@
298 void SpreadAppWindows(bool anywhere);299 void SpreadAppWindows(bool anywhere);
299 bool queryForShader();300 bool queryForShader();
300301
302 Window GetNextActiveWindow() const;
303 void SetNextActiveWindow(Window next_active_window);
304
301 /* We store these to avoid unecessary calls to ::get */305 /* We store these to avoid unecessary calls to ::get */
302 CompScreen* screen;306 CompScreen* screen;
303 CompositeScreen* cScreen;307 CompositeScreen* cScreen;
@@ -413,6 +417,8 @@
413 uint64_t big_tick_;417 uint64_t big_tick_;
414 unsigned int back_buffer_age_;418 unsigned int back_buffer_age_;
415419
420 Window next_active_window_;
421
416 friend class UnityWindow;422 friend class UnityWindow;
417 friend class debug::ScreenIntrospection;423 friend class debug::ScreenIntrospection;
418 friend class decoration::Manager;424 friend class decoration::Manager;
419425
=== modified file 'shortcuts/ShortcutController.cpp'
--- shortcuts/ShortcutController.cpp 2015-11-26 00:06:37 +0000
+++ shortcuts/ShortcutController.cpp 2016-07-15 10:12:55 +0000
@@ -22,6 +22,7 @@
2222
23#include "unity-shared/AnimationUtils.h"23#include "unity-shared/AnimationUtils.h"
24#include "unity-shared/UBusMessages.h"24#include "unity-shared/UBusMessages.h"
25#include "unity-shared/UnitySettings.h"
25#include "unity-shared/UScreen.h"26#include "unity-shared/UScreen.h"
26#include "unity-shared/WindowManager.h"27#include "unity-shared/WindowManager.h"
2728
@@ -42,7 +43,7 @@
42 , base_window_raiser_(base_window_raiser)43 , base_window_raiser_(base_window_raiser)
43 , visible_(false)44 , visible_(false)
44 , enabled_(true)45 , enabled_(true)
45 , fade_animator_(FADE_DURATION)46 , fade_animator_(Settings::Instance().low_gfx() ? 0 : FADE_DURATION)
46{47{
47 ubus_manager_.RegisterInterest(UBUS_LAUNCHER_START_KEY_SWITCHER, [this] (GVariant*)48 ubus_manager_.RegisterInterest(UBUS_LAUNCHER_START_KEY_SWITCHER, [this] (GVariant*)
48 { SetEnabled(false); });49 { SetEnabled(false); });
@@ -57,6 +58,11 @@
57 if (animation::GetDirection(fade_animator_) == animation::Direction::BACKWARD)58 if (animation::GetDirection(fade_animator_) == animation::Direction::BACKWARD)
58 view_window_->ShowWindow(false);59 view_window_->ShowWindow(false);
59 });60 });
61
62 Settings::Instance().low_gfx.changed.connect(sigc::track_obj([this] (bool low_gfx) {
63 fade_animator_.SetDuration(low_gfx ? 0 : FADE_DURATION);
64 }, *this));
65
60 modeller_->model_changed.connect(sigc::mem_fun(this, &Controller::OnModelUpdated));66 modeller_->model_changed.connect(sigc::mem_fun(this, &Controller::OnModelUpdated));
61}67}
6268
6369
=== modified file 'shutdown/SessionController.cpp'
--- shutdown/SessionController.cpp 2014-12-10 14:24:06 +0000
+++ shutdown/SessionController.cpp 2016-07-15 10:12:55 +0000
@@ -20,9 +20,10 @@
20#include "SessionController.h"20#include "SessionController.h"
2121
22#include "unity-shared/AnimationUtils.h"22#include "unity-shared/AnimationUtils.h"
23#include "unity-shared/UScreen.h"
24#include "unity-shared/UBusMessages.h"23#include "unity-shared/UBusMessages.h"
25#include "unity-shared/UBusWrapper.h"24#include "unity-shared/UBusWrapper.h"
25#include "unity-shared/UnitySettings.h"
26#include "unity-shared/UScreen.h"
26#include "unity-shared/WindowManager.h"27#include "unity-shared/WindowManager.h"
2728
28namespace na = nux::animation;29namespace na = nux::animation;
@@ -38,7 +39,7 @@
3839
39Controller::Controller(session::Manager::Ptr const& manager)40Controller::Controller(session::Manager::Ptr const& manager)
40 : manager_(manager)41 : manager_(manager)
41 , fade_animator_(FADE_DURATION)42 , fade_animator_(Settings::Instance().low_gfx() ? 0 : FADE_DURATION)
42{43{
43 manager_->reboot_requested.connect([this] (bool inhibitors) {44 manager_->reboot_requested.connect([this] (bool inhibitors) {
44 Show(View::Mode::SHUTDOWN, inhibitors);45 Show(View::Mode::SHUTDOWN, inhibitors);
@@ -61,6 +62,10 @@
61 if (animation::GetDirection(fade_animator_) == animation::Direction::BACKWARD)62 if (animation::GetDirection(fade_animator_) == animation::Direction::BACKWARD)
62 CloseWindow();63 CloseWindow();
63 });64 });
65
66 Settings::Instance().low_gfx.changed.connect(sigc::track_obj([this] (bool low_gfx) {
67 fade_animator_.SetDuration(low_gfx ? 0 : FADE_DURATION);
68 }, *this));
64}69}
6570
66void Controller::OnBackgroundUpdate(nux::Color const& new_color)71void Controller::OnBackgroundUpdate(nux::Color const& new_color)
6772
=== modified file 'tests/test_lockscreen_controller.cpp'
--- tests/test_lockscreen_controller.cpp 2015-12-05 07:03:25 +0000
+++ tests/test_lockscreen_controller.cpp 2016-07-15 10:12:55 +0000
@@ -33,6 +33,7 @@
33#include "unity-shared/DashStyle.h"33#include "unity-shared/DashStyle.h"
34#include "unity-shared/PanelStyle.h"34#include "unity-shared/PanelStyle.h"
35#include "unity-shared/UScreen.h"35#include "unity-shared/UScreen.h"
36#include "mock_key_grabber.h"
36#include "test_mock_session_manager.h"37#include "test_mock_session_manager.h"
37#include "test_uscreen_mock.h"38#include "test_uscreen_mock.h"
38#include "test_utils.h"39#include "test_utils.h"
@@ -80,19 +81,21 @@
80 TestLockScreenController()81 TestLockScreenController()
81 : animation_controller(tick_source)82 : animation_controller(tick_source)
82 , session_manager(std::make_shared<NiceMock<session::MockManager>>())83 , session_manager(std::make_shared<NiceMock<session::MockManager>>())
84 , key_grabber(std::make_shared<key::MockGrabber::Nice>())
83 , dbus_manager(std::make_shared<DBusManager>(session_manager))85 , dbus_manager(std::make_shared<DBusManager>(session_manager))
84 , upstart_wrapper(std::make_shared<UpstartWrapper>())86 , upstart_wrapper(std::make_shared<UpstartWrapper>())
85 , shield_factory(std::make_shared<ShieldFactoryMock>())87 , shield_factory(std::make_shared<ShieldFactoryMock>())
86 , controller(dbus_manager, session_manager, upstart_wrapper, shield_factory)88 , controller(dbus_manager, session_manager, key_grabber, upstart_wrapper, shield_factory)
87 {}89 {}
8890
89 struct ControllerWrap : Controller91 struct ControllerWrap : Controller
90 {92 {
91 ControllerWrap(DBusManager::Ptr const& dbus_manager,93 ControllerWrap(DBusManager::Ptr const& dbus_manager,
92 session::Manager::Ptr const& session_manager,94 session::Manager::Ptr const& session_manager,
95 key::Grabber::Ptr const& key_grabber,
93 UpstartWrapper::Ptr const& upstart_wrapper,96 UpstartWrapper::Ptr const& upstart_wrapper,
94 ShieldFactoryInterface::Ptr const& shield_factory)97 ShieldFactoryInterface::Ptr const& shield_factory)
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)
96 {}99 {}
97100
98 using Controller::shields_;101 using Controller::shields_;
@@ -107,6 +110,7 @@
107 unity::panel::Style panel_style;110 unity::panel::Style panel_style;
108 unity::lockscreen::Settings lockscreen_settings;111 unity::lockscreen::Settings lockscreen_settings;
109 session::MockManager::Ptr session_manager;112 session::MockManager::Ptr session_manager;
113 key::MockGrabber::Ptr key_grabber;
110 DBusManager::Ptr dbus_manager;114 DBusManager::Ptr dbus_manager;
111 unity::UpstartWrapper::Ptr upstart_wrapper;115 unity::UpstartWrapper::Ptr upstart_wrapper;
112116
@@ -123,7 +127,7 @@
123{127{
124 size_t before = uscreen.changed.size();128 size_t before = uscreen.changed.size();
125 {129 {
126 Controller dummy(dbus_manager, session_manager);130 Controller dummy(dbus_manager, session_manager, key_grabber);
127 }131 }
128 ASSERT_EQ(before, uscreen.changed.size());132 ASSERT_EQ(before, uscreen.changed.size());
129133
@@ -135,7 +139,7 @@
135{139{
136 size_t before = session_manager->unlock_requested.size();140 size_t before = session_manager->unlock_requested.size();
137 {141 {
138 Controller dummy(dbus_manager, session_manager);142 Controller dummy(dbus_manager, session_manager, key_grabber);
139 }143 }
140 ASSERT_EQ(before, session_manager->unlock_requested.size());144 ASSERT_EQ(before, session_manager->unlock_requested.size());
141145
142146
=== modified file 'unity-shared/BGHash.cpp'
--- unity-shared/BGHash.cpp 2015-04-23 13:39:31 +0000
+++ unity-shared/BGHash.cpp 2016-07-15 10:12:55 +0000
@@ -20,6 +20,7 @@
20#include "BGHash.h"20#include "BGHash.h"
21#include <gdk/gdkx.h>21#include <gdk/gdkx.h>
22#include <NuxCore/Logger.h>22#include <NuxCore/Logger.h>
23#include "unity-shared/UnitySettings.h"
23#include "unity-shared/WindowManager.h"24#include "unity-shared/WindowManager.h"
2425
25#ifndef XA_STRING26#ifndef XA_STRING
@@ -38,13 +39,17 @@
38}39}
3940
40BGHash::BGHash()41BGHash::BGHash()
41 : transition_animator_(TRANSITION_DURATION)42 : transition_animator_(Settings::Instance().low_gfx() ? 0 : TRANSITION_DURATION)
42 , override_color_(nux::color::Transparent)43 , override_color_(nux::color::Transparent)
43{44{
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");
45 transition_animator_.updated.connect(sigc::mem_fun(this, &BGHash::OnTransitionUpdated));46 transition_animator_.updated.connect(sigc::mem_fun(this, &BGHash::OnTransitionUpdated));
46 WindowManager::Default().average_color = unity::colors::Aubergine;47 WindowManager::Default().average_color = unity::colors::Aubergine;
47 RefreshColor(/* skip_animation */ true);48 RefreshColor(/* skip_animation */ true);
49
50 Settings::Instance().low_gfx.changed.connect(sigc::track_obj([this] (bool low_gfx) {
51 transition_animator_.SetDuration(low_gfx ? 0 : TRANSITION_DURATION);
52 }, *this));
48}53}
4954
50uint64_t BGHash::ColorAtomId() const55uint64_t BGHash::ColorAtomId() const
5156
=== modified file 'unity-shared/BGHash.h'
--- unity-shared/BGHash.h 2014-12-11 12:54:37 +0000
+++ unity-shared/BGHash.h 2016-07-15 10:12:55 +0000
@@ -30,7 +30,7 @@
3030
31namespace unity31namespace unity
32{32{
33 class BGHash33 class BGHash : public sigc::trackable
34 {34 {
35 public:35 public:
36 BGHash();36 BGHash();
3737
=== modified file 'unity-shared/BackgroundEffectHelper.cpp'
--- unity-shared/BackgroundEffectHelper.cpp 2016-03-31 06:06:15 +0000
+++ unity-shared/BackgroundEffectHelper.cpp 2016-07-15 10:12:55 +0000
@@ -51,7 +51,7 @@
51 TextureCache::GetDefault().themed_invalidated.connect(sigc::mem_fun(this, &BackgroundEffectHelper::LoadTextures));51 TextureCache::GetDefault().themed_invalidated.connect(sigc::mem_fun(this, &BackgroundEffectHelper::LoadTextures));
52 LoadTextures();52 LoadTextures();
5353
54 if (Settings::Instance().GetLowGfxMode())54 if (Settings::Instance().low_gfx())
55 blur_type = BLUR_NONE;55 blur_type = BLUR_NONE;
56}56}
5757
5858
=== modified file 'unity-shared/DashStyle.cpp'
--- unity-shared/DashStyle.cpp 2016-05-17 02:56:09 +0000
+++ unity-shared/DashStyle.cpp 2016-07-15 10:12:55 +0000
@@ -1672,6 +1672,41 @@
1672 return true;1672 return true;
1673}1673}
16741674
1675bool Style::LockScreenButton(cairo_t* cr, std::string const& label,
1676 int font_px_size)
1677{
1678 if (cairo_status(cr) != CAIRO_STATUS_SUCCESS)
1679 return false;
1680
1681 if (cairo_surface_get_type(cairo_get_target(cr)) != CAIRO_SURFACE_TYPE_IMAGE)
1682 return false;
1683
1684 double w, h;
1685 get_actual_cairo_size(cr, &w, &h);
1686
1687 cairo_set_line_width(cr, 1);
1688
1689 double radius = 5.0;
1690 RoundedRect(cr, 1.0, 0.5, 0.5, radius, w - 1.0, h - 1.0);
1691
1692 cairo_set_source_rgba(cr, 0.0f, 0.0f, 0.0f, 0.35f);
1693 cairo_fill_preserve(cr);
1694
1695 cairo_set_source_rgba(cr, 1.0f, 1.0f, 1.0f, 0.7f);
1696 cairo_stroke(cr);
1697
1698 static double internal_padding = 10.0f;
1699
1700 pimpl->Text(cr,
1701 nux::color::White,
1702 label,
1703 font_px_size,
1704 internal_padding,
1705 dash::Alignment::LEFT);
1706
1707 return true;
1708}
1709
1675nux::AbstractPaintLayer* Style::FocusOverlay(int width, int height)1710nux::AbstractPaintLayer* Style::FocusOverlay(int width, int height)
1676{1711{
1677 nux::CairoGraphics cg(CAIRO_FORMAT_ARGB32, width, height);1712 nux::CairoGraphics cg(CAIRO_FORMAT_ARGB32, width, height);
@@ -2211,6 +2246,10 @@
2211 return pimpl->LoadScaledTexture("search_spin", scale);2246 return pimpl->LoadScaledTexture("search_spin", scale);
2212}2247}
22132248
2249BaseTexturePtr Style::GetLockScreenActivator(double scale) const
2250{
2251 return pimpl->LoadScaledTexture("arrow_right", scale);
2252}
22142253
2215RawPixel Style::GetButtonGarnishSize() const2254RawPixel Style::GetButtonGarnishSize() const
2216{2255{
22172256
=== modified file 'unity-shared/DashStyle.h'
--- unity-shared/DashStyle.h 2016-03-31 05:53:05 +0000
+++ unity-shared/DashStyle.h 2016-07-15 10:12:55 +0000
@@ -98,6 +98,9 @@
9898
99 static Style& Instance();99 static Style& Instance();
100100
101 virtual bool LockScreenButton(cairo_t* cr, std::string const& label,
102 int font_px_size);
103
101 virtual bool Button(cairo_t* cr, nux::ButtonVisualState state,104 virtual bool Button(cairo_t* cr, nux::ButtonVisualState state,
102 std::string const& label, int font_px_size=-1,105 std::string const& label, int font_px_size=-1,
103 Alignment alignment = Alignment::CENTER,106 Alignment alignment = Alignment::CENTER,
@@ -196,6 +199,8 @@
196 BaseTexturePtr GetSearchCloseIcon(double scale) const;199 BaseTexturePtr GetSearchCloseIcon(double scale) const;
197 BaseTexturePtr GetSearchSpinIcon(double scale) const;200 BaseTexturePtr GetSearchSpinIcon(double scale) const;
198201
202 BaseTexturePtr GetLockScreenActivator(double scale) const;
203
199 BaseTexturePtr const& GetGroupUnexpandIcon() const;204 BaseTexturePtr const& GetGroupUnexpandIcon() const;
200 BaseTexturePtr const& GetGroupExpandIcon() const;205 BaseTexturePtr const& GetGroupExpandIcon() const;
201206
202207
=== modified file 'unity-shared/GnomeKeyGrabber.cpp'
--- unity-shared/GnomeKeyGrabber.cpp 2016-05-17 02:55:23 +0000
+++ unity-shared/GnomeKeyGrabber.cpp 2016-07-15 10:12:55 +0000
@@ -59,19 +59,33 @@
59</node>)";59</node>)";
60}60}
6161
62namespace
63{
64const std::string SETTINGS_NAME = "com.canonical.Unity";
65const std::string WHITELIST_KEY = "whitelist-repeated-keys";
66}
67
62namespace testing68namespace testing
63{69{
64std::string const DBUS_NAME = "com.canonical.Unity.Test.GnomeKeyGrabber";70std::string const DBUS_NAME = "com.canonical.Unity.Test.GnomeKeyGrabber";
65}71}
6672
67GnomeGrabber::Impl::Impl(bool test_mode)73GnomeGrabber::Impl::Impl(Grabber* parent, bool test_mode)
68 : screen_(screen)74 : parent_(parent)
75 , screen_(screen)
69 , shell_server_(test_mode ? testing::DBUS_NAME : shell::DBUS_NAME)76 , shell_server_(test_mode ? testing::DBUS_NAME : shell::DBUS_NAME)
77 , settings_(g_settings_new(SETTINGS_NAME.c_str()))
70 , current_action_id_(0)78 , current_action_id_(0)
71{79{
72 shell_server_.AddObjects(shell::INTROSPECTION_XML, shell::DBUS_OBJECT_PATH);80 shell_server_.AddObjects(shell::INTROSPECTION_XML, shell::DBUS_OBJECT_PATH);
73 shell_object_ = shell_server_.GetObject(shell::DBUS_INTERFACE);81 shell_object_ = shell_server_.GetObject(shell::DBUS_INTERFACE);
74 shell_object_->SetMethodsCallsHandlerFull(sigc::mem_fun(this, &Impl::OnShellMethodCall));82 shell_object_->SetMethodsCallsHandlerFull(sigc::mem_fun(this, &Impl::OnShellMethodCall));
83
84 whitelist_changed_signal_.Connect(settings_, "changed::" + WHITELIST_KEY, [this] (GSettings*, gchar*) {
85 UpdateWhitelist();
86 });
87
88 UpdateWhitelist();
75}89}
7690
77GnomeGrabber::Impl::~Impl()91GnomeGrabber::Impl::~Impl()
@@ -110,6 +124,7 @@
110 actions_ids_.push_back(action_id);124 actions_ids_.push_back(action_id);
111 actions_.push_back(action);125 actions_.push_back(action);
112 actions_customers_.push_back(1);126 actions_customers_.push_back(1);
127 parent_->action_added.emit(action);
113 return true;128 return true;
114 }129 }
115130
@@ -165,6 +180,7 @@
165 LOG_DEBUG(logger) << "RemoveAction (\"" << action->keyToString() << "\")";180 LOG_DEBUG(logger) << "RemoveAction (\"" << action->keyToString() << "\")";
166181
167 screen_->removeAction(action);182 screen_->removeAction(action);
183 parent_->action_removed.emit(*action);
168 actions_.erase(actions_.begin() + index);184 actions_.erase(actions_.begin() + index);
169 actions_ids_.erase(actions_ids_.begin() + index);185 actions_ids_.erase(actions_ids_.begin() + index);
170 actions_customers_.erase(actions_customers_.begin() + index);186 actions_customers_.erase(actions_customers_.begin() + index);
@@ -232,7 +248,8 @@
232 {248 {
233 action.setState(CompAction::StateInitKey);249 action.setState(CompAction::StateInitKey);
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) {
235 if (!CompOption::getBoolOptionNamed(options, "is_repeated"))251 bool is_whitelisted = std::find(whitelist_.begin(), whitelist_.end(), action->keyToString()) != whitelist_.end();
252 if (is_whitelisted || !CompOption::getBoolOptionNamed(options, "is_repeated"))
236 {253 {
237 LOG_DEBUG(logger) << "pressed \"" << action->keyToString() << "\"";254 LOG_DEBUG(logger) << "pressed \"" << action->keyToString() << "\"";
238 ActivateDBusAction(*action, action_id, 0, CompOption::getIntOptionNamed(options, "time"));255 ActivateDBusAction(*action, action_id, 0, CompOption::getIntOptionNamed(options, "time"));
@@ -245,7 +262,6 @@
245 action.setState(CompAction::StateInitKey | CompAction::StateTermKey);262 action.setState(CompAction::StateInitKey | CompAction::StateTermKey);
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) {
247 auto key = action->keyToString();264 auto key = action->keyToString();
248
249 LOG_DEBUG(logger) << "released \"" << key << "\"";265 LOG_DEBUG(logger) << "released \"" << key << "\"";
250266
251 if (state & CompAction::StateTermTapped)267 if (state & CompAction::StateTermTapped)
@@ -326,14 +342,24 @@
326 return keycode == 0 || modHandler->keycodeToModifiers(keycode) != 0;342 return keycode == 0 || modHandler->keycodeToModifiers(keycode) != 0;
327}343}
328344
345void GnomeGrabber::Impl::UpdateWhitelist()
346{
347 std::shared_ptr<gchar*> whitelist(g_settings_get_strv(settings_, WHITELIST_KEY.c_str()), g_strfreev);
348 auto whitelist_raw = whitelist.get();
349
350 whitelist_.clear();
351 for (int i = 0; whitelist_raw[i]; ++i)
352 whitelist_.push_back(whitelist_raw[i]);
353}
354
329// Public implementation355// Public implementation
330356
331GnomeGrabber::GnomeGrabber()357GnomeGrabber::GnomeGrabber()
332 : impl_(new Impl())358 : impl_(new Impl(this))
333{}359{}
334360
335GnomeGrabber::GnomeGrabber(TestMode const& dummy)361GnomeGrabber::GnomeGrabber(TestMode const& dummy)
336 : impl_(new Impl(true))362 : impl_(new Impl(this, true))
337{}363{}
338364
339GnomeGrabber::~GnomeGrabber()365GnomeGrabber::~GnomeGrabber()
340366
=== modified file 'unity-shared/GnomeKeyGrabberImpl.h'
--- unity-shared/GnomeKeyGrabberImpl.h 2015-12-13 10:35:58 +0000
+++ unity-shared/GnomeKeyGrabberImpl.h 2016-07-15 10:12:55 +0000
@@ -28,6 +28,7 @@
28#include <UnityCore/GLibDBusProxy.h>28#include <UnityCore/GLibDBusProxy.h>
29#include <UnityCore/GLibDBusServer.h>29#include <UnityCore/GLibDBusServer.h>
30#include <UnityCore/GLibDBusNameWatcher.h>30#include <UnityCore/GLibDBusNameWatcher.h>
31#include <UnityCore/GLibSignal.h>
3132
32namespace unity33namespace unity
33{34{
@@ -36,7 +37,7 @@
3637
37struct GnomeGrabber::Impl38struct GnomeGrabber::Impl
38{39{
39 Impl(bool test_mode = false);40 Impl(Grabber*, bool test_mode = false);
40 ~Impl();41 ~Impl();
4142
42 uint32_t NextActionID();43 uint32_t NextActionID();
@@ -54,12 +55,18 @@
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;
5556
56 bool IsActionPostponed(CompAction const& action) const;57 bool IsActionPostponed(CompAction const& action) const;
58 void UpdateWhitelist();
5759
60 Grabber* parent_;
58 CompScreen* screen_;61 CompScreen* screen_;
5962
60 glib::DBusServer shell_server_;63 glib::DBusServer shell_server_;
61 glib::DBusObject::Ptr shell_object_;64 glib::DBusObject::Ptr shell_object_;
6265
66 glib::Object<GSettings> settings_;
67 glib::Signal<void, GSettings*, gchar*> whitelist_changed_signal_;
68 std::list<std::string> whitelist_;
69
63 uint32_t current_action_id_;70 uint32_t current_action_id_;
64 std::vector<uint32_t> actions_ids_;71 std::vector<uint32_t> actions_ids_;
65 std::vector<uint32_t> actions_customers_;72 std::vector<uint32_t> actions_customers_;
6673
=== modified file 'unity-shared/KeyGrabber.h'
--- unity-shared/KeyGrabber.h 2015-09-29 13:06:46 +0000
+++ unity-shared/KeyGrabber.h 2016-07-15 10:12:55 +0000
@@ -21,6 +21,7 @@
21#define __UNITY_KEY_GRABBER__21#define __UNITY_KEY_GRABBER__
2222
23#include <core/core.h>23#include <core/core.h>
24#include <sigc++/signal.h>
2425
25namespace unity26namespace unity
26{27{
@@ -36,6 +37,9 @@
36 virtual bool RemoveAction(CompAction const&) = 0;37 virtual bool RemoveAction(CompAction const&) = 0;
37 virtual bool RemoveAction(uint32_t id) = 0;38 virtual bool RemoveAction(uint32_t id) = 0;
3839
40 sigc::signal<void, CompAction const&> action_added;
41 sigc::signal<void, CompAction const&> action_removed;
42
39 virtual CompAction::Vector& GetActions() = 0;43 virtual CompAction::Vector& GetActions() = 0;
40};44};
4145
4246
=== modified file 'unity-shared/OverlayRenderer.cpp'
--- unity-shared/OverlayRenderer.cpp 2016-03-31 05:54:52 +0000
+++ unity-shared/OverlayRenderer.cpp 2016-07-15 10:12:55 +0000
@@ -119,7 +119,7 @@
119 parent->scale = Settings::Instance().em()->DPIScale();119 parent->scale = Settings::Instance().em()->DPIScale();
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)));
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)));
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)));
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)));
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));
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));
@@ -157,7 +157,7 @@
157 bg_layer_->SetColor(new_color);157 bg_layer_->SetColor(new_color);
158158
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.
160 if (Settings::Instance().GetLowGfxMode())160 if (Settings::Instance().low_gfx())
161 {161 {
162 bg_darken_layer_->SetColor(new_color);162 bg_darken_layer_->SetColor(new_color);
163 }163 }
@@ -172,7 +172,7 @@
172 rop.SrcBlend = GL_ONE;172 rop.SrcBlend = GL_ONE;
173 rop.DstBlend = GL_ONE_MINUS_SRC_ALPHA;173 rop.DstBlend = GL_ONE_MINUS_SRC_ALPHA;
174174
175 if (Settings::Instance().GetLowGfxMode() || !nux::GetWindowThread()->GetGraphicsEngine().UsingGLSLCodePath())175 if (Settings::Instance().low_gfx() || !nux::GetWindowThread()->GetGraphicsEngine().UsingGLSLCodePath())
176 {176 {
177 auto& avg_color = WindowManager::Default().average_color;177 auto& avg_color = WindowManager::Default().average_color;
178 bg_layer_ = std::make_shared<nux::ColorLayer>(avg_color(), true, rop);178 bg_layer_ = std::make_shared<nux::ColorLayer>(avg_color(), true, rop);
@@ -185,7 +185,7 @@
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);
186186
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.
188 if (Settings::Instance().GetLowGfxMode())188 if (Settings::Instance().low_gfx())
189 {189 {
190 rop.Blend = false;190 rop.Blend = false;
191 rop.SrcBlend = GL_ONE;191 rop.SrcBlend = GL_ONE;
@@ -565,7 +565,7 @@
565 bg_darken_layer_->SetGeometry(larger_content_geo);565 bg_darken_layer_->SetGeometry(larger_content_geo);
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());
567567
568 if (!settings.GetLowGfxMode())568 if (!settings.low_gfx())
569 {569 {
570#ifndef NUX_OPENGLES_20570#ifndef NUX_OPENGLES_20
571 if (!gfx_context.UsingGLSLCodePath())571 if (!gfx_context.UsingGLSLCodePath())
@@ -984,7 +984,7 @@
984 bgs++;984 bgs++;
985985
986 //Only apply shine if we aren't in low gfx mode.986 //Only apply shine if we aren't in low gfx mode.
987 if (!Settings::Instance().GetLowGfxMode())987 if (!Settings::Instance().low_gfx())
988 {988 {
989#ifndef NUX_OPENGLES_20989#ifndef NUX_OPENGLES_20
990 if (!gfx_context.UsingGLSLCodePath())990 if (!gfx_context.UsingGLSLCodePath())
991991
=== modified file 'unity-shared/PlacesOverlayVScrollBar.cpp'
--- unity-shared/PlacesOverlayVScrollBar.cpp 2016-02-17 12:37:04 +0000
+++ unity-shared/PlacesOverlayVScrollBar.cpp 2016-07-15 10:12:55 +0000
@@ -23,6 +23,7 @@
23#include "AnimationUtils.h"23#include "AnimationUtils.h"
24#include "DashStyle.h"24#include "DashStyle.h"
25#include "PlacesOverlayVScrollBar.h"25#include "PlacesOverlayVScrollBar.h"
26#include "UnitySettings.h"
2627
27namespace unity28namespace unity
28{29{
@@ -124,7 +125,7 @@
124125
125void PlacesOverlayVScrollBar::PerformPageNavigation(ScrollDir dir)126void PlacesOverlayVScrollBar::PerformPageNavigation(ScrollDir dir)
126{127{
127 StartScrollAnimation(dir, _slider->GetBaseHeight(), PAGE_SCROLL_ANIMATION);128 StartScrollAnimation(dir, _slider->GetBaseHeight(), Settings::Instance().low_gfx() ? 0 : PAGE_SCROLL_ANIMATION);
128}129}
129130
130void PlacesOverlayVScrollBar::StartScrollAnimation(ScrollDir dir, int stop, unsigned duration)131void PlacesOverlayVScrollBar::StartScrollAnimation(ScrollDir dir, int stop, unsigned duration)
131132
=== modified file 'unity-shared/SpreadFilter.cpp'
--- unity-shared/SpreadFilter.cpp 2015-12-23 01:16:53 +0000
+++ unity-shared/SpreadFilter.cpp 2016-07-15 10:12:55 +0000
@@ -49,7 +49,7 @@
49}49}
5050
51Filter::Filter()51Filter::Filter()
52 : fade_animator_(FADE_DURATION)52 : fade_animator_(Settings::Instance().low_gfx() ? 0 : FADE_DURATION)
53{53{
54 auto& wm = WindowManager::Default();54 auto& wm = WindowManager::Default();
55 auto& settings = Settings::Instance();55 auto& settings = Settings::Instance();
@@ -110,6 +110,10 @@
110 }110 }
111 });111 });
112112
113 Settings::Instance().low_gfx.changed.connect(sigc::track_obj([this] (bool low_gfx) {
114 fade_animator_.SetDuration(low_gfx ? 0 : FADE_DURATION);
115 }, *this));
116
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)));
114}118}
115119
116120
=== modified file 'unity-shared/UnitySettings.cpp'
--- unity-shared/UnitySettings.cpp 2016-03-18 01:47:08 +0000
+++ unity-shared/UnitySettings.cpp 2016-07-15 10:12:55 +0000
@@ -39,6 +39,7 @@
39const std::string FORM_FACTOR = "form-factor";39const std::string FORM_FACTOR = "form-factor";
40const std::string DOUBLE_CLICK_ACTIVATE = "double-click-activate";40const std::string DOUBLE_CLICK_ACTIVATE = "double-click-activate";
41const std::string DESKTOP_TYPE = "desktop-type";41const std::string DESKTOP_TYPE = "desktop-type";
42const std::string PAM_CHECK_ACCOUNT_TYPE = "pam-check-account-type";
4243
43const std::string LAUNCHER_SETTINGS = "com.canonical.Unity.Launcher";44const std::string LAUNCHER_SETTINGS = "com.canonical.Unity.Launcher";
44const std::string LAUNCHER_POSITION = "launcher-position";45const std::string LAUNCHER_POSITION = "launcher-position";
@@ -66,6 +67,11 @@
66const std::string REMOTE_CONTENT_SETTINGS = "com.canonical.Unity.Lenses";67const std::string REMOTE_CONTENT_SETTINGS = "com.canonical.Unity.Lenses";
67const std::string REMOTE_CONTENT_KEY = "remote-content-search";68const std::string REMOTE_CONTENT_KEY = "remote-content-search";
6869
70const std::string GESTURES_SETTINGS = "com.canonical.Unity.Gestures";
71const std::string LAUNCHER_DRAG = "launcher-drag";
72const std::string DASH_TAP = "dash-tap";
73const std::string WINDOWS_DRAG_PINCH = "windows-drag-pinch";
74
69const int DEFAULT_LAUNCHER_SIZE = 64;75const int DEFAULT_LAUNCHER_SIZE = 64;
70const int MINIMUM_DESKTOP_HEIGHT = 800;76const int MINIMUM_DESKTOP_HEIGHT = 800;
71const int GNOME_SETTINGS_CHANGED_WAIT_SECONDS = 1;77const int GNOME_SETTINGS_CHANGED_WAIT_SECONDS = 1;
@@ -83,6 +89,7 @@
83 , usettings_(g_settings_new(SETTINGS_NAME.c_str()))89 , usettings_(g_settings_new(SETTINGS_NAME.c_str()))
84 , launcher_settings_(g_settings_new(LAUNCHER_SETTINGS.c_str()))90 , launcher_settings_(g_settings_new(LAUNCHER_SETTINGS.c_str()))
85 , lim_settings_(g_settings_new(LIM_SETTINGS.c_str()))91 , lim_settings_(g_settings_new(LIM_SETTINGS.c_str()))
92 , gestures_settings_(g_settings_new(GESTURES_SETTINGS.c_str()))
86 , ui_settings_(g_settings_new(UI_SETTINGS.c_str()))93 , ui_settings_(g_settings_new(UI_SETTINGS.c_str()))
87 , ubuntu_ui_settings_(g_settings_new(UBUNTU_UI_SETTINGS.c_str()))94 , ubuntu_ui_settings_(g_settings_new(UBUNTU_UI_SETTINGS.c_str()))
88 , gnome_ui_settings_(g_settings_new(GNOME_UI_SETTINGS.c_str()))95 , gnome_ui_settings_(g_settings_new(GNOME_UI_SETTINGS.c_str()))
@@ -93,7 +100,6 @@
93 , cursor_scale_(1.0)100 , cursor_scale_(1.0)
94 , cached_double_click_activate_(true)101 , cached_double_click_activate_(true)
95 , changing_gnome_settings_(false)102 , changing_gnome_settings_(false)
96 , lowGfx_(false)
97 , remote_content_enabled_(true)103 , remote_content_enabled_(true)
98 {104 {
99 parent_->form_factor.SetGetterFunction(sigc::mem_fun(this, &Impl::GetFormFactor));105 parent_->form_factor.SetGetterFunction(sigc::mem_fun(this, &Impl::GetFormFactor));
@@ -103,6 +109,7 @@
103 parent_->launcher_position.SetGetterFunction(sigc::mem_fun(this, &Impl::GetLauncherPosition));109 parent_->launcher_position.SetGetterFunction(sigc::mem_fun(this, &Impl::GetLauncherPosition));
104 parent_->launcher_position.SetSetterFunction(sigc::mem_fun(this, &Impl::SetLauncherPosition));110 parent_->launcher_position.SetSetterFunction(sigc::mem_fun(this, &Impl::SetLauncherPosition));
105 parent_->desktop_type.SetGetterFunction(sigc::mem_fun(this, &Impl::GetDesktopType));111 parent_->desktop_type.SetGetterFunction(sigc::mem_fun(this, &Impl::GetDesktopType));
112 parent_->pam_check_account_type.SetGetterFunction(sigc::mem_fun(this, &Impl::GetPamCheckAccountType));
106113
107 for (unsigned i = 0; i < monitors::MAX; ++i)114 for (unsigned i = 0; i < monitors::MAX; ++i)
108 em_converters_.emplace_back(std::make_shared<EMConverter>());115 em_converters_.emplace_back(std::make_shared<EMConverter>());
@@ -160,6 +167,10 @@
160 UpdateLimSetting();167 UpdateLimSetting();
161 });168 });
162169
170 signals_.Add<void, GSettings*, const gchar*>(gestures_settings_, "changed", [this] (GSettings*, const gchar*) {
171 UpdateGesturesSetting();
172 });
173
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) {
164 UpdateRemoteContentSearch();175 UpdateRemoteContentSearch();
165 });176 });
@@ -168,6 +179,7 @@
168179
169 // The order is important here, DPI is the last thing to be updated180 // The order is important here, DPI is the last thing to be updated
170 UpdateLimSetting();181 UpdateLimSetting();
182 UpdateGesturesSetting();
171 UpdateTextScaleFactor();183 UpdateTextScaleFactor();
172 UpdateCursorScaleFactor();184 UpdateCursorScaleFactor();
173 UpdateFontSize();185 UpdateFontSize();
@@ -222,6 +234,14 @@
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());
223 }235 }
224236
237 void UpdateGesturesSetting()
238 {
239 parent_->gestures_launcher_drag = g_settings_get_boolean(gestures_settings_, LAUNCHER_DRAG.c_str());
240 parent_->gestures_dash_tap = g_settings_get_boolean(gestures_settings_, DASH_TAP.c_str());
241 parent_->gestures_windows_drag_pinch = g_settings_get_boolean(gestures_settings_, WINDOWS_DRAG_PINCH.c_str());
242 parent_->gestures_changed.emit();
243 }
244
225 FormFactor GetFormFactor() const245 FormFactor GetFormFactor() const
226 {246 {
227 return cached_form_factor_;247 return cached_form_factor_;
@@ -254,6 +274,11 @@
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()));
255 }275 }
256276
277 bool GetPamCheckAccountType() const
278 {
279 return g_settings_get_boolean(usettings_, PAM_CHECK_ACCOUNT_TYPE.c_str());
280 }
281
257 int GetFontSize() const282 int GetFontSize() const
258 {283 {
259 gint font_size;284 gint font_size;
@@ -384,6 +409,7 @@
384 glib::Object<GSettings> usettings_;409 glib::Object<GSettings> usettings_;
385 glib::Object<GSettings> launcher_settings_;410 glib::Object<GSettings> launcher_settings_;
386 glib::Object<GSettings> lim_settings_;411 glib::Object<GSettings> lim_settings_;
412 glib::Object<GSettings> gestures_settings_;
387 glib::Object<GSettings> ui_settings_;413 glib::Object<GSettings> ui_settings_;
388 glib::Object<GSettings> ubuntu_ui_settings_;414 glib::Object<GSettings> ubuntu_ui_settings_;
389 glib::Object<GSettings> gnome_ui_settings_;415 glib::Object<GSettings> gnome_ui_settings_;
@@ -397,7 +423,6 @@
397 double cursor_scale_;423 double cursor_scale_;
398 bool cached_double_click_activate_;424 bool cached_double_click_activate_;
399 bool changing_gnome_settings_;425 bool changing_gnome_settings_;
400 bool lowGfx_;
401 bool remote_content_enabled_;426 bool remote_content_enabled_;
402};427};
403428
@@ -406,7 +431,8 @@
406//431//
407432
408Settings::Settings()433Settings::Settings()
409 : is_standalone(false)434 : low_gfx(false)
435 , is_standalone(false)
410 , pimpl(new Impl(this))436 , pimpl(new Impl(this))
411{437{
412 if (settings_instance)438 if (settings_instance)
@@ -434,21 +460,6 @@
434 return *settings_instance;460 return *settings_instance;
435}461}
436462
437bool Settings::GetLowGfxMode() const
438{
439 return pimpl->lowGfx_;
440}
441
442void Settings::SetLowGfxMode(const bool low_gfx)
443{
444 if (pimpl->lowGfx_ != low_gfx)
445 {
446 pimpl->lowGfx_ = low_gfx;
447
448 low_gfx_changed.emit();
449 }
450}
451
452EMConverter::Ptr const& Settings::em(int monitor) const463EMConverter::Ptr const& Settings::em(int monitor) const
453{464{
454 return pimpl->em(monitor);465 return pimpl->em(monitor);
455466
=== modified file 'unity-shared/UnitySettings.h'
--- unity-shared/UnitySettings.h 2016-03-18 01:47:08 +0000
+++ unity-shared/UnitySettings.h 2016-07-15 10:12:55 +0000
@@ -54,16 +54,16 @@
54 ~Settings();54 ~Settings();
5555
56 static Settings& Instance();56 static Settings& Instance();
57 bool GetLowGfxMode() const;
58 void SetLowGfxMode(const bool low_gfx);
59 EMConverter::Ptr const& em(int monitor = 0) const;57 EMConverter::Ptr const& em(int monitor = 0) const;
6058
61 void SetLauncherSize(int launcher_size, int monitor);59 void SetLauncherSize(int launcher_size, int monitor);
62 int LauncherSize(int mointor) const;60 int LauncherSize(int mointor) const;
6361
62 nux::Property<bool> low_gfx;
64 nux::RWProperty<FormFactor> form_factor;63 nux::RWProperty<FormFactor> form_factor;
65 nux::Property<bool> is_standalone;64 nux::Property<bool> is_standalone;
66 nux::ROProperty<DesktopType> desktop_type;65 nux::ROProperty<DesktopType> desktop_type;
66 nux::ROProperty<bool> pam_check_account_type;
67 nux::ROProperty<bool> double_click_activate;67 nux::ROProperty<bool> double_click_activate;
68 nux::Property<unsigned> lim_movement_thresold;68 nux::Property<unsigned> lim_movement_thresold;
69 nux::Property<unsigned> lim_double_click_wait;69 nux::Property<unsigned> lim_double_click_wait;
@@ -71,9 +71,13 @@
71 nux::Property<double> font_scaling;71 nux::Property<double> font_scaling;
72 nux::ROProperty<bool> remote_content;72 nux::ROProperty<bool> remote_content;
73 nux::RWProperty<LauncherPosition> launcher_position;73 nux::RWProperty<LauncherPosition> launcher_position;
74 nux::Property<bool> gestures_launcher_drag;
75 nux::Property<bool> gestures_dash_tap;
76 nux::Property<bool> gestures_windows_drag_pinch;
7477
75 sigc::signal<void> dpi_changed;78 sigc::signal<void> dpi_changed;
76 sigc::signal<void> low_gfx_changed;79 sigc::signal<void> low_gfx_changed;
80 sigc::signal<void> gestures_changed;
7781
78private:82private:
79 class Impl;83 class Impl;
8084
=== modified file 'unity-shared/UnityWindowView.cpp'
--- unity-shared/UnityWindowView.cpp 2016-03-31 03:29:07 +0000
+++ unity-shared/UnityWindowView.cpp 2016-07-15 10:12:55 +0000
@@ -282,7 +282,7 @@
282 auto temp_background_color = background_color();282 auto temp_background_color = background_color();
283 auto blend_mode = nux::LAYER_BLEND_MODE_OVERLAY;283 auto blend_mode = nux::LAYER_BLEND_MODE_OVERLAY;
284284
285 if (Settings::Instance().GetLowGfxMode() || BackgroundEffectHelper::blur_type == BLUR_NONE)285 if (Settings::Instance().low_gfx() || BackgroundEffectHelper::blur_type == BLUR_NONE)
286 {286 {
287 temp_background_color.alpha = 1.0f;287 temp_background_color.alpha = 1.0f;
288 blend_mode = nux::LAYER_BLEND_MODE_NORMAL;288 blend_mode = nux::LAYER_BLEND_MODE_NORMAL;

Subscribers

People subscribed via source and target branches

to all changes: