Merge lp:~azzar1/unity/fix-1401911 into lp:unity

Proposed by Andrea Azzarone
Status: Merged
Approved by: Stephen M. Webb
Approved revision: no longer in the source branch.
Merged at revision: 3903
Proposed branch: lp:~azzar1/unity/fix-1401911
Merge into: lp:unity
Diff against target: 171 lines (+45/-7)
5 files modified
launcher/EdgeBarrierController.cpp (+19/-1)
launcher/EdgeBarrierController.h (+1/-0)
plugins/unityshell/src/unityshell.cpp (+8/-4)
plugins/unityshell/src/unityshell.h (+2/-2)
tests/test_edge_barrier_controller.cpp (+15/-0)
To merge this branch: bzr merge lp:~azzar1/unity/fix-1401911
Reviewer Review Type Date Requested Status
Stephen M. Webb (community) Approve
PS Jenkins bot (community) continuous-integration Needs Fixing
Review via email: mp+244657@code.launchpad.net

Commit message

Disable Pointer Barriers during lockscreen.

To post a comment you must log in.
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
Stephen M. Webb (bregma) wrote :

OK

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'launcher/EdgeBarrierController.cpp'
2--- launcher/EdgeBarrierController.cpp 2014-02-27 05:30:25 +0000
3+++ launcher/EdgeBarrierController.cpp 2014-12-12 22:37:30 +0000
4@@ -91,8 +91,15 @@
5 ResizeBarrierList(layout);
6 SetupBarriers(layout);
7 }));*/
8+
9 uscreen->changed.connect(sigc::mem_fun(this, &EdgeBarrierController::Impl::OnUScreenChanged));
10
11+ parent_->force_disable.changed.connect([this] (bool) {
12+ auto monitors = UScreen::GetDefault()->GetMonitors();
13+ ResizeBarrierList(monitors);
14+ SetupBarriers(monitors);
15+ });
16+
17 parent_->sticky_edges.SetGetterFunction([this] {
18 return parent_->options() ? parent_->options()->edge_resist() : false;
19 });
20@@ -158,6 +165,13 @@
21
22 void EdgeBarrierController::Impl::ResizeBarrierList(std::vector<nux::Geometry> const& layout)
23 {
24+ if (parent_->force_disable)
25+ {
26+ vertical_barriers_.clear();
27+ horizontal_barriers_.clear();
28+ return;
29+ }
30+
31 auto num_monitors = layout.size();
32
33 if (vertical_barriers_.size() > num_monitors)
34@@ -197,6 +211,9 @@
35
36 void EdgeBarrierController::Impl::SetupBarriers(std::vector<nux::Geometry> const& layout)
37 {
38+ if (parent_->force_disable())
39+ return;
40+
41 bool edge_resist = parent_->sticky_edges();
42
43 for (unsigned i = 0; i < layout.size(); i++)
44@@ -437,7 +454,8 @@
45 }
46
47 EdgeBarrierController::EdgeBarrierController()
48- : pimpl(new Impl(this))
49+ : force_disable(false)
50+ , pimpl(new Impl(this))
51 {}
52
53 EdgeBarrierController::~EdgeBarrierController()
54
55=== modified file 'launcher/EdgeBarrierController.h'
56--- launcher/EdgeBarrierController.h 2013-11-06 11:21:43 +0000
57+++ launcher/EdgeBarrierController.h 2014-12-12 22:37:30 +0000
58@@ -49,6 +49,7 @@
59 ~EdgeBarrierController();
60
61 nux::RWProperty<bool> sticky_edges;
62+ nux::Property<bool> force_disable;
63 nux::Property<launcher::Options::Ptr> options;
64
65 void AddHorizontalSubscriber(EdgeBarrierSubscriber* subscriber, unsigned int monitor);
66
67=== modified file 'plugins/unityshell/src/unityshell.cpp'
68--- plugins/unityshell/src/unityshell.cpp 2014-11-28 12:55:36 +0000
69+++ plugins/unityshell/src/unityshell.cpp 2014-12-12 22:37:30 +0000
70@@ -47,7 +47,6 @@
71 #include "unityshell.h"
72 #include "BackgroundEffectHelper.h"
73 #include "UnityGestureBroker.h"
74-#include "launcher/EdgeBarrierController.h"
75 #include "launcher/XdndCollectionWindowImp.h"
76 #include "launcher/XdndManagerImp.h"
77 #include "launcher/XdndStartStopNotifierImp.h"
78@@ -3822,6 +3821,9 @@
79
80 showLauncherKeyTerminate(&optionGetShowLauncher(), CompAction::StateTermKey, options);
81 showMenuBarTerminate(&optionGetShowMenuBar(), CompAction::StateTermKey, options);
82+
83+ // We disable the edge barriers, to avoid blocking the mouse pointer during lockscreen
84+ edge_barriers_->force_disable = true;
85 }
86
87 void UnityScreen::OnScreenUnlocked()
88@@ -3836,6 +3838,8 @@
89
90 for (auto& action : getActions())
91 screen->addAction(&action);
92+
93+ edge_barriers_->force_disable = false;
94 }
95
96 void UnityScreen::SaveLockStamp(bool save)
97@@ -3888,9 +3892,9 @@
98 auto xdnd_collection_window = std::make_shared<XdndCollectionWindowImp>();
99 auto xdnd_start_stop_notifier = std::make_shared<XdndStartStopNotifierImp>();
100 auto xdnd_manager = std::make_shared<XdndManagerImp>(xdnd_start_stop_notifier, xdnd_collection_window);
101- auto edge_barriers = std::make_shared<ui::EdgeBarrierController>();
102+ edge_barriers_ = std::make_shared<ui::EdgeBarrierController>();
103
104- launcher_controller_ = std::make_shared<launcher::Controller>(xdnd_manager, edge_barriers);
105+ launcher_controller_ = std::make_shared<launcher::Controller>(xdnd_manager, edge_barriers_);
106 AddChild(launcher_controller_.get());
107
108 switcher_controller_ = std::make_shared<switcher::Controller>();
109@@ -3901,7 +3905,7 @@
110
111 /* Setup panel */
112 timer.Reset();
113- panel_controller_ = std::make_shared<panel::Controller>(menus_, edge_barriers);
114+ panel_controller_ = std::make_shared<panel::Controller>(menus_, edge_barriers_);
115 AddChild(panel_controller_.get());
116 LOG_INFO(logger) << "initLauncher-Panel " << timer.ElapsedSeconds() << "s";
117
118
119=== modified file 'plugins/unityshell/src/unityshell.h'
120--- plugins/unityshell/src/unityshell.h 2014-10-07 10:05:01 +0000
121+++ plugins/unityshell/src/unityshell.h 2014-12-12 22:37:30 +0000
122@@ -54,8 +54,8 @@
123 #include "DashController.h"
124 #include "UnitySettings.h"
125 #include "DashStyle.h"
126+#include "EdgeBarrierController.h"
127 #include "FavoriteStoreGSettings.h"
128-#include "FontSettings.h"
129 #include "ShortcutController.h"
130 #include "LauncherController.h"
131 #include "LockScreenController.h"
132@@ -326,7 +326,6 @@
133 Settings unity_settings_;
134 dash::Style dash_style_;
135 panel::Style panel_style_;
136- FontSettings font_settings_;
137 internal::FavoriteStoreGSettings favorite_store_;
138 ThumbnailGenerator thumbnail_generator_;
139 lockscreen::Settings lockscreen_settings_;
140@@ -349,6 +348,7 @@
141 session::Controller::Ptr session_controller_;
142 lockscreen::DBusManager::Ptr screensaver_dbus_manager_;
143 lockscreen::Controller::Ptr lockscreen_controller_;
144+ ui::EdgeBarrierController::Ptr edge_barriers_;
145 debug::DebugDBusInterface debugger_;
146 std::unique_ptr<BGHash> bghash_;
147 spread::Filter::Ptr spread_filter_;
148
149=== modified file 'tests/test_edge_barrier_controller.cpp'
150--- tests/test_edge_barrier_controller.cpp 2013-11-06 11:21:43 +0000
151+++ tests/test_edge_barrier_controller.cpp 2014-12-12 22:37:30 +0000
152@@ -653,4 +653,19 @@
153 ProcessBarrierEvent(&owner, firstEvent);
154 }
155
156+TEST_F(TestEdgeBarrierController, ForceDisable)
157+{
158+ ASSERT_FALSE(bc.force_disable);
159+
160+ bc.force_disable = true;
161+
162+ ASSERT_TRUE(GetPrivateImpl()->vertical_barriers_.empty());
163+ ASSERT_TRUE(GetPrivateImpl()->horizontal_barriers_.empty());
164+
165+ bc.force_disable = false;
166+
167+ ASSERT_FALSE(GetPrivateImpl()->vertical_barriers_.empty());
168+ ASSERT_FALSE(GetPrivateImpl()->horizontal_barriers_.empty());
169+}
170+
171 }