Merge lp:~3v1n0/unity/lockscreen-panel into lp:unity
- lockscreen-panel
- Merge into trunk
Status: | Merged |
---|---|
Merged at revision: | 3705 |
Proposed branch: | lp:~3v1n0/unity/lockscreen-panel |
Merge into: | lp:unity |
Prerequisite: | lp:~3v1n0/unity/lockscreen-review |
Diff against target: |
1623 lines (+781/-146) 35 files modified
UnityCore/SessionManager.h (+2/-0) lockscreen/BackgroundSettings.cpp (+24/-41) lockscreen/CMakeLists.txt (+1/-0) lockscreen/LockScreenAbstractShield.h (+6/-1) lockscreen/LockScreenController.cpp (+22/-6) lockscreen/LockScreenController.h (+3/-1) lockscreen/LockScreenPanel.cpp (+225/-0) lockscreen/LockScreenPanel.h (+75/-0) lockscreen/LockScreenSettings.cpp (+38/-0) lockscreen/LockScreenSettings.h (+11/-0) lockscreen/LockScreenShield.cpp (+56/-52) lockscreen/LockScreenShield.h (+10/-11) lockscreen/LockScreenShieldFactory.cpp (+2/-2) lockscreen/LockScreenShieldFactory.h (+2/-2) lockscreen/UserAuthenticatorPam.cpp (+1/-1) lockscreen/UserPromptView.cpp (+1/-2) lockscreen/pch/lockscreen_pch.hh (+2/-1) panel/PanelIndicatorEntryView.cpp (+1/-1) panel/PanelIndicatorsView.cpp (+8/-0) panel/PanelIndicatorsView.h (+1/-0) panel/PanelMenuView.cpp (+0/-1) panel/PanelMenuView.h (+0/-1) panel/PanelView.cpp (+6/-14) panel/PanelView.h (+1/-2) plugins/unityshell/src/unityshell.cpp (+28/-4) plugins/unityshell/src/unityshell.h (+3/-0) services/panel-service.c (+1/-1) shutdown/CMakeLists.txt (+1/-0) shutdown/SessionDBusManager.cpp (+180/-0) shutdown/SessionDBusManager.h (+50/-0) shutdown/StandaloneSession.cpp (+1/-0) tests/data/external.gschema.xml (+6/-0) tests/test_lockscreen_controller.cpp (+11/-2) tests/test_mock_session_manager.h (+1/-0) unity-shared/WindowManager.h (+1/-0) |
To merge this branch: | bzr merge lp:~3v1n0/unity/lockscreen-panel |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
PS Jenkins bot (community) | continuous-integration | Needs Fixing | |
Andrea Azzarone (community) | Approve | ||
Brandon Schaefer (community) | Approve | ||
Review via email: mp+209797@code.launchpad.net |
Commit message
LockScreenPanel: added a light version of PanelView for Lockscreen only, using PanelIndicatorsView
- Indicators scrubbing using mouse works again
- Indicators key navigation is supported (Alt+F10 included)
- Indicators will be correctly visible in light themes as well
- Show hostname (optionally) on the top left side of the panel
- LockScreenSettings now bind settings from unity-greeter dconf path
Description of the change
PS Jenkins bot (ps-jenkins) wrote : | # |
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:3744
http://
Executed test runs:
None: http://
None: http://
None: http://
Click here to trigger a rebuild:
http://
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:3745
http://
Executed test runs:
FAILURE: http://
FAILURE: http://
FAILURE: http://
Click here to trigger a rebuild:
http://
Brandon Schaefer (brandontschaefer) wrote : | # |
LGTM
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:3749
http://
Executed test runs:
FAILURE: http://
FAILURE: http://
FAILURE: http://
Click here to trigger a rebuild:
http://
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:3750
http://
Executed test runs:
FAILURE: http://
FAILURE: http://
FAILURE: http://
Click here to trigger a rebuild:
http://
Andrea Azzarone (azzar1) wrote : | # |
Look good to me now.
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:3751
http://
Executed test runs:
FAILURE: http://
FAILURE: http://
FAILURE: http://
Click here to trigger a rebuild:
http://
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:3756
http://
Executed test runs:
FAILURE: http://
FAILURE: http://
FAILURE: http://
Click here to trigger a rebuild:
http://
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:3757
http://
Executed test runs:
FAILURE: http://
FAILURE: http://
FAILURE: http://
Click here to trigger a rebuild:
http://
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:3758
http://
Executed test runs:
FAILURE: http://
FAILURE: http://
FAILURE: http://
Click here to trigger a rebuild:
http://
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:3759
http://
Executed test runs:
FAILURE: http://
FAILURE: http://
FAILURE: http://
Click here to trigger a rebuild:
http://
Preview Diff
1 | === modified file 'UnityCore/SessionManager.h' | |||
2 | --- UnityCore/SessionManager.h 2014-03-11 14:11:14 +0000 | |||
3 | +++ UnityCore/SessionManager.h 2014-03-11 14:11:15 +0000 | |||
4 | @@ -59,6 +59,8 @@ | |||
5 | 59 | 59 | ||
6 | 60 | sigc::signal<void> lock_requested; | 60 | sigc::signal<void> lock_requested; |
7 | 61 | sigc::signal<void> unlock_requested; | 61 | sigc::signal<void> unlock_requested; |
8 | 62 | sigc::signal<void> locked; | ||
9 | 63 | sigc::signal<void> unlocked; | ||
10 | 62 | sigc::signal<void, bool /* inhibitors */> logout_requested; | 64 | sigc::signal<void, bool /* inhibitors */> logout_requested; |
11 | 63 | sigc::signal<void, bool /* inhibitors */> reboot_requested; | 65 | sigc::signal<void, bool /* inhibitors */> reboot_requested; |
12 | 64 | sigc::signal<void, bool /* inhibitors */> shutdown_requested; | 66 | sigc::signal<void, bool /* inhibitors */> shutdown_requested; |
13 | 65 | 67 | ||
14 | === modified file 'lockscreen/BackgroundSettings.cpp' | |||
15 | --- lockscreen/BackgroundSettings.cpp 2014-03-11 14:11:14 +0000 | |||
16 | +++ lockscreen/BackgroundSettings.cpp 2014-03-11 14:11:15 +0000 | |||
17 | @@ -34,12 +34,6 @@ | |||
18 | 34 | namespace | 34 | namespace |
19 | 35 | { | 35 | { |
20 | 36 | const std::string SETTINGS_NAME = "org.gnome.desktop.background"; | 36 | const std::string SETTINGS_NAME = "org.gnome.desktop.background"; |
21 | 37 | const std::string GREETER_SETTINGS = "com.canonical.unity-greeter"; | ||
22 | 38 | const std::string LOGO_KEY = "logo"; | ||
23 | 39 | const std::string BACKGROUND_KEY = "background"; | ||
24 | 40 | const std::string BACKGROUND_COLOR_KEY = "background-color"; | ||
25 | 41 | const std::string USER_BG_KEY = "draw-user-backgrounds"; | ||
26 | 42 | const std::string DRAW_GRID_KEY = "draw-grid"; | ||
27 | 43 | 37 | ||
28 | 44 | constexpr int GetGridOffset(int size) { return (size % Settings::GRID_SIZE) / 2; } | 38 | constexpr int GetGridOffset(int size) { return (size % Settings::GRID_SIZE) / 2; } |
29 | 45 | } | 39 | } |
30 | @@ -57,30 +51,23 @@ | |||
31 | 57 | BaseTexturePtr BackgroundSettings::GetBackgroundTexture(int monitor) | 51 | BaseTexturePtr BackgroundSettings::GetBackgroundTexture(int monitor) |
32 | 58 | { | 52 | { |
33 | 59 | nux::Geometry const& geo = UScreen::GetDefault()->GetMonitorGeometry(monitor); | 53 | nux::Geometry const& geo = UScreen::GetDefault()->GetMonitorGeometry(monitor); |
37 | 60 | glib::Object<GSettings> greeter_settings(g_settings_new(GREETER_SETTINGS.c_str())); | 54 | auto& settings = Settings::Instance(); |
35 | 61 | bool user_bg = g_settings_get_boolean(greeter_settings, USER_BG_KEY.c_str()) != FALSE; | ||
36 | 62 | bool draw_grid = g_settings_get_boolean(greeter_settings, DRAW_GRID_KEY.c_str()) != FALSE; | ||
38 | 63 | 55 | ||
39 | 64 | nux::CairoGraphics cairo_graphics(CAIRO_FORMAT_ARGB32, geo.width, geo.height); | 56 | nux::CairoGraphics cairo_graphics(CAIRO_FORMAT_ARGB32, geo.width, geo.height); |
40 | 65 | cairo_t* c = cairo_graphics.GetInternalContext(); | 57 | cairo_t* c = cairo_graphics.GetInternalContext(); |
41 | 66 | 58 | ||
42 | 67 | cairo_surface_t* bg_surface = nullptr; | 59 | cairo_surface_t* bg_surface = nullptr; |
43 | 68 | 60 | ||
45 | 69 | if (user_bg) | 61 | if (settings.use_user_background()) |
46 | 70 | { | 62 | { |
47 | 71 | bg_surface = gnome_bg_create_surface(gnome_bg_, gdk_get_default_root_window(), geo.width, geo.height, FALSE); | 63 | bg_surface = gnome_bg_create_surface(gnome_bg_, gdk_get_default_root_window(), geo.width, geo.height, FALSE); |
48 | 72 | } | 64 | } |
50 | 73 | else | 65 | else if (!settings.background().empty()) |
51 | 74 | { | 66 | { |
61 | 75 | glib::String bg_file(g_settings_get_string(greeter_settings, BACKGROUND_KEY.c_str())); | 67 | glib::Object<GdkPixbuf> pixbuf(gdk_pixbuf_new_from_file_at_scale(settings.background().c_str(), geo.width, geo.height, FALSE, NULL)); |
62 | 76 | 68 | ||
63 | 77 | if (bg_file) | 69 | if (pixbuf) |
64 | 78 | { | 70 | bg_surface = gdk_cairo_surface_create_from_pixbuf(pixbuf, 0, NULL); |
56 | 79 | glib::Object<GdkPixbuf> pixbuf(gdk_pixbuf_new_from_file_at_scale(bg_file, geo.width, geo.height, FALSE, NULL)); | ||
57 | 80 | |||
58 | 81 | if (pixbuf) | ||
59 | 82 | bg_surface = gdk_cairo_surface_create_from_pixbuf(pixbuf, 0, NULL); | ||
60 | 83 | } | ||
65 | 84 | } | 71 | } |
66 | 85 | 72 | ||
67 | 86 | if (bg_surface) | 73 | if (bg_surface) |
68 | @@ -91,43 +78,39 @@ | |||
69 | 91 | } | 78 | } |
70 | 92 | else | 79 | else |
71 | 93 | { | 80 | { |
73 | 94 | nux::Color bg_color(glib::String(g_settings_get_string(greeter_settings, BACKGROUND_COLOR_KEY.c_str())).Str()); | 81 | auto const& bg_color = settings.background_color(); |
74 | 95 | cairo_set_source_rgb(c, bg_color.red, bg_color.green, bg_color.blue); | 82 | cairo_set_source_rgb(c, bg_color.red, bg_color.green, bg_color.blue); |
75 | 96 | cairo_paint(c); | 83 | cairo_paint(c); |
76 | 97 | } | 84 | } |
77 | 98 | 85 | ||
78 | 86 | if (!settings.logo().empty()) | ||
79 | 99 | { | 87 | { |
80 | 100 | glib::String logo(g_settings_get_string(greeter_settings, LOGO_KEY.c_str())); | ||
81 | 101 | int grid_x_offset = GetGridOffset(geo.width); | 88 | int grid_x_offset = GetGridOffset(geo.width); |
82 | 102 | int grid_y_offset = GetGridOffset(geo.height); | 89 | int grid_y_offset = GetGridOffset(geo.height); |
83 | 90 | cairo_surface_t* logo_surface = cairo_image_surface_create_from_png(settings.logo().c_str()); | ||
84 | 103 | 91 | ||
86 | 104 | if (logo && !logo.Str().empty()) | 92 | if (logo_surface) |
87 | 105 | { | 93 | { |
104 | 106 | cairo_surface_t* logo_surface = cairo_image_surface_create_from_png(logo); | 94 | int height = cairo_image_surface_get_height(logo_surface); |
105 | 107 | 95 | int x = grid_x_offset; | |
106 | 108 | if (logo_surface) | 96 | int y = grid_y_offset + Settings::GRID_SIZE * (geo.height / Settings::GRID_SIZE - 1) - height; |
107 | 109 | { | 97 | |
108 | 110 | int height = cairo_image_surface_get_height(logo_surface); | 98 | cairo_save(c); |
109 | 111 | int x = grid_x_offset; | 99 | cairo_translate(c, x, y); |
110 | 112 | int y = grid_y_offset + Settings::GRID_SIZE * (geo.height / Settings::GRID_SIZE - 1) - height; | 100 | |
111 | 113 | 101 | cairo_set_source_surface(c, logo_surface, 0, 0); | |
112 | 114 | cairo_save(c); | 102 | cairo_paint_with_alpha(c, 0.5); |
113 | 115 | cairo_translate(c, x, y); | 103 | cairo_surface_destroy(logo_surface); |
114 | 116 | 104 | cairo_restore(c); | |
99 | 117 | cairo_set_source_surface(c, logo_surface, 0, 0); | ||
100 | 118 | cairo_paint_with_alpha(c, 0.5); | ||
101 | 119 | cairo_surface_destroy(logo_surface); | ||
102 | 120 | cairo_restore(c); | ||
103 | 121 | } | ||
115 | 122 | } | 105 | } |
116 | 123 | } | 106 | } |
117 | 124 | 107 | ||
119 | 125 | if (draw_grid) | 108 | if (settings.draw_grid()) |
120 | 126 | { | 109 | { |
121 | 127 | int width = geo.width; | 110 | int width = geo.width; |
122 | 128 | int height = geo.height; | 111 | int height = geo.height; |
123 | 129 | int grid_x_offset = GetGridOffset(width); | 112 | int grid_x_offset = GetGridOffset(width); |
125 | 130 | int grid_y_offset = GetGridOffset(height); | 113 | int grid_y_offset = GetGridOffset(height) + panel::Style().Instance().PanelHeight(monitor); |
126 | 131 | 114 | ||
127 | 132 | // overlay grid | 115 | // overlay grid |
128 | 133 | cairo_surface_t* overlay_surface = cairo_surface_create_similar(cairo_graphics.GetSurface(), | 116 | cairo_surface_t* overlay_surface = cairo_surface_create_similar(cairo_graphics.GetSurface(), |
129 | 134 | 117 | ||
130 | === modified file 'lockscreen/CMakeLists.txt' | |||
131 | --- lockscreen/CMakeLists.txt 2014-03-11 14:11:14 +0000 | |||
132 | +++ lockscreen/CMakeLists.txt 2014-03-11 14:11:15 +0000 | |||
133 | @@ -23,6 +23,7 @@ | |||
134 | 23 | LockScreenSettings.cpp | 23 | LockScreenSettings.cpp |
135 | 24 | LockScreenShield.cpp | 24 | LockScreenShield.cpp |
136 | 25 | LockScreenShieldFactory.cpp | 25 | LockScreenShieldFactory.cpp |
137 | 26 | LockScreenPanel.cpp | ||
138 | 26 | UserAuthenticatorPam.cpp | 27 | UserAuthenticatorPam.cpp |
139 | 27 | UserPromptView.cpp | 28 | UserPromptView.cpp |
140 | 28 | ) | 29 | ) |
141 | 29 | 30 | ||
142 | === modified file 'lockscreen/LockScreenAbstractShield.h' | |||
143 | --- lockscreen/LockScreenAbstractShield.h 2014-03-11 14:11:14 +0000 | |||
144 | +++ lockscreen/LockScreenAbstractShield.h 2014-03-11 14:11:15 +0000 | |||
145 | @@ -22,6 +22,7 @@ | |||
146 | 22 | 22 | ||
147 | 23 | #include <NuxCore/Property.h> | 23 | #include <NuxCore/Property.h> |
148 | 24 | #include <UnityCore/SessionManager.h> | 24 | #include <UnityCore/SessionManager.h> |
149 | 25 | #include <UnityCore/Indicators.h> | ||
150 | 25 | 26 | ||
151 | 26 | #include "unity-shared/MockableBaseWindow.h" | 27 | #include "unity-shared/MockableBaseWindow.h" |
152 | 27 | 28 | ||
153 | @@ -33,20 +34,24 @@ | |||
154 | 33 | class AbstractShield : public MockableBaseWindow | 34 | class AbstractShield : public MockableBaseWindow |
155 | 34 | { | 35 | { |
156 | 35 | public: | 36 | public: |
158 | 36 | AbstractShield(session::Manager::Ptr const& session, int monitor_num, bool is_primary) | 37 | AbstractShield(session::Manager::Ptr const& session, indicator::Indicators::Ptr const& indicators, int monitor_num, bool is_primary) |
159 | 37 | : MockableBaseWindow("Unity Lockscreen") | 38 | : MockableBaseWindow("Unity Lockscreen") |
160 | 38 | , primary(is_primary) | 39 | , primary(is_primary) |
161 | 39 | , monitor(monitor_num) | 40 | , monitor(monitor_num) |
162 | 40 | , session_manager_(session) | 41 | , session_manager_(session) |
163 | 42 | , indicators_(indicators) | ||
164 | 41 | {} | 43 | {} |
165 | 42 | 44 | ||
166 | 43 | nux::Property<bool> primary; | 45 | nux::Property<bool> primary; |
167 | 44 | nux::Property<int> monitor; | 46 | nux::Property<int> monitor; |
168 | 45 | 47 | ||
169 | 48 | virtual bool IsIndicatorOpen() const = 0; | ||
170 | 49 | |||
171 | 46 | sigc::signal<void, int, int> grab_motion; | 50 | sigc::signal<void, int, int> grab_motion; |
172 | 47 | 51 | ||
173 | 48 | protected: | 52 | protected: |
174 | 49 | session::Manager::Ptr session_manager_; | 53 | session::Manager::Ptr session_manager_; |
175 | 54 | indicator::Indicators::Ptr indicators_; | ||
176 | 50 | }; | 55 | }; |
177 | 51 | 56 | ||
178 | 52 | } // lockscreen | 57 | } // lockscreen |
179 | 53 | 58 | ||
180 | === modified file 'lockscreen/LockScreenController.cpp' | |||
181 | --- lockscreen/LockScreenController.cpp 2014-03-11 14:11:14 +0000 | |||
182 | +++ lockscreen/LockScreenController.cpp 2014-03-11 14:11:15 +0000 | |||
183 | @@ -19,6 +19,7 @@ | |||
184 | 19 | 19 | ||
185 | 20 | #include "LockScreenController.h" | 20 | #include "LockScreenController.h" |
186 | 21 | 21 | ||
187 | 22 | #include <UnityCore/DBusIndicators.h> | ||
188 | 22 | #include "LockScreenShield.h" | 23 | #include "LockScreenShield.h" |
189 | 23 | #include "LockScreenSettings.h" | 24 | #include "LockScreenSettings.h" |
190 | 24 | #include "unity-shared/AnimationUtils.h" | 25 | #include "unity-shared/AnimationUtils.h" |
191 | @@ -68,10 +69,14 @@ | |||
192 | 68 | { | 69 | { |
193 | 69 | motion_connection_->disconnect(); | 70 | motion_connection_->disconnect(); |
194 | 70 | uscreen_connection_->block(); | 71 | uscreen_connection_->block(); |
195 | 72 | session_manager_->unlocked.emit(); | ||
196 | 71 | shields_.clear(); | 73 | shields_.clear(); |
197 | 72 | 74 | ||
198 | 73 | if (Settings::Instance().lockscreen_type() == Type::UNITY) | 75 | if (Settings::Instance().lockscreen_type() == Type::UNITY) |
199 | 76 | { | ||
200 | 74 | upstart_wrapper_->Emit("desktop-unlock"); | 77 | upstart_wrapper_->Emit("desktop-unlock"); |
201 | 78 | indicators_.reset(); | ||
202 | 79 | } | ||
203 | 75 | } | 80 | } |
204 | 76 | }); | 81 | }); |
205 | 77 | } | 82 | } |
206 | @@ -111,7 +116,7 @@ | |||
207 | 111 | 116 | ||
208 | 112 | if (i >= shields_size) | 117 | if (i >= shields_size) |
209 | 113 | { | 118 | { |
211 | 114 | shield = shield_factory_->CreateShield(session_manager_, i, i == primary); | 119 | shield = shield_factory_->CreateShield(session_manager_, indicators_, i, i == primary); |
212 | 115 | is_new = true; | 120 | is_new = true; |
213 | 116 | } | 121 | } |
214 | 117 | 122 | ||
215 | @@ -146,17 +151,20 @@ | |||
216 | 146 | 151 | ||
217 | 147 | if (lockscreen_type == Type::NONE) | 152 | if (lockscreen_type == Type::NONE) |
218 | 148 | { | 153 | { |
219 | 154 | session_manager_->unlocked.emit(); | ||
220 | 149 | return; | 155 | return; |
221 | 150 | } | 156 | } |
223 | 151 | else if (lockscreen_type == Type::LIGHTDM) | 157 | |
224 | 158 | if (lockscreen_type == Type::LIGHTDM) | ||
225 | 152 | { | 159 | { |
226 | 153 | LockScreenUsingDisplayManager(); | 160 | LockScreenUsingDisplayManager(); |
227 | 154 | } | 161 | } |
228 | 155 | else if (lockscreen_type == Type::UNITY) | 162 | else if (lockscreen_type == Type::UNITY) |
229 | 156 | { | 163 | { |
230 | 157 | upstart_wrapper_->Emit("desktop-lock"); | ||
231 | 158 | LockScreenUsingUnity(); | 164 | LockScreenUsingUnity(); |
232 | 159 | } | 165 | } |
233 | 166 | |||
234 | 167 | session_manager_->locked.emit(); | ||
235 | 160 | } | 168 | } |
236 | 161 | 169 | ||
237 | 162 | void Controller::LockScreenUsingDisplayManager() | 170 | void Controller::LockScreenUsingDisplayManager() |
238 | @@ -180,6 +188,9 @@ | |||
239 | 180 | 188 | ||
240 | 181 | void Controller::LockScreenUsingUnity() | 189 | void Controller::LockScreenUsingUnity() |
241 | 182 | { | 190 | { |
242 | 191 | indicators_ = std::make_shared<indicator::LockScreenDBusIndicators>(); | ||
243 | 192 | upstart_wrapper_->Emit("desktop-lock"); | ||
244 | 193 | |||
245 | 183 | ShowShields(); | 194 | ShowShields(); |
246 | 184 | } | 195 | } |
247 | 185 | 196 | ||
248 | @@ -235,9 +246,14 @@ | |||
249 | 235 | return !shields_.empty(); | 246 | return !shields_.empty(); |
250 | 236 | } | 247 | } |
251 | 237 | 248 | ||
255 | 238 | bool Controller::IsShielded() const | 249 | double Controller::Opacity() const |
256 | 239 | { | 250 | { |
257 | 240 | return (fade_animator_.GetCurrentValue() == 1.0f && !shields_.empty()); | 251 | return fade_animator_.GetCurrentValue(); |
258 | 252 | } | ||
259 | 253 | |||
260 | 254 | bool Controller::HasOpenMenu() const | ||
261 | 255 | { | ||
262 | 256 | return primary_shield_.IsValid() ? primary_shield_->IsIndicatorOpen() : false; | ||
263 | 241 | } | 257 | } |
264 | 242 | 258 | ||
265 | 243 | } // lockscreen | 259 | } // lockscreen |
266 | 244 | 260 | ||
267 | === modified file 'lockscreen/LockScreenController.h' | |||
268 | --- lockscreen/LockScreenController.h 2014-03-11 14:11:14 +0000 | |||
269 | +++ lockscreen/LockScreenController.h 2014-03-11 14:11:15 +0000 | |||
270 | @@ -41,7 +41,8 @@ | |||
271 | 41 | bool test_mode = false); | 41 | bool test_mode = false); |
272 | 42 | 42 | ||
273 | 43 | bool IsLocked() const; | 43 | bool IsLocked() const; |
275 | 44 | bool IsShielded() const; | 44 | bool HasOpenMenu() const; |
276 | 45 | double Opacity() const; | ||
277 | 45 | 46 | ||
278 | 46 | private: | 47 | private: |
279 | 47 | friend class TestLockScreenController; | 48 | friend class TestLockScreenController; |
280 | @@ -59,6 +60,7 @@ | |||
281 | 59 | std::vector<nux::ObjectPtr<AbstractShield>> shields_; | 60 | std::vector<nux::ObjectPtr<AbstractShield>> shields_; |
282 | 60 | nux::ObjectWeakPtr<AbstractShield> primary_shield_; | 61 | nux::ObjectWeakPtr<AbstractShield> primary_shield_; |
283 | 61 | session::Manager::Ptr session_manager_; | 62 | session::Manager::Ptr session_manager_; |
284 | 63 | indicator::Indicators::Ptr indicators_; | ||
285 | 62 | UpstartWrapper::Ptr upstart_wrapper_; | 64 | UpstartWrapper::Ptr upstart_wrapper_; |
286 | 63 | ShieldFactoryInterface::Ptr shield_factory_; | 65 | ShieldFactoryInterface::Ptr shield_factory_; |
287 | 64 | nux::animation::AnimateValue<double> fade_animator_; | 66 | nux::animation::AnimateValue<double> fade_animator_; |
288 | 65 | 67 | ||
289 | === added file 'lockscreen/LockScreenPanel.cpp' | |||
290 | --- lockscreen/LockScreenPanel.cpp 1970-01-01 00:00:00 +0000 | |||
291 | +++ lockscreen/LockScreenPanel.cpp 2014-03-11 14:11:15 +0000 | |||
292 | @@ -0,0 +1,225 @@ | |||
293 | 1 | // -*- Mode: C++; indent-tabs-mode: nil; tab-width: 2 -*- | ||
294 | 2 | /* | ||
295 | 3 | * Copyright (C) 2014 Canonical Ltd | ||
296 | 4 | * | ||
297 | 5 | * This program is free software: you can redistribute it and/or modify | ||
298 | 6 | * it under the terms of the GNU General Public License version 3 as | ||
299 | 7 | * published by the Free Software Foundation. | ||
300 | 8 | * | ||
301 | 9 | * This program is distributed in the hope that it will be useful, | ||
302 | 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
303 | 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
304 | 12 | * GNU General Public License for more details. | ||
305 | 13 | * | ||
306 | 14 | * You should have received a copy of the GNU General Public License | ||
307 | 15 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
308 | 16 | * | ||
309 | 17 | * Authored by: Marco Trevisan <marco.trevisan@canonical.com> | ||
310 | 18 | */ | ||
311 | 19 | |||
312 | 20 | #include "LockScreenPanel.h" | ||
313 | 21 | |||
314 | 22 | #include <boost/algorithm/string/trim.hpp> | ||
315 | 23 | #include <Nux/HLayout.h> | ||
316 | 24 | |||
317 | 25 | #include "LockScreenSettings.h" | ||
318 | 26 | #include "panel/PanelIndicatorsView.h" | ||
319 | 27 | #include "unity-shared/CairoTexture.h" | ||
320 | 28 | #include "unity-shared/StaticCairoText.h" | ||
321 | 29 | #include "unity-shared/PanelStyle.h" | ||
322 | 30 | #include "unity-shared/RawPixel.h" | ||
323 | 31 | #include "unity-shared/UnitySettings.h" | ||
324 | 32 | #include "unity-shared/WindowManager.h" | ||
325 | 33 | |||
326 | 34 | namespace unity | ||
327 | 35 | { | ||
328 | 36 | namespace lockscreen | ||
329 | 37 | { | ||
330 | 38 | namespace | ||
331 | 39 | { | ||
332 | 40 | const RawPixel PADDING = 5_em; | ||
333 | 41 | } | ||
334 | 42 | |||
335 | 43 | using namespace indicator; | ||
336 | 44 | using namespace panel; | ||
337 | 45 | |||
338 | 46 | Panel::Panel(int monitor_, Indicators::Ptr const& indicators, session::Manager::Ptr const& session_manager) | ||
339 | 47 | : nux::View(NUX_TRACKER_LOCATION) | ||
340 | 48 | , active(false) | ||
341 | 49 | , monitor(monitor_) | ||
342 | 50 | , indicators_(indicators) | ||
343 | 51 | , needs_geo_sync_(true) | ||
344 | 52 | { | ||
345 | 53 | double scale = unity::Settings::Instance().em(monitor)->DPIScale(); | ||
346 | 54 | auto* layout = new nux::HLayout(); | ||
347 | 55 | layout->SetLeftAndRightPadding(PADDING.CP(scale), 0); | ||
348 | 56 | SetLayout(layout); | ||
349 | 57 | |||
350 | 58 | BuildTexture(); | ||
351 | 59 | |||
352 | 60 | // Add setting | ||
353 | 61 | auto *hostname = new StaticCairoText(session_manager->HostName()); | ||
354 | 62 | hostname->SetFont(Settings::Instance().font_name()); | ||
355 | 63 | hostname->SetTextColor(nux::color::White); | ||
356 | 64 | hostname->SetInputEventSensitivity(false); | ||
357 | 65 | hostname->SetScale(scale); | ||
358 | 66 | hostname->SetVisible(Settings::Instance().show_hostname()); | ||
359 | 67 | layout->AddView(hostname, 1, nux::MINOR_POSITION_CENTER, nux::MINOR_SIZE_FULL); | ||
360 | 68 | |||
361 | 69 | indicators_view_ = new PanelIndicatorsView(); | ||
362 | 70 | indicators_view_->SetMonitor(monitor); | ||
363 | 71 | indicators_view_->OverlayShown(); | ||
364 | 72 | indicators_view_->on_indicator_updated.connect(sigc::mem_fun(this, &Panel::OnIndicatorViewUpdated)); | ||
365 | 73 | layout->AddView(indicators_view_, 1, nux::MINOR_POSITION_CENTER, nux::MINOR_SIZE_FULL); | ||
366 | 74 | |||
367 | 75 | for (auto const& indicator : indicators_->GetIndicators()) | ||
368 | 76 | AddIndicator(indicator); | ||
369 | 77 | |||
370 | 78 | indicators_->on_object_added.connect(sigc::mem_fun(this, &Panel::AddIndicator)); | ||
371 | 79 | indicators_->on_object_removed.connect(sigc::mem_fun(this, &Panel::RemoveIndicator)); | ||
372 | 80 | indicators_->on_entry_show_menu.connect(sigc::mem_fun(this, &Panel::OnEntryShowMenu)); | ||
373 | 81 | indicators_->on_entry_activated.connect(sigc::mem_fun(this, &Panel::OnEntryActivated)); | ||
374 | 82 | indicators_->on_entry_activate_request.connect(sigc::mem_fun(this, &Panel::OnEntryActivateRequest)); | ||
375 | 83 | |||
376 | 84 | monitor.changed.connect([this, hostname] (int monitor) { | ||
377 | 85 | hostname->SetScale(unity::Settings::Instance().em(monitor)->DPIScale()); | ||
378 | 86 | indicators_view_->SetMonitor(monitor); | ||
379 | 87 | BuildTexture(); | ||
380 | 88 | QueueRelayout(); | ||
381 | 89 | }); | ||
382 | 90 | } | ||
383 | 91 | |||
384 | 92 | void Panel::BuildTexture() | ||
385 | 93 | { | ||
386 | 94 | int height = panel::Style::Instance().PanelHeight(monitor); | ||
387 | 95 | nux::CairoGraphics context(CAIRO_FORMAT_ARGB32, 1, height); | ||
388 | 96 | auto* cr = context.GetInternalContext(); | ||
389 | 97 | cairo_set_source_rgb(cr, 0.1, 0.1, 0.1); | ||
390 | 98 | cairo_paint_with_alpha(cr, 0.4); | ||
391 | 99 | bg_texture_ = texture_ptr_from_cairo_graphics(context); | ||
392 | 100 | |||
393 | 101 | view_layout_->SetMinimumHeight(height); | ||
394 | 102 | view_layout_->SetMaximumHeight(height); | ||
395 | 103 | } | ||
396 | 104 | |||
397 | 105 | void Panel::AddIndicator(Indicator::Ptr const& indicator) | ||
398 | 106 | { | ||
399 | 107 | if (indicator->IsAppmenu()) | ||
400 | 108 | return; | ||
401 | 109 | |||
402 | 110 | indicators_view_->AddIndicator(indicator); | ||
403 | 111 | QueueRelayout(); | ||
404 | 112 | QueueDraw(); | ||
405 | 113 | } | ||
406 | 114 | |||
407 | 115 | void Panel::RemoveIndicator(indicator::Indicator::Ptr const& indicator) | ||
408 | 116 | { | ||
409 | 117 | indicators_view_->RemoveIndicator(indicator); | ||
410 | 118 | QueueRelayout(); | ||
411 | 119 | QueueDraw(); | ||
412 | 120 | } | ||
413 | 121 | |||
414 | 122 | std::string Panel::GetPanelName() const | ||
415 | 123 | { | ||
416 | 124 | return "LockScreenPanel" + std::to_string(monitor); | ||
417 | 125 | } | ||
418 | 126 | |||
419 | 127 | void Panel::OnIndicatorViewUpdated() | ||
420 | 128 | { | ||
421 | 129 | needs_geo_sync_ = true; | ||
422 | 130 | QueueRelayout(); | ||
423 | 131 | QueueDraw(); | ||
424 | 132 | } | ||
425 | 133 | |||
426 | 134 | void Panel::OnEntryShowMenu(std::string const& entry_id, unsigned xid, int x, int y, unsigned button) | ||
427 | 135 | { | ||
428 | 136 | if (!GetInputEventSensitivity()) | ||
429 | 137 | return; | ||
430 | 138 | |||
431 | 139 | // This is ugly... But Nux fault! | ||
432 | 140 | WindowManager::Default().UnGrabMousePointer(CurrentTime, button, x, y); | ||
433 | 141 | |||
434 | 142 | active = true; | ||
435 | 143 | } | ||
436 | 144 | |||
437 | 145 | void Panel::OnEntryActivateRequest(std::string const& entry_id) | ||
438 | 146 | { | ||
439 | 147 | if (GetInputEventSensitivity()) | ||
440 | 148 | indicators_view_->ActivateEntry(entry_id, 0); | ||
441 | 149 | } | ||
442 | 150 | |||
443 | 151 | void Panel::ActivateFirst() | ||
444 | 152 | { | ||
445 | 153 | if (GetInputEventSensitivity()) | ||
446 | 154 | indicators_view_->ActivateIfSensitive(); | ||
447 | 155 | } | ||
448 | 156 | |||
449 | 157 | void Panel::OnEntryActivated(std::string const& panel, std::string const& entry_id, nux::Rect const&) | ||
450 | 158 | { | ||
451 | 159 | if (!GetInputEventSensitivity() || (!panel.empty() && panel != GetPanelName())) | ||
452 | 160 | return; | ||
453 | 161 | |||
454 | 162 | bool active = !entry_id.empty(); | ||
455 | 163 | if (active && !track_menu_pointer_timeout_) | ||
456 | 164 | { | ||
457 | 165 | track_menu_pointer_timeout_.reset(new glib::Timeout(16)); | ||
458 | 166 | track_menu_pointer_timeout_->Run([this] { | ||
459 | 167 | nux::Point const& mouse = nux::GetGraphicsDisplay()->GetMouseScreenCoord(); | ||
460 | 168 | if (tracked_pointer_pos_ != mouse) | ||
461 | 169 | { | ||
462 | 170 | if (GetAbsoluteGeometry().IsPointInside(mouse.x, mouse.y)) | ||
463 | 171 | indicators_view_->ActivateEntryAt(mouse.x, mouse.y); | ||
464 | 172 | |||
465 | 173 | tracked_pointer_pos_ = mouse; | ||
466 | 174 | } | ||
467 | 175 | |||
468 | 176 | return true; | ||
469 | 177 | }); | ||
470 | 178 | } | ||
471 | 179 | else if (!active) | ||
472 | 180 | { | ||
473 | 181 | track_menu_pointer_timeout_.reset(); | ||
474 | 182 | tracked_pointer_pos_ = {-1, -1}; | ||
475 | 183 | this->active = false; | ||
476 | 184 | } | ||
477 | 185 | } | ||
478 | 186 | |||
479 | 187 | void Panel::Draw(nux::GraphicsEngine& graphics_engine, bool force_draw) | ||
480 | 188 | { | ||
481 | 189 | auto const& geo = GetGeometry(); | ||
482 | 190 | |||
483 | 191 | unsigned int alpha, src, dest = 0; | ||
484 | 192 | graphics_engine.GetRenderStates().GetBlend(alpha, src, dest); | ||
485 | 193 | graphics_engine.GetRenderStates().SetBlend(true, GL_ONE, GL_ONE_MINUS_SRC_ALPHA); | ||
486 | 194 | |||
487 | 195 | graphics_engine.PushClippingRectangle(geo); | ||
488 | 196 | nux::GetPainter().PaintBackground(graphics_engine, geo); | ||
489 | 197 | |||
490 | 198 | nux::TexCoordXForm texxform; | ||
491 | 199 | texxform.SetWrap(nux::TEXWRAP_REPEAT, nux::TEXWRAP_CLAMP); | ||
492 | 200 | graphics_engine.QRP_1Tex(geo.x, geo.y, geo.width, geo.height, | ||
493 | 201 | bg_texture_->GetDeviceTexture(), texxform, | ||
494 | 202 | nux::color::White); | ||
495 | 203 | |||
496 | 204 | view_layout_->ProcessDraw(graphics_engine, force_draw); | ||
497 | 205 | |||
498 | 206 | graphics_engine.PopClippingRectangle(); | ||
499 | 207 | graphics_engine.GetRenderStates().SetBlend(alpha, src, dest); | ||
500 | 208 | |||
501 | 209 | if (needs_geo_sync_) | ||
502 | 210 | { | ||
503 | 211 | EntryLocationMap locations; | ||
504 | 212 | indicators_view_->GetGeometryForSync(locations); | ||
505 | 213 | indicators_->SyncGeometries(GetPanelName(), locations); | ||
506 | 214 | needs_geo_sync_ = false; | ||
507 | 215 | } | ||
508 | 216 | } | ||
509 | 217 | |||
510 | 218 | bool Panel::InspectKeyEvent(unsigned int event_type, unsigned int keysym, const char*) | ||
511 | 219 | { | ||
512 | 220 | ActivateFirst(); | ||
513 | 221 | return true; | ||
514 | 222 | } | ||
515 | 223 | |||
516 | 224 | } | ||
517 | 225 | } | ||
518 | 0 | 226 | ||
519 | === added file 'lockscreen/LockScreenPanel.h' | |||
520 | --- lockscreen/LockScreenPanel.h 1970-01-01 00:00:00 +0000 | |||
521 | +++ lockscreen/LockScreenPanel.h 2014-03-11 14:11:15 +0000 | |||
522 | @@ -0,0 +1,75 @@ | |||
523 | 1 | // -*- Mode: C++; indent-tabs-mode: nil; tab-width: 2 -*- | ||
524 | 2 | /* | ||
525 | 3 | * Copyright (C) 2014 Canonical Ltd | ||
526 | 4 | * | ||
527 | 5 | * This program is free software: you can redistribute it and/or modify | ||
528 | 6 | * it under the terms of the GNU General Public License version 3 as | ||
529 | 7 | * published by the Free Software Foundation. | ||
530 | 8 | * | ||
531 | 9 | * This program is distributed in the hope that it will be useful, | ||
532 | 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
533 | 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
534 | 12 | * GNU General Public License for more details. | ||
535 | 13 | * | ||
536 | 14 | * You should have received a copy of the GNU General Public License | ||
537 | 15 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
538 | 16 | * | ||
539 | 17 | * Authored by: Marco Trevisan <marco.trevisan@canonical.com> | ||
540 | 18 | */ | ||
541 | 19 | |||
542 | 20 | #ifndef UNITY_LOCKSCREEN_PANEL | ||
543 | 21 | #define UNITY_LOCKSCREEN_PANEL | ||
544 | 22 | |||
545 | 23 | #include <Nux/Nux.h> | ||
546 | 24 | #include <Nux/View.h> | ||
547 | 25 | #include <UnityCore/Indicators.h> | ||
548 | 26 | #include <UnityCore/GLibSource.h> | ||
549 | 27 | #include <UnityCore/SessionManager.h> | ||
550 | 28 | |||
551 | 29 | namespace unity | ||
552 | 30 | { | ||
553 | 31 | namespace panel | ||
554 | 32 | { | ||
555 | 33 | class PanelIndicatorsView; | ||
556 | 34 | } | ||
557 | 35 | |||
558 | 36 | namespace lockscreen | ||
559 | 37 | { | ||
560 | 38 | |||
561 | 39 | class Panel : public nux::View | ||
562 | 40 | { | ||
563 | 41 | public: | ||
564 | 42 | Panel(int monitor, indicator::Indicators::Ptr const&, session::Manager::Ptr const&); | ||
565 | 43 | |||
566 | 44 | nux::Property<bool> active; | ||
567 | 45 | nux::Property<int> monitor; | ||
568 | 46 | |||
569 | 47 | protected: | ||
570 | 48 | void Draw(nux::GraphicsEngine& GfxContext, bool force_draw) override; | ||
571 | 49 | bool InspectKeyEvent(unsigned int event_type, unsigned int keysym, const char*) override; | ||
572 | 50 | |||
573 | 51 | private: | ||
574 | 52 | void ActivateFirst(); | ||
575 | 53 | void AddIndicator(indicator::Indicator::Ptr const&); | ||
576 | 54 | void RemoveIndicator(indicator::Indicator::Ptr const&); | ||
577 | 55 | void OnIndicatorViewUpdated(); | ||
578 | 56 | void OnEntryActivated(std::string const& panel, std::string const& entry_id, nux::Rect const& geo); | ||
579 | 57 | void OnEntryShowMenu(std::string const& entry_id, unsigned xid, int x, int y, unsigned button); | ||
580 | 58 | void OnEntryActivateRequest(std::string const& entry_id); | ||
581 | 59 | |||
582 | 60 | void BuildTexture(); | ||
583 | 61 | std::string GetPanelName() const; | ||
584 | 62 | |||
585 | 63 | indicator::Indicators::Ptr indicators_; | ||
586 | 64 | panel::PanelIndicatorsView* indicators_view_; | ||
587 | 65 | nux::ObjectPtr<nux::BaseTexture> bg_texture_; | ||
588 | 66 | |||
589 | 67 | bool needs_geo_sync_; | ||
590 | 68 | nux::Point tracked_pointer_pos_; | ||
591 | 69 | glib::Source::UniquePtr track_menu_pointer_timeout_; | ||
592 | 70 | }; | ||
593 | 71 | |||
594 | 72 | } // lockscreen namespace | ||
595 | 73 | } // unity namespace | ||
596 | 74 | |||
597 | 75 | #endif // UNITY_LOCKSCREEN_PANEL | ||
598 | 0 | 76 | ||
599 | === modified file 'lockscreen/LockScreenSettings.cpp' | |||
600 | --- lockscreen/LockScreenSettings.cpp 2014-03-11 14:11:14 +0000 | |||
601 | +++ lockscreen/LockScreenSettings.cpp 2014-03-11 14:11:15 +0000 | |||
602 | @@ -20,6 +20,9 @@ | |||
603 | 20 | #include "LockScreenSettings.h" | 20 | #include "LockScreenSettings.h" |
604 | 21 | 21 | ||
605 | 22 | #include <NuxCore/Logger.h> | 22 | #include <NuxCore/Logger.h> |
606 | 23 | #include <sigc++/adaptors/hide.h> | ||
607 | 24 | #include <UnityCore/GLibSignal.h> | ||
608 | 25 | #include <UnityCore/GLibWrapper.h> | ||
609 | 23 | 26 | ||
610 | 24 | namespace unity | 27 | namespace unity |
611 | 25 | { | 28 | { |
612 | @@ -31,8 +34,42 @@ | |||
613 | 31 | namespace | 34 | namespace |
614 | 32 | { | 35 | { |
615 | 33 | Settings* settings_instance = nullptr; | 36 | Settings* settings_instance = nullptr; |
616 | 37 | |||
617 | 38 | const std::string GREETER_SETTINGS = "com.canonical.unity-greeter"; | ||
618 | 39 | const std::string LOGO_KEY = "logo"; | ||
619 | 40 | const std::string FONT_KEY = "font-name"; | ||
620 | 41 | const std::string BACKGROUND_KEY = "background"; | ||
621 | 42 | const std::string BACKGROUND_COLOR_KEY = "background-color"; | ||
622 | 43 | const std::string USER_BG_KEY = "draw-user-backgrounds"; | ||
623 | 44 | const std::string DRAW_GRID_KEY = "draw-grid"; | ||
624 | 45 | const std::string SHOW_HOSTNAME_KEY = "show-hostname"; | ||
625 | 34 | } | 46 | } |
626 | 35 | 47 | ||
627 | 48 | struct Settings::Impl | ||
628 | 49 | { | ||
629 | 50 | Impl() | ||
630 | 51 | : greeter_settings_(g_settings_new(GREETER_SETTINGS.c_str())) | ||
631 | 52 | , signal_(greeter_settings_, "changed", sigc::hide(sigc::hide(sigc::mem_fun(this, &Impl::UpdateSettings)))) | ||
632 | 53 | { | ||
633 | 54 | UpdateSettings(); | ||
634 | 55 | } | ||
635 | 56 | |||
636 | 57 | void UpdateSettings() | ||
637 | 58 | { | ||
638 | 59 | auto* s = settings_instance; | ||
639 | 60 | s->font_name = glib::String(g_settings_get_string(greeter_settings_, FONT_KEY.c_str())).Str(); | ||
640 | 61 | s->logo = glib::String(g_settings_get_string(greeter_settings_, LOGO_KEY.c_str())).Str(); | ||
641 | 62 | s->background = glib::String(g_settings_get_string(greeter_settings_, BACKGROUND_KEY.c_str())).Str(); | ||
642 | 63 | s->background_color = nux::Color(glib::String(g_settings_get_string(greeter_settings_, BACKGROUND_COLOR_KEY.c_str())).Str()); | ||
643 | 64 | s->show_hostname = g_settings_get_boolean(greeter_settings_, SHOW_HOSTNAME_KEY.c_str()) != FALSE; | ||
644 | 65 | s->use_user_background = g_settings_get_boolean(greeter_settings_, USER_BG_KEY.c_str()) != FALSE; | ||
645 | 66 | s->draw_grid = g_settings_get_boolean(greeter_settings_, DRAW_GRID_KEY.c_str()) != FALSE; | ||
646 | 67 | } | ||
647 | 68 | |||
648 | 69 | glib::Object<GSettings> greeter_settings_; | ||
649 | 70 | glib::Signal<void, GSettings*, const gchar*> signal_; | ||
650 | 71 | }; | ||
651 | 72 | |||
652 | 36 | Settings::Settings() | 73 | Settings::Settings() |
653 | 37 | { | 74 | { |
654 | 38 | if (settings_instance) | 75 | if (settings_instance) |
655 | @@ -43,6 +80,7 @@ | |||
656 | 43 | { | 80 | { |
657 | 44 | lockscreen_type = Type::UNITY; | 81 | lockscreen_type = Type::UNITY; |
658 | 45 | settings_instance = this; | 82 | settings_instance = this; |
659 | 83 | impl_.reset(new Impl()); | ||
660 | 46 | } | 84 | } |
661 | 47 | } | 85 | } |
662 | 48 | 86 | ||
663 | 49 | 87 | ||
664 | === modified file 'lockscreen/LockScreenSettings.h' | |||
665 | --- lockscreen/LockScreenSettings.h 2014-03-11 14:11:14 +0000 | |||
666 | +++ lockscreen/LockScreenSettings.h 2014-03-11 14:11:15 +0000 | |||
667 | @@ -45,8 +45,19 @@ | |||
668 | 45 | static Settings& Instance(); | 45 | static Settings& Instance(); |
669 | 46 | 46 | ||
670 | 47 | nux::Property<Type> lockscreen_type; | 47 | nux::Property<Type> lockscreen_type; |
671 | 48 | nux::Property<std::string> font_name; | ||
672 | 49 | nux::Property<std::string> logo; | ||
673 | 50 | nux::Property<std::string> background; | ||
674 | 51 | nux::Property<nux::Color> background_color; | ||
675 | 52 | nux::Property<bool> show_hostname; | ||
676 | 53 | nux::Property<bool> use_user_background; | ||
677 | 54 | nux::Property<bool> draw_grid; | ||
678 | 48 | 55 | ||
679 | 49 | static const int GRID_SIZE = 40; | 56 | static const int GRID_SIZE = 40; |
680 | 57 | |||
681 | 58 | private: | ||
682 | 59 | struct Impl; | ||
683 | 60 | std::unique_ptr<Impl> impl_; | ||
684 | 50 | }; | 61 | }; |
685 | 51 | 62 | ||
686 | 52 | } | 63 | } |
687 | 53 | 64 | ||
688 | === modified file 'lockscreen/LockScreenShield.cpp' | |||
689 | --- lockscreen/LockScreenShield.cpp 2014-03-11 14:11:14 +0000 | |||
690 | +++ lockscreen/LockScreenShield.cpp 2014-03-11 14:11:15 +0000 | |||
691 | @@ -22,26 +22,25 @@ | |||
692 | 22 | #include <Nux/VLayout.h> | 22 | #include <Nux/VLayout.h> |
693 | 23 | #include <Nux/HLayout.h> | 23 | #include <Nux/HLayout.h> |
694 | 24 | #include <Nux/PaintLayer.h> | 24 | #include <Nux/PaintLayer.h> |
695 | 25 | #include <UnityCore/DBusIndicators.h> | ||
696 | 26 | 25 | ||
697 | 27 | #include "BackgroundSettings.h" | 26 | #include "BackgroundSettings.h" |
698 | 28 | #include "CofView.h" | 27 | #include "CofView.h" |
699 | 28 | #include "LockScreenPanel.h" | ||
700 | 29 | #include "LockScreenSettings.h" | 29 | #include "LockScreenSettings.h" |
701 | 30 | #include "UserPromptView.h" | 30 | #include "UserPromptView.h" |
702 | 31 | #include "panel/PanelView.h" | ||
703 | 32 | #include "unity-shared/GnomeKeyGrabber.h" | ||
704 | 33 | #include "unity-shared/PanelStyle.h" | ||
705 | 34 | #include "unity-shared/UScreen.h" | 31 | #include "unity-shared/UScreen.h" |
706 | 32 | #include "unity-shared/WindowManager.h" | ||
707 | 35 | 33 | ||
708 | 36 | namespace unity | 34 | namespace unity |
709 | 37 | { | 35 | { |
710 | 38 | namespace lockscreen | 36 | namespace lockscreen |
711 | 39 | { | 37 | { |
712 | 40 | 38 | ||
716 | 41 | Shield::Shield(session::Manager::Ptr const& session_manager, int monitor_num, bool is_primary) | 39 | Shield::Shield(session::Manager::Ptr const& session_manager, indicator::Indicators::Ptr const& indicators, int monitor_num, bool is_primary) |
717 | 42 | : AbstractShield(session_manager, monitor_num, is_primary) | 40 | : AbstractShield(session_manager, indicators, monitor_num, is_primary) |
718 | 43 | , bg_settings_(new BackgroundSettings) | 41 | , bg_settings_(std::make_shared<BackgroundSettings>()) |
719 | 44 | , prompt_view_(nullptr) | 42 | , prompt_view_(nullptr) |
720 | 43 | , panel_view_(nullptr) | ||
721 | 45 | { | 44 | { |
722 | 46 | is_primary ? ShowPrimaryView() : ShowSecondaryView(); | 45 | is_primary ? ShowPrimaryView() : ShowSecondaryView(); |
723 | 47 | 46 | ||
724 | @@ -50,8 +49,8 @@ | |||
725 | 50 | geometry_changed.connect([this] (nux::Area*, nux::Geometry&) { UpdateBackgroundTexture();}); | 49 | geometry_changed.connect([this] (nux::Area*, nux::Geometry&) { UpdateBackgroundTexture();}); |
726 | 51 | 50 | ||
727 | 52 | monitor.changed.connect([this] (int monitor) { | 51 | monitor.changed.connect([this] (int monitor) { |
730 | 53 | if (primary() && panel_view_) | 52 | if (panel_view_) |
731 | 54 | panel_view_->SetMonitor(monitor); | 53 | panel_view_->monitor = monitor; |
732 | 55 | 54 | ||
733 | 56 | UpdateBackgroundTexture(); | 55 | UpdateBackgroundTexture(); |
734 | 57 | }); | 56 | }); |
735 | @@ -64,6 +63,7 @@ | |||
736 | 64 | } | 63 | } |
737 | 65 | 64 | ||
738 | 66 | is_primary ? ShowPrimaryView() : ShowSecondaryView(); | 65 | is_primary ? ShowPrimaryView() : ShowSecondaryView(); |
739 | 66 | if (panel_view_) panel_view_->SetInputEventSensitivity(is_primary); | ||
740 | 67 | QueueRelayout(); | 67 | QueueRelayout(); |
741 | 68 | QueueDraw(); | 68 | QueueDraw(); |
742 | 69 | }); | 69 | }); |
743 | @@ -132,23 +132,29 @@ | |||
744 | 132 | main_layout->AddView(cof_view); | 132 | main_layout->AddView(cof_view); |
745 | 133 | } | 133 | } |
746 | 134 | 134 | ||
748 | 135 | nux::View* Shield::CreatePanel() | 135 | Panel* Shield::CreatePanel() |
749 | 136 | { | 136 | { |
765 | 137 | auto indicators = std::make_shared<indicator::LockScreenDBusIndicators>(); | 137 | if (!indicators_ || !session_manager_) |
766 | 138 | auto gnome_grabber = std::make_shared<key::GnomeGrabber>(); | 138 | return nullptr; |
767 | 139 | auto menu_manager = std::make_shared<menu::Manager>(indicators, gnome_grabber); | 139 | |
768 | 140 | 140 | panel_view_ = new Panel(monitor, indicators_, session_manager_); | |
769 | 141 | // Hackish but ok for the moment. Would be nice to have menus without grab. | 141 | panel_active_conn_ = panel_view_->active.changed.connect([this] (bool active) { |
770 | 142 | indicators->on_entry_show_menu.connect(sigc::mem_fun(this, &Shield::OnIndicatorEntryShowMenu)); | 142 | if (primary()) |
771 | 143 | indicators->on_entry_activated.connect(sigc::mem_fun(this, &Shield::OnIndicatorEntryActivated)); | 143 | { |
772 | 144 | 144 | if (active) | |
773 | 145 | panel::PanelView* panel_view = new panel::PanelView(this, menu_manager, /*lockscreen_mode*/ true); | 145 | { |
774 | 146 | panel_view->SetMaximumHeight(panel::Style::Instance().PanelHeight(monitor)); | 146 | UnGrabPointer(); |
775 | 147 | panel_view->SetOpacity(0.5); | 147 | UnGrabKeyboard(); |
776 | 148 | panel_view->SetMonitor(monitor); | 148 | } |
777 | 149 | panel_view_ = panel_view; | 149 | else |
778 | 150 | 150 | { | |
779 | 151 | return panel_view; | 151 | GrabPointer(); |
780 | 152 | GrabKeyboard(); | ||
781 | 153 | } | ||
782 | 154 | } | ||
783 | 155 | }); | ||
784 | 156 | |||
785 | 157 | return panel_view_; | ||
786 | 152 | } | 158 | } |
787 | 153 | 159 | ||
788 | 154 | UserPromptView* Shield::CreatePromptView() | 160 | UserPromptView* Shield::CreatePromptView() |
789 | @@ -165,38 +171,31 @@ | |||
790 | 165 | return prompt_view; | 171 | return prompt_view; |
791 | 166 | } | 172 | } |
792 | 167 | 173 | ||
819 | 168 | void Shield::OnIndicatorEntryShowMenu(std::string const&, unsigned, int, int, unsigned) | 174 | nux::Area* Shield::FindKeyFocusArea(unsigned etype, unsigned long key_code, unsigned long modifiers) |
820 | 169 | { | 175 | { |
821 | 170 | if (primary()) | 176 | if (primary) |
822 | 171 | { | 177 | { |
823 | 172 | UnGrabPointer(); | 178 | if (panel_view_) |
824 | 173 | UnGrabKeyboard(); | 179 | { |
825 | 174 | } | 180 | modifiers &= (nux::NUX_STATE_ALT | nux::NUX_STATE_CTRL | nux::NUX_STATE_SUPER | nux::NUX_STATE_SHIFT); |
826 | 175 | } | 181 | auto const& indicators_key = WindowManager::Default().activate_indicators_key(); |
827 | 176 | 182 | ||
828 | 177 | void Shield::OnIndicatorEntryActivated(std::string const& panel, std::string const& entry, nux::Geometry const& geo) | 183 | if (indicators_key.first == modifiers && indicators_key.second == key_code) |
829 | 178 | { | 184 | return panel_view_; |
830 | 179 | if (primary() && entry.empty() and geo.IsNull()) /* on menu closed */ | 185 | } |
831 | 180 | { | 186 | |
832 | 181 | GrabPointer(); | 187 | if (prompt_view_) |
833 | 182 | GrabKeyboard(); | 188 | { |
834 | 183 | } | 189 | auto* focus_view = prompt_view_->focus_view(); |
835 | 184 | } | 190 | |
836 | 185 | 191 | if (focus_view && focus_view->GetInputEventSensitivity()) | |
837 | 186 | nux::Area* Shield::FindKeyFocusArea(unsigned int, unsigned long, unsigned long) | 192 | return focus_view; |
838 | 187 | { | 193 | } |
813 | 188 | if (primary && prompt_view_) | ||
814 | 189 | { | ||
815 | 190 | auto* focus_view = prompt_view_->focus_view(); | ||
816 | 191 | |||
817 | 192 | if (focus_view && focus_view->GetInputEventSensitivity()) | ||
818 | 193 | return focus_view; | ||
839 | 194 | } | 194 | } |
840 | 195 | 195 | ||
841 | 196 | return nullptr; | 196 | return nullptr; |
842 | 197 | } | 197 | } |
843 | 198 | 198 | ||
844 | 199 | |||
845 | 200 | bool Shield::AcceptKeyNavFocus() | 199 | bool Shield::AcceptKeyNavFocus() |
846 | 201 | { | 200 | { |
847 | 202 | return false; | 201 | return false; |
848 | @@ -212,5 +211,10 @@ | |||
849 | 212 | return area; | 211 | return area; |
850 | 213 | } | 212 | } |
851 | 214 | 213 | ||
852 | 214 | bool Shield::IsIndicatorOpen() const | ||
853 | 215 | { | ||
854 | 216 | return panel_view_ ? panel_view_->active() : false; | ||
855 | 217 | } | ||
856 | 218 | |||
857 | 215 | } | 219 | } |
858 | 216 | } | 220 | } |
859 | 217 | 221 | ||
860 | === modified file 'lockscreen/LockScreenShield.h' | |||
861 | --- lockscreen/LockScreenShield.h 2014-03-11 14:11:14 +0000 | |||
862 | +++ lockscreen/LockScreenShield.h 2014-03-11 14:11:15 +0000 | |||
863 | @@ -20,26 +20,27 @@ | |||
864 | 20 | #ifndef UNITY_LOCKSCREEN_SHIELD_H | 20 | #ifndef UNITY_LOCKSCREEN_SHIELD_H |
865 | 21 | #define UNITY_LOCKSCREEN_SHIELD_H | 21 | #define UNITY_LOCKSCREEN_SHIELD_H |
866 | 22 | 22 | ||
867 | 23 | #include <UnityCore/ConnectionManager.h> | ||
868 | 23 | #include "LockScreenAbstractShield.h" | 24 | #include "LockScreenAbstractShield.h" |
869 | 24 | 25 | ||
870 | 25 | namespace unity | 26 | namespace unity |
871 | 26 | { | 27 | { |
872 | 27 | namespace panel | ||
873 | 28 | { | ||
874 | 29 | class PanelView; | ||
875 | 30 | } | ||
876 | 31 | namespace lockscreen | 28 | namespace lockscreen |
877 | 32 | { | 29 | { |
878 | 33 | 30 | ||
879 | 34 | class BackgroundSettings; | 31 | class BackgroundSettings; |
880 | 35 | class UserAuthenticator; | 32 | class UserAuthenticator; |
881 | 36 | class UserPromptView; | 33 | class UserPromptView; |
882 | 34 | class Panel; | ||
883 | 37 | 35 | ||
884 | 38 | class Shield : public AbstractShield | 36 | class Shield : public AbstractShield |
885 | 39 | { | 37 | { |
886 | 40 | public: | 38 | public: |
889 | 41 | Shield(session::Manager::Ptr const& session_manager, int monitor, bool is_primary); | 39 | Shield(session::Manager::Ptr const&, indicator::Indicators::Ptr const&, int monitor, bool is_primary); |
890 | 42 | 40 | ||
891 | 41 | bool IsIndicatorOpen() const; | ||
892 | 42 | |||
893 | 43 | protected: | ||
894 | 43 | bool AcceptKeyNavFocus() override; | 44 | bool AcceptKeyNavFocus() override; |
895 | 44 | nux::Area* FindKeyFocusArea(unsigned int, unsigned long, unsigned long) override; | 45 | nux::Area* FindKeyFocusArea(unsigned int, unsigned long, unsigned long) override; |
896 | 45 | nux::Area* FindAreaUnderMouse(nux::Point const&, nux::NuxEventType) override; | 46 | nux::Area* FindAreaUnderMouse(nux::Point const&, nux::NuxEventType) override; |
897 | @@ -48,18 +49,16 @@ | |||
898 | 48 | void UpdateBackgroundTexture(); | 49 | void UpdateBackgroundTexture(); |
899 | 49 | void ShowPrimaryView(); | 50 | void ShowPrimaryView(); |
900 | 50 | void ShowSecondaryView(); | 51 | void ShowSecondaryView(); |
902 | 51 | nux::View* CreatePanel(); | 52 | Panel* CreatePanel(); |
903 | 52 | UserPromptView* CreatePromptView(); | 53 | UserPromptView* CreatePromptView(); |
904 | 53 | 54 | ||
905 | 54 | void OnIndicatorEntryShowMenu(std::string const&, unsigned, int, int, unsigned); | ||
906 | 55 | void OnIndicatorEntryActivated(std::string const& panel, std::string const& entry, nux::Geometry const& geo); | ||
907 | 56 | |||
908 | 57 | std::shared_ptr<BackgroundSettings> bg_settings_; | 55 | std::shared_ptr<BackgroundSettings> bg_settings_; |
909 | 58 | std::unique_ptr<nux::AbstractPaintLayer> background_layer_; | 56 | std::unique_ptr<nux::AbstractPaintLayer> background_layer_; |
910 | 59 | nux::ObjectPtr<nux::Layout> primary_layout_; | 57 | nux::ObjectPtr<nux::Layout> primary_layout_; |
911 | 60 | nux::ObjectPtr<nux::Layout> cof_layout_; | 58 | nux::ObjectPtr<nux::Layout> cof_layout_; |
912 | 59 | connection::Wrapper panel_active_conn_; | ||
913 | 61 | UserPromptView* prompt_view_; | 60 | UserPromptView* prompt_view_; |
915 | 62 | panel::PanelView* panel_view_; | 61 | Panel* panel_view_; |
916 | 63 | }; | 62 | }; |
917 | 64 | 63 | ||
918 | 65 | } | 64 | } |
919 | 66 | 65 | ||
920 | === modified file 'lockscreen/LockScreenShieldFactory.cpp' | |||
921 | --- lockscreen/LockScreenShieldFactory.cpp 2014-03-11 14:11:14 +0000 | |||
922 | +++ lockscreen/LockScreenShieldFactory.cpp 2014-03-11 14:11:15 +0000 | |||
923 | @@ -25,9 +25,9 @@ | |||
924 | 25 | namespace lockscreen | 25 | namespace lockscreen |
925 | 26 | { | 26 | { |
926 | 27 | 27 | ||
928 | 28 | nux::ObjectPtr<AbstractShield> ShieldFactory::CreateShield(session::Manager::Ptr const& session_manager, int monitor, bool is_primary) | 28 | nux::ObjectPtr<AbstractShield> ShieldFactory::CreateShield(session::Manager::Ptr const& session_manager, indicator::Indicators::Ptr const& indicators, int monitor, bool is_primary) |
929 | 29 | { | 29 | { |
931 | 30 | return nux::ObjectPtr<Shield>(new Shield(session_manager, monitor, is_primary)); | 30 | return nux::ObjectPtr<Shield>(new Shield(session_manager, indicators, monitor, is_primary)); |
932 | 31 | } | 31 | } |
933 | 32 | 32 | ||
934 | 33 | } | 33 | } |
935 | 34 | 34 | ||
936 | === modified file 'lockscreen/LockScreenShieldFactory.h' | |||
937 | --- lockscreen/LockScreenShieldFactory.h 2014-03-11 14:11:14 +0000 | |||
938 | +++ lockscreen/LockScreenShieldFactory.h 2014-03-11 14:11:15 +0000 | |||
939 | @@ -37,12 +37,12 @@ | |||
940 | 37 | 37 | ||
941 | 38 | virtual ~ShieldFactoryInterface() = default; | 38 | virtual ~ShieldFactoryInterface() = default; |
942 | 39 | 39 | ||
944 | 40 | virtual nux::ObjectPtr<AbstractShield> CreateShield(session::Manager::Ptr const&, int monitor, bool is_primary) = 0; | 40 | virtual nux::ObjectPtr<AbstractShield> CreateShield(session::Manager::Ptr const&, indicator::Indicators::Ptr const&, int monitor, bool is_primary) = 0; |
945 | 41 | }; | 41 | }; |
946 | 42 | 42 | ||
947 | 43 | struct ShieldFactory : ShieldFactoryInterface | 43 | struct ShieldFactory : ShieldFactoryInterface |
948 | 44 | { | 44 | { |
950 | 45 | nux::ObjectPtr<AbstractShield> CreateShield(session::Manager::Ptr const&, int monitor, bool is_primary) override; | 45 | nux::ObjectPtr<AbstractShield> CreateShield(session::Manager::Ptr const&, indicator::Indicators::Ptr const&, int monitor, bool is_primary) override; |
951 | 46 | }; | 46 | }; |
952 | 47 | 47 | ||
953 | 48 | } | 48 | } |
954 | 49 | 49 | ||
955 | === modified file 'lockscreen/UserAuthenticatorPam.cpp' | |||
956 | --- lockscreen/UserAuthenticatorPam.cpp 2014-03-11 14:11:14 +0000 | |||
957 | +++ lockscreen/UserAuthenticatorPam.cpp 2014-03-11 14:11:15 +0000 | |||
958 | @@ -77,7 +77,7 @@ | |||
959 | 77 | if (num_msg <= 0) | 77 | if (num_msg <= 0) |
960 | 78 | return PAM_CONV_ERR; | 78 | return PAM_CONV_ERR; |
961 | 79 | 79 | ||
963 | 80 | auto* tmp_response = g_new0(pam_response, num_msg); | 80 | auto* tmp_response = static_cast<pam_response*>(calloc(num_msg, sizeof(pam_response))); |
964 | 81 | 81 | ||
965 | 82 | if (!tmp_response) | 82 | if (!tmp_response) |
966 | 83 | return PAM_CONV_ERR; | 83 | return PAM_CONV_ERR; |
967 | 84 | 84 | ||
968 | === modified file 'lockscreen/UserPromptView.cpp' | |||
969 | --- lockscreen/UserPromptView.cpp 2014-03-11 14:11:14 +0000 | |||
970 | +++ lockscreen/UserPromptView.cpp 2014-03-11 14:11:15 +0000 | |||
971 | @@ -39,7 +39,6 @@ | |||
972 | 39 | const RawPixel MSG_LAYOUT_MARGIN = 15_em; | 39 | const RawPixel MSG_LAYOUT_MARGIN = 15_em; |
973 | 40 | const RawPixel PROMPT_LAYOUT_MARGIN = 5_em; | 40 | const RawPixel PROMPT_LAYOUT_MARGIN = 5_em; |
974 | 41 | const int PROMPT_FONT_SIZE = 13; | 41 | const int PROMPT_FONT_SIZE = 13; |
975 | 42 | const int MESSAGE_FONT_SIZE = 11; | ||
976 | 43 | 42 | ||
977 | 44 | nux::AbstractPaintLayer* CrateBackgroundLayer(int width, int height) | 43 | nux::AbstractPaintLayer* CrateBackgroundLayer(int width, int height) |
978 | 45 | { | 44 | { |
979 | @@ -267,7 +266,7 @@ | |||
980 | 267 | void UserPromptView::AddMessage(std::string const& message, nux::Color const& color) | 266 | void UserPromptView::AddMessage(std::string const& message, nux::Color const& color) |
981 | 268 | { | 267 | { |
982 | 269 | auto* view = new unity::StaticCairoText(""); | 268 | auto* view = new unity::StaticCairoText(""); |
984 | 270 | view->SetFont("Ubuntu "+std::to_string(MESSAGE_FONT_SIZE)); | 269 | view->SetFont(Settings::Instance().font_name()); |
985 | 271 | view->SetTextColor(color); | 270 | view->SetTextColor(color); |
986 | 272 | view->SetText(message); | 271 | view->SetText(message); |
987 | 273 | 272 | ||
988 | 274 | 273 | ||
989 | === modified file 'lockscreen/pch/lockscreen_pch.hh' | |||
990 | --- lockscreen/pch/lockscreen_pch.hh 2014-03-11 14:11:14 +0000 | |||
991 | +++ lockscreen/pch/lockscreen_pch.hh 2014-03-11 14:11:15 +0000 | |||
992 | @@ -28,4 +28,5 @@ | |||
993 | 28 | #include <security/pam_appl.h> | 28 | #include <security/pam_appl.h> |
994 | 29 | 29 | ||
995 | 30 | #include <Nux/Nux.h> | 30 | #include <Nux/Nux.h> |
996 | 31 | #include <UnityCore/SessionManager.h> | ||
997 | 32 | \ No newline at end of file | 31 | \ No newline at end of file |
998 | 32 | #include <UnityCore/SessionManager.h> | ||
999 | 33 | #include <UnityCore/Indicators.h> | ||
1000 | 33 | \ No newline at end of file | 34 | \ No newline at end of file |
1001 | 34 | 35 | ||
1002 | === modified file 'panel/PanelIndicatorEntryView.cpp' | |||
1003 | --- panel/PanelIndicatorEntryView.cpp 2014-02-28 15:01:24 +0000 | |||
1004 | +++ panel/PanelIndicatorEntryView.cpp 2014-03-11 14:11:15 +0000 | |||
1005 | @@ -387,7 +387,7 @@ | |||
1006 | 387 | pango_layout_get_pixel_size(layout, &extents.width, &extents.height); | 387 | pango_layout_get_pixel_size(layout, &extents.width, &extents.height); |
1007 | 388 | int y = (height - extents.height) / 2; | 388 | int y = (height - extents.height) / 2; |
1008 | 389 | 389 | ||
1010 | 390 | if (overlay_showing_) | 390 | if (overlay_showing_ && !IsActive()) |
1011 | 391 | { | 391 | { |
1012 | 392 | cairo_move_to(cr, x, y); | 392 | cairo_move_to(cr, x, y); |
1013 | 393 | cairo_set_source_rgb(cr, 1.0f, 1.0f, 1.0f); | 393 | cairo_set_source_rgb(cr, 1.0f, 1.0f, 1.0f); |
1014 | 394 | 394 | ||
1015 | === modified file 'panel/PanelIndicatorsView.cpp' | |||
1016 | --- panel/PanelIndicatorsView.cpp 2014-02-25 02:38:26 +0000 | |||
1017 | +++ panel/PanelIndicatorsView.cpp 2014-03-11 14:11:15 +0000 | |||
1018 | @@ -42,6 +42,7 @@ | |||
1019 | 42 | , opacity(1.0f, sigc::mem_fun(this, &PanelIndicatorsView::SetOpacity)) | 42 | , opacity(1.0f, sigc::mem_fun(this, &PanelIndicatorsView::SetOpacity)) |
1020 | 43 | , layout_(new nux::HLayout("", NUX_TRACKER_LOCATION)) | 43 | , layout_(new nux::HLayout("", NUX_TRACKER_LOCATION)) |
1021 | 44 | , monitor_(0) | 44 | , monitor_(0) |
1022 | 45 | , overlay_showing_(false) | ||
1023 | 45 | { | 46 | { |
1024 | 46 | opacity.DisableNotifications(); | 47 | opacity.DisableNotifications(); |
1025 | 47 | layout_->SetContentDistribution(nux::MAJOR_POSITION_END); | 48 | layout_->SetContentDistribution(nux::MAJOR_POSITION_END); |
1026 | @@ -327,6 +328,9 @@ | |||
1027 | 327 | auto view = new PanelIndicatorEntryView(entry, padding, type); | 328 | auto view = new PanelIndicatorEntryView(entry, padding, type); |
1028 | 328 | AddEntryView(view, pos); | 329 | AddEntryView(view, pos); |
1029 | 329 | 330 | ||
1030 | 331 | if (overlay_showing_) | ||
1031 | 332 | view->OverlayShown(); | ||
1032 | 333 | |||
1033 | 330 | return view; | 334 | return view; |
1034 | 331 | } | 335 | } |
1035 | 332 | 336 | ||
1036 | @@ -368,12 +372,16 @@ | |||
1037 | 368 | 372 | ||
1038 | 369 | void PanelIndicatorsView::OverlayShown() | 373 | void PanelIndicatorsView::OverlayShown() |
1039 | 370 | { | 374 | { |
1040 | 375 | overlay_showing_ = true; | ||
1041 | 376 | |||
1042 | 371 | for (auto const& entry: entries_) | 377 | for (auto const& entry: entries_) |
1043 | 372 | entry.second->OverlayShown(); | 378 | entry.second->OverlayShown(); |
1044 | 373 | } | 379 | } |
1045 | 374 | 380 | ||
1046 | 375 | void PanelIndicatorsView::OverlayHidden() | 381 | void PanelIndicatorsView::OverlayHidden() |
1047 | 376 | { | 382 | { |
1048 | 383 | overlay_showing_ = false; | ||
1049 | 384 | |||
1050 | 377 | for (auto const& entry: entries_) | 385 | for (auto const& entry: entries_) |
1051 | 378 | entry.second->OverlayHidden(); | 386 | entry.second->OverlayHidden(); |
1052 | 379 | } | 387 | } |
1053 | 380 | 388 | ||
1054 | === modified file 'panel/PanelIndicatorsView.h' | |||
1055 | --- panel/PanelIndicatorsView.h 2014-02-18 04:47:43 +0000 | |||
1056 | +++ panel/PanelIndicatorsView.h 2014-03-11 14:11:15 +0000 | |||
1057 | @@ -98,6 +98,7 @@ | |||
1058 | 98 | Entries entries_; | 98 | Entries entries_; |
1059 | 99 | 99 | ||
1060 | 100 | int monitor_; | 100 | int monitor_; |
1061 | 101 | bool overlay_showing_; | ||
1062 | 101 | 102 | ||
1063 | 102 | private: | 103 | private: |
1064 | 103 | bool SetOpacity(double& target, double const& new_value); | 104 | bool SetOpacity(double& target, double const& new_value); |
1065 | 104 | 105 | ||
1066 | === modified file 'panel/PanelMenuView.cpp' | |||
1067 | --- panel/PanelMenuView.cpp 2014-02-27 05:45:23 +0000 | |||
1068 | +++ panel/PanelMenuView.cpp 2014-03-11 14:11:15 +0000 | |||
1069 | @@ -64,7 +64,6 @@ | |||
1070 | 64 | , is_desktop_focused_(false) | 64 | , is_desktop_focused_(false) |
1071 | 65 | , last_active_view_(nullptr) | 65 | , last_active_view_(nullptr) |
1072 | 66 | , new_application_(nullptr) | 66 | , new_application_(nullptr) |
1073 | 67 | , overlay_showing_(false) | ||
1074 | 68 | , switcher_showing_(false) | 67 | , switcher_showing_(false) |
1075 | 69 | , spread_showing_(false) | 68 | , spread_showing_(false) |
1076 | 70 | , launcher_keynav_(false) | 69 | , launcher_keynav_(false) |
1077 | 71 | 70 | ||
1078 | === modified file 'panel/PanelMenuView.h' | |||
1079 | --- panel/PanelMenuView.h 2014-02-27 05:45:23 +0000 | |||
1080 | +++ panel/PanelMenuView.h 2014-03-11 14:11:15 +0000 | |||
1081 | @@ -176,7 +176,6 @@ | |||
1082 | 176 | nux::Geometry last_geo_; | 176 | nux::Geometry last_geo_; |
1083 | 177 | nux::Geometry title_geo_; | 177 | nux::Geometry title_geo_; |
1084 | 178 | 178 | ||
1085 | 179 | bool overlay_showing_; | ||
1086 | 180 | bool switcher_showing_; | 179 | bool switcher_showing_; |
1087 | 181 | bool spread_showing_; | 180 | bool spread_showing_; |
1088 | 182 | bool launcher_keynav_; | 181 | bool launcher_keynav_; |
1089 | 183 | 182 | ||
1090 | === modified file 'panel/PanelView.cpp' | |||
1091 | --- panel/PanelView.cpp 2014-03-11 14:11:14 +0000 | |||
1092 | +++ panel/PanelView.cpp 2014-03-11 14:11:15 +0000 | |||
1093 | @@ -48,7 +48,7 @@ | |||
1094 | 48 | 48 | ||
1095 | 49 | NUX_IMPLEMENT_OBJECT_TYPE(PanelView); | 49 | NUX_IMPLEMENT_OBJECT_TYPE(PanelView); |
1096 | 50 | 50 | ||
1098 | 51 | PanelView::PanelView(MockableBaseWindow* parent, menu::Manager::Ptr const& menus, bool lockscreen_mode, NUX_FILE_LINE_DECL) | 51 | PanelView::PanelView(MockableBaseWindow* parent, menu::Manager::Ptr const& menus, NUX_FILE_LINE_DECL) |
1099 | 52 | : View(NUX_FILE_LINE_PARAM) | 52 | : View(NUX_FILE_LINE_PARAM) |
1100 | 53 | , parent_(parent) | 53 | , parent_(parent) |
1101 | 54 | , remote_(menus->Indicators()) | 54 | , remote_(menus->Indicators()) |
1102 | @@ -59,7 +59,6 @@ | |||
1103 | 59 | , opacity_(1.0f) | 59 | , opacity_(1.0f) |
1104 | 60 | , monitor_(0) | 60 | , monitor_(0) |
1105 | 61 | , stored_dash_width_(0) | 61 | , stored_dash_width_(0) |
1106 | 62 | , lockscreen_mode_(lockscreen_mode) | ||
1107 | 63 | , bg_effect_helper_(this) | 62 | , bg_effect_helper_(this) |
1108 | 64 | { | 63 | { |
1109 | 65 | auto& wm = WindowManager::Default(); | 64 | auto& wm = WindowManager::Default(); |
1110 | @@ -98,22 +97,15 @@ | |||
1111 | 98 | menu_view_->EnableDropdownMenu(true, remote_); | 97 | menu_view_->EnableDropdownMenu(true, remote_); |
1112 | 99 | AddPanelView(menu_view_, 0); | 98 | AddPanelView(menu_view_, 0); |
1113 | 100 | 99 | ||
1114 | 101 | if (lockscreen_mode_) | ||
1115 | 102 | menu_view_->SetVisible(false); | ||
1116 | 103 | |||
1117 | 104 | SetCompositionLayout(layout_); | 100 | SetCompositionLayout(layout_); |
1118 | 105 | 101 | ||
1126 | 106 | tray_ = nullptr; | 102 | tray_ = new PanelTray(monitor_); |
1127 | 107 | if (!lockscreen_mode_) | 103 | layout_->AddView(tray_, 0, nux::MINOR_POSITION_CENTER, nux::MINOR_SIZE_FULL); |
1128 | 108 | { | 104 | AddChild(tray_); |
1122 | 109 | tray_ = new PanelTray(monitor_); | ||
1123 | 110 | layout_->AddView(tray_, 0, nux::MINOR_POSITION_CENTER, nux::MINOR_SIZE_FULL); | ||
1124 | 111 | AddChild(tray_); | ||
1125 | 112 | } | ||
1129 | 113 | 105 | ||
1130 | 114 | indicators_ = new PanelIndicatorsView(); | 106 | indicators_ = new PanelIndicatorsView(); |
1131 | 115 | indicators_->SetMonitor(monitor_); | 107 | indicators_->SetMonitor(monitor_); |
1133 | 116 | AddPanelView(indicators_, lockscreen_mode_ ? 1 : 0); | 108 | AddPanelView(indicators_, 0); |
1134 | 117 | 109 | ||
1135 | 118 | for (auto const& object : remote_->GetIndicators()) | 110 | for (auto const& object : remote_->GetIndicators()) |
1136 | 119 | OnObjectAdded(object); | 111 | OnObjectAdded(object); |
1137 | @@ -301,7 +293,7 @@ | |||
1138 | 301 | { | 293 | { |
1139 | 302 | bg_blur_texture_ = bg_effect_helper_.GetBlurRegion(); | 294 | bg_blur_texture_ = bg_effect_helper_.GetBlurRegion(); |
1140 | 303 | } | 295 | } |
1142 | 304 | else if(!lockscreen_mode_) | 296 | else |
1143 | 305 | { | 297 | { |
1144 | 306 | bg_blur_texture_ = bg_effect_helper_.GetRegion(); | 298 | bg_blur_texture_ = bg_effect_helper_.GetRegion(); |
1145 | 307 | } | 299 | } |
1146 | 308 | 300 | ||
1147 | === modified file 'panel/PanelView.h' | |||
1148 | --- panel/PanelView.h 2014-03-11 14:11:14 +0000 | |||
1149 | +++ panel/PanelView.h 2014-02-25 22:10:53 +0000 | |||
1150 | @@ -51,7 +51,7 @@ | |||
1151 | 51 | { | 51 | { |
1152 | 52 | NUX_DECLARE_OBJECT_TYPE(PanelView, nux::View); | 52 | NUX_DECLARE_OBJECT_TYPE(PanelView, nux::View); |
1153 | 53 | public: | 53 | public: |
1155 | 54 | PanelView(MockableBaseWindow* parent, menu::Manager::Ptr const&, bool lockscreen_mode_ = false, NUX_FILE_LINE_PROTO); | 54 | PanelView(MockableBaseWindow* parent, menu::Manager::Ptr const&, NUX_FILE_LINE_PROTO); |
1156 | 55 | ~PanelView(); | 55 | ~PanelView(); |
1157 | 56 | 56 | ||
1158 | 57 | MockableBaseWindow* GetParent() const | 57 | MockableBaseWindow* GetParent() const |
1159 | @@ -140,7 +140,6 @@ | |||
1160 | 140 | float opacity_; | 140 | float opacity_; |
1161 | 141 | int monitor_; | 141 | int monitor_; |
1162 | 142 | int stored_dash_width_; | 142 | int stored_dash_width_; |
1163 | 143 | bool lockscreen_mode_; | ||
1164 | 144 | 143 | ||
1165 | 145 | connection::Manager on_indicator_updated_connections_; | 144 | connection::Manager on_indicator_updated_connections_; |
1166 | 146 | connection::Manager maximized_opacity_toggle_connections_; | 145 | connection::Manager maximized_opacity_toggle_connections_; |
1167 | 147 | 146 | ||
1168 | === modified file 'plugins/unityshell/src/unityshell.cpp' | |||
1169 | --- plugins/unityshell/src/unityshell.cpp 2014-03-11 14:11:14 +0000 | |||
1170 | +++ plugins/unityshell/src/unityshell.cpp 2014-03-11 14:11:15 +0000 | |||
1171 | @@ -338,6 +338,7 @@ | |||
1172 | 338 | optionSetShowDesktopKeyInitiate(boost::bind(&UnityScreen::showDesktopKeyInitiate, this, _1, _2, _3)); | 338 | optionSetShowDesktopKeyInitiate(boost::bind(&UnityScreen::showDesktopKeyInitiate, this, _1, _2, _3)); |
1173 | 339 | optionSetPanelFirstMenuInitiate(boost::bind(&UnityScreen::showPanelFirstMenuKeyInitiate, this, _1, _2, _3)); | 339 | optionSetPanelFirstMenuInitiate(boost::bind(&UnityScreen::showPanelFirstMenuKeyInitiate, this, _1, _2, _3)); |
1174 | 340 | optionSetPanelFirstMenuTerminate(boost::bind(&UnityScreen::showPanelFirstMenuKeyTerminate, this, _1, _2, _3)); | 340 | optionSetPanelFirstMenuTerminate(boost::bind(&UnityScreen::showPanelFirstMenuKeyTerminate, this, _1, _2, _3)); |
1175 | 341 | optionSetPanelFirstMenuNotify(boost::bind(&UnityScreen::optionChanged, this, _1, _2)); | ||
1176 | 341 | optionSetAutomaximizeValueNotify(boost::bind(&UnityScreen::optionChanged, this, _1, _2)); | 342 | optionSetAutomaximizeValueNotify(boost::bind(&UnityScreen::optionChanged, this, _1, _2)); |
1177 | 342 | optionSetDashTapDurationNotify(boost::bind(&UnityScreen::optionChanged, this, _1, _2)); | 343 | optionSetDashTapDurationNotify(boost::bind(&UnityScreen::optionChanged, this, _1, _2)); |
1178 | 343 | optionSetAltTabTimeoutNotify(boost::bind(&UnityScreen::optionChanged, this, _1, _2)); | 344 | optionSetAltTabTimeoutNotify(boost::bind(&UnityScreen::optionChanged, this, _1, _2)); |
1179 | @@ -2582,6 +2583,15 @@ | |||
1180 | 2582 | WindowManager::Default().close_window_key = std::make_pair(modifiers, keysym); | 2583 | WindowManager::Default().close_window_key = std::make_pair(modifiers, keysym); |
1181 | 2583 | } | 2584 | } |
1182 | 2584 | 2585 | ||
1183 | 2586 | void UnityScreen::UpdateActivateIndicatorsKey() | ||
1184 | 2587 | { | ||
1185 | 2588 | CompAction::KeyBinding const& keybind = optionGetPanelFirstMenu().key(); | ||
1186 | 2589 | KeySym keysym = XkbKeycodeToKeysym(screen->dpy(), keybind.keycode(), 0, 0); | ||
1187 | 2590 | unsigned modifiers = CompizModifiersToNux(keybind.modifiers()); | ||
1188 | 2591 | |||
1189 | 2592 | WindowManager::Default().activate_indicators_key = std::make_pair(modifiers, keysym); | ||
1190 | 2593 | } | ||
1191 | 2594 | |||
1192 | 2585 | bool UnityScreen::initPluginActions() | 2595 | bool UnityScreen::initPluginActions() |
1193 | 2586 | { | 2596 | { |
1194 | 2587 | PluginAdapter& adapter = PluginAdapter::Default(); | 2597 | PluginAdapter& adapter = PluginAdapter::Default(); |
1195 | @@ -2810,12 +2820,21 @@ | |||
1196 | 2810 | 2820 | ||
1197 | 2811 | GLWindowPaintAttrib wAttrib = attrib; | 2821 | GLWindowPaintAttrib wAttrib = attrib; |
1198 | 2812 | 2822 | ||
1200 | 2813 | if (window->type() != CompWindowTypePopupMenuMask) | 2823 | if (uScreen->lockscreen_controller_->IsLocked()) |
1201 | 2814 | { | 2824 | { |
1203 | 2815 | if (uScreen->lockscreen_controller_->IsShielded()) | 2825 | if (window->type() != CompWindowTypePopupMenuMask || |
1204 | 2826 | !uScreen->lockscreen_controller_->HasOpenMenu()) | ||
1205 | 2816 | { | 2827 | { |
1208 | 2817 | wAttrib.opacity = 0; | 2828 | // For some reasons PAINT_WINDOW_NO_CORE_INSTANCE_MASK doesn't work here |
1209 | 2818 | return gWindow->glPaint(wAttrib, matrix, region, mask); | 2829 | // (well, it works too much, as it applies to menus too), so we need |
1210 | 2830 | // to paint the windows at the proper opacity, overriding any other | ||
1211 | 2831 | // paint plugin (animation, fade?) that might interfere with us. | ||
1212 | 2832 | wAttrib.opacity = COMPIZ_COMPOSITE_OPAQUE * (1.0f - uScreen->lockscreen_controller_->Opacity()); | ||
1213 | 2833 | int old_index = gWindow->glPaintGetCurrentIndex(); | ||
1214 | 2834 | gWindow->glPaintSetCurrentIndex(MAXSHORT); | ||
1215 | 2835 | bool ret = gWindow->glPaint(wAttrib, matrix, region, mask); | ||
1216 | 2836 | gWindow->glPaintSetCurrentIndex(old_index); | ||
1217 | 2837 | return ret; | ||
1218 | 2819 | } | 2838 | } |
1219 | 2820 | } | 2839 | } |
1220 | 2821 | 2840 | ||
1221 | @@ -3502,6 +3521,9 @@ | |||
1222 | 3502 | case UnityshellOptions::LockScreenType: | 3521 | case UnityshellOptions::LockScreenType: |
1223 | 3503 | lockscreen_settings_.lockscreen_type = static_cast<lockscreen::Type>(optionGetLockScreenType()); | 3522 | lockscreen_settings_.lockscreen_type = static_cast<lockscreen::Type>(optionGetLockScreenType()); |
1224 | 3504 | break; | 3523 | break; |
1225 | 3524 | case UnityshellOptions::PanelFirstMenu: | ||
1226 | 3525 | UpdateActivateIndicatorsKey(); | ||
1227 | 3526 | break; | ||
1228 | 3505 | default: | 3527 | default: |
1229 | 3506 | break; | 3528 | break; |
1230 | 3507 | } | 3529 | } |
1231 | @@ -3644,11 +3666,13 @@ | |||
1232 | 3644 | 3666 | ||
1233 | 3645 | // Setup Session Controller | 3667 | // Setup Session Controller |
1234 | 3646 | auto manager = std::make_shared<session::GnomeManager>(); | 3668 | auto manager = std::make_shared<session::GnomeManager>(); |
1235 | 3669 | session_dbus_manager_ = std::make_shared<session::DBusManager>(manager); | ||
1236 | 3647 | session_controller_ = std::make_shared<session::Controller>(manager); | 3670 | session_controller_ = std::make_shared<session::Controller>(manager); |
1237 | 3648 | AddChild(session_controller_.get()); | 3671 | AddChild(session_controller_.get()); |
1238 | 3649 | 3672 | ||
1239 | 3650 | // Setup Lockscreen Controller | 3673 | // Setup Lockscreen Controller |
1240 | 3651 | lockscreen_controller_ = std::make_shared<lockscreen::Controller>(manager); | 3674 | lockscreen_controller_ = std::make_shared<lockscreen::Controller>(manager); |
1241 | 3675 | UpdateActivateIndicatorsKey(); | ||
1242 | 3652 | 3676 | ||
1243 | 3653 | auto on_launcher_size_changed = [this] (nux::Area* area, int w, int h) { | 3677 | auto on_launcher_size_changed = [this] (nux::Area* area, int w, int h) { |
1244 | 3654 | /* The launcher geometry includes 1px used to draw the right margin | 3678 | /* The launcher geometry includes 1px used to draw the right margin |
1245 | 3655 | 3679 | ||
1246 | === modified file 'plugins/unityshell/src/unityshell.h' | |||
1247 | --- plugins/unityshell/src/unityshell.h 2014-03-11 14:11:14 +0000 | |||
1248 | +++ plugins/unityshell/src/unityshell.h 2014-03-11 14:11:15 +0000 | |||
1249 | @@ -67,6 +67,7 @@ | |||
1250 | 67 | #include "ScreenIntrospection.h" | 67 | #include "ScreenIntrospection.h" |
1251 | 68 | #include "SwitcherController.h" | 68 | #include "SwitcherController.h" |
1252 | 69 | #include "SessionController.h" | 69 | #include "SessionController.h" |
1253 | 70 | #include "SessionDBusManager.h" | ||
1254 | 70 | #include "SpreadFilter.h" | 71 | #include "SpreadFilter.h" |
1255 | 71 | #include "UBusWrapper.h" | 72 | #include "UBusWrapper.h" |
1256 | 72 | #include "UnityshellPrivate.h" | 73 | #include "UnityshellPrivate.h" |
1257 | @@ -299,6 +300,7 @@ | |||
1258 | 299 | unsigned XModifiersToNux(unsigned input) const; | 300 | unsigned XModifiersToNux(unsigned input) const; |
1259 | 300 | 301 | ||
1260 | 301 | void UpdateCloseWindowKey(CompAction::KeyBinding const&); | 302 | void UpdateCloseWindowKey(CompAction::KeyBinding const&); |
1261 | 303 | void UpdateActivateIndicatorsKey(); | ||
1262 | 302 | 304 | ||
1263 | 303 | bool getMipmap () override { return false; } | 305 | bool getMipmap () override { return false; } |
1264 | 304 | 306 | ||
1265 | @@ -329,6 +331,7 @@ | |||
1266 | 329 | switcher::Controller::Ptr switcher_controller_; | 331 | switcher::Controller::Ptr switcher_controller_; |
1267 | 330 | hud::Controller::Ptr hud_controller_; | 332 | hud::Controller::Ptr hud_controller_; |
1268 | 331 | shortcut::Controller::Ptr shortcut_controller_; | 333 | shortcut::Controller::Ptr shortcut_controller_; |
1269 | 334 | session::DBusManager::Ptr session_dbus_manager_; | ||
1270 | 332 | session::Controller::Ptr session_controller_; | 335 | session::Controller::Ptr session_controller_; |
1271 | 333 | std::shared_ptr<lockscreen::Controller> lockscreen_controller_; | 336 | std::shared_ptr<lockscreen::Controller> lockscreen_controller_; |
1272 | 334 | debug::DebugDBusInterface debugger_; | 337 | debug::DebugDBusInterface debugger_; |
1273 | 335 | 338 | ||
1274 | === modified file 'services/panel-service.c' | |||
1275 | --- services/panel-service.c 2014-03-11 14:11:14 +0000 | |||
1276 | +++ services/panel-service.c 2014-03-11 14:11:15 +0000 | |||
1277 | @@ -1327,7 +1327,7 @@ | |||
1278 | 1327 | IndicatorNg *indicator; | 1327 | IndicatorNg *indicator; |
1279 | 1328 | 1328 | ||
1280 | 1329 | filename = g_build_filename (INDICATOR_SERVICE_DIR, name, NULL); | 1329 | filename = g_build_filename (INDICATOR_SERVICE_DIR, name, NULL); |
1282 | 1330 | indicator = indicator_ng_new_for_profile (filename, !lockscreen_mode ? "desktop" : "desktop_greeter", &error); | 1330 | indicator = indicator_ng_new_for_profile (filename, !lockscreen_mode ? "desktop" : "desktop_lockscreen", &error); |
1283 | 1331 | if (indicator) | 1331 | if (indicator) |
1284 | 1332 | { | 1332 | { |
1285 | 1333 | load_indicator (self, INDICATOR_OBJECT (indicator), name); | 1333 | load_indicator (self, INDICATOR_OBJECT (indicator), name); |
1286 | 1334 | 1334 | ||
1287 | === modified file 'shutdown/CMakeLists.txt' | |||
1288 | --- shutdown/CMakeLists.txt 2013-02-17 23:55:54 +0000 | |||
1289 | +++ shutdown/CMakeLists.txt 2014-03-11 14:11:15 +0000 | |||
1290 | @@ -19,6 +19,7 @@ | |||
1291 | 19 | set (SHUTDOWN_SOURCES | 19 | set (SHUTDOWN_SOURCES |
1292 | 20 | SessionButton.cpp | 20 | SessionButton.cpp |
1293 | 21 | SessionController.cpp | 21 | SessionController.cpp |
1294 | 22 | SessionDBusManager.cpp | ||
1295 | 22 | SessionView.cpp | 23 | SessionView.cpp |
1296 | 23 | ) | 24 | ) |
1297 | 24 | 25 | ||
1298 | 25 | 26 | ||
1299 | === added file 'shutdown/SessionDBusManager.cpp' | |||
1300 | --- shutdown/SessionDBusManager.cpp 1970-01-01 00:00:00 +0000 | |||
1301 | +++ shutdown/SessionDBusManager.cpp 2014-03-11 14:11:15 +0000 | |||
1302 | @@ -0,0 +1,180 @@ | |||
1303 | 1 | // -*- Mode: C++; indent-tabs-mode: nil; tab-width: 2 -*- | ||
1304 | 2 | /* | ||
1305 | 3 | * Copyright (C) 2014 Canonical Ltd | ||
1306 | 4 | * | ||
1307 | 5 | * This program is free software: you can redistribute it and/or modify | ||
1308 | 6 | * it under the terms of the GNU General Public License version 3 as | ||
1309 | 7 | * published by the Free Software Foundation. | ||
1310 | 8 | * | ||
1311 | 9 | * This program is distributed in the hope that it will be useful, | ||
1312 | 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
1313 | 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
1314 | 12 | * GNU General Public License for more details. | ||
1315 | 13 | * | ||
1316 | 14 | * You should have received a copy of the GNU General Public License | ||
1317 | 15 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
1318 | 16 | * | ||
1319 | 17 | * Authored by: Marco Trevisan <marco.trevisan@canonical.com> | ||
1320 | 18 | */ | ||
1321 | 19 | |||
1322 | 20 | #include "SessionDBusManager.h" | ||
1323 | 21 | |||
1324 | 22 | namespace unity | ||
1325 | 23 | { | ||
1326 | 24 | namespace session | ||
1327 | 25 | { | ||
1328 | 26 | namespace dbus | ||
1329 | 27 | { | ||
1330 | 28 | const std::string NAME = "com.canonical.Unity"; | ||
1331 | 29 | const std::string INTERFACE = "com.canonical.Unity.Session"; | ||
1332 | 30 | const std::string OBJECT_PATH = "/com/canonical/Unity/Session"; | ||
1333 | 31 | const std::string INTROSPECTION_XML = | ||
1334 | 32 | R"(<node> | ||
1335 | 33 | <interface name="com.canonical.Unity.Session"> | ||
1336 | 34 | <method name="RealName"> | ||
1337 | 35 | <arg type="s" direction="out" name="realname" /> | ||
1338 | 36 | </method> | ||
1339 | 37 | <method name="UserName"> | ||
1340 | 38 | <arg type="s" direction="out" name="username" /> | ||
1341 | 39 | </method> | ||
1342 | 40 | <method name="HostName"> | ||
1343 | 41 | <arg type="s" direction="out" name="hostname" /> | ||
1344 | 42 | </method> | ||
1345 | 43 | <method name="Lock" /> | ||
1346 | 44 | <method name="Logout" /> | ||
1347 | 45 | <method name="RequestLogout" /> | ||
1348 | 46 | <method name="Reboot" /> | ||
1349 | 47 | <method name="RequestReboot" /> | ||
1350 | 48 | <method name="Shutdown" /> | ||
1351 | 49 | <method name="RequestShutdown" /> | ||
1352 | 50 | <method name="Suspend" /> | ||
1353 | 51 | <method name="Hibernate" /> | ||
1354 | 52 | <method name="CancelAction" /> | ||
1355 | 53 | <method name="CanShutdown"> | ||
1356 | 54 | <arg type="b" direction="out" name="canshutdown" /> | ||
1357 | 55 | </method> | ||
1358 | 56 | <method name="CanSuspend"> | ||
1359 | 57 | <arg type="b" direction="out" name="cansuspend" /> | ||
1360 | 58 | </method> | ||
1361 | 59 | <method name="CanHibernate"> | ||
1362 | 60 | <arg type="b" direction="out" name="canhibernate" /> | ||
1363 | 61 | </method> | ||
1364 | 62 | |||
1365 | 63 | <signal name="LockRequested" /> | ||
1366 | 64 | <signal name="Locked" /> | ||
1367 | 65 | <signal name="UnlockRequested" /> | ||
1368 | 66 | <signal name="Unlocked" /> | ||
1369 | 67 | <signal name="LogoutRequested"> | ||
1370 | 68 | <arg type="b" name="have_inhibitors" /> | ||
1371 | 69 | </signal> | ||
1372 | 70 | <signal name="RebootRequested"> | ||
1373 | 71 | <arg type="b" name="have_inhibitors" /> | ||
1374 | 72 | </signal> | ||
1375 | 73 | <signal name="ShutdownRequested"> | ||
1376 | 74 | <arg type="b" name="have_inhibitors" /> | ||
1377 | 75 | </signal> | ||
1378 | 76 | </interface> | ||
1379 | 77 | </node>)"; | ||
1380 | 78 | } | ||
1381 | 79 | |||
1382 | 80 | DBusManager::DBusManager(session::Manager::Ptr const& session) | ||
1383 | 81 | : session_(session) | ||
1384 | 82 | , server_(dbus::NAME) | ||
1385 | 83 | { | ||
1386 | 84 | server_.AddObjects(dbus::INTROSPECTION_XML, dbus::OBJECT_PATH); | ||
1387 | 85 | object_ = server_.GetObject(dbus::INTERFACE); | ||
1388 | 86 | object_->SetMethodsCallsHandler([this] (std::string const& method, GVariant*) -> GVariant* { | ||
1389 | 87 | if (method == "RealName") | ||
1390 | 88 | { | ||
1391 | 89 | return g_variant_new("(s)", session_->RealName().c_str()); | ||
1392 | 90 | } | ||
1393 | 91 | else if (method == "UserName") | ||
1394 | 92 | { | ||
1395 | 93 | return g_variant_new("(s)", session_->UserName().c_str()); | ||
1396 | 94 | } | ||
1397 | 95 | else if (method == "HostName") | ||
1398 | 96 | { | ||
1399 | 97 | return g_variant_new("(s)", session_->HostName().c_str()); | ||
1400 | 98 | } | ||
1401 | 99 | else if (method == "Lock") | ||
1402 | 100 | { | ||
1403 | 101 | session_->LockScreen(); | ||
1404 | 102 | } | ||
1405 | 103 | else if (method == "Logout") | ||
1406 | 104 | { | ||
1407 | 105 | session_->Logout(); | ||
1408 | 106 | } | ||
1409 | 107 | else if (method == "RequestLogout") | ||
1410 | 108 | { | ||
1411 | 109 | session_->logout_requested.emit(false); | ||
1412 | 110 | } | ||
1413 | 111 | else if (method == "Reboot") | ||
1414 | 112 | { | ||
1415 | 113 | session_->Reboot(); | ||
1416 | 114 | } | ||
1417 | 115 | else if (method == "RequestReboot") | ||
1418 | 116 | { | ||
1419 | 117 | session_->reboot_requested.emit(false); | ||
1420 | 118 | } | ||
1421 | 119 | else if (method == "Shutdown") | ||
1422 | 120 | { | ||
1423 | 121 | session_->Shutdown(); | ||
1424 | 122 | } | ||
1425 | 123 | else if (method == "RequestShutdown") | ||
1426 | 124 | { | ||
1427 | 125 | session_->shutdown_requested.emit(false); | ||
1428 | 126 | } | ||
1429 | 127 | else if (method == "Suspend") | ||
1430 | 128 | { | ||
1431 | 129 | session_->Suspend(); | ||
1432 | 130 | } | ||
1433 | 131 | else if (method == "Hibernate") | ||
1434 | 132 | { | ||
1435 | 133 | session_->Hibernate(); | ||
1436 | 134 | } | ||
1437 | 135 | else if (method == "CancelAction") | ||
1438 | 136 | { | ||
1439 | 137 | session_->CancelAction(); | ||
1440 | 138 | session_->cancel_requested.emit(); | ||
1441 | 139 | } | ||
1442 | 140 | else if (method == "CanShutdown") | ||
1443 | 141 | { | ||
1444 | 142 | return g_variant_new("(b)", session_->CanShutdown() != FALSE); | ||
1445 | 143 | } | ||
1446 | 144 | else if (method == "CanSuspend") | ||
1447 | 145 | { | ||
1448 | 146 | return g_variant_new("(b)", session_->CanSuspend() != FALSE); | ||
1449 | 147 | } | ||
1450 | 148 | else if (method == "CanHibernate") | ||
1451 | 149 | { | ||
1452 | 150 | return g_variant_new("(b)", session_->CanHibernate() != FALSE); | ||
1453 | 151 | } | ||
1454 | 152 | |||
1455 | 153 | return nullptr; | ||
1456 | 154 | }); | ||
1457 | 155 | |||
1458 | 156 | connections_.Add(session_->lock_requested.connect([this] { | ||
1459 | 157 | object_->EmitSignal("LockRequested"); | ||
1460 | 158 | })); | ||
1461 | 159 | connections_.Add(session_->locked.connect([this] { | ||
1462 | 160 | object_->EmitSignal("Locked"); | ||
1463 | 161 | })); | ||
1464 | 162 | connections_.Add(session_->unlock_requested.connect([this] { | ||
1465 | 163 | object_->EmitSignal("UnlockRequested"); | ||
1466 | 164 | })); | ||
1467 | 165 | connections_.Add(session_->unlocked.connect([this] { | ||
1468 | 166 | object_->EmitSignal("Unlocked"); | ||
1469 | 167 | })); | ||
1470 | 168 | connections_.Add(session_->logout_requested.connect([this] (bool inhibitors) { | ||
1471 | 169 | object_->EmitSignal("LogoutRequested", g_variant_new("(b)", inhibitors)); | ||
1472 | 170 | })); | ||
1473 | 171 | connections_.Add(session_->reboot_requested.connect([this] (bool inhibitors) { | ||
1474 | 172 | object_->EmitSignal("RebootRequested", g_variant_new("(b)", inhibitors)); | ||
1475 | 173 | })); | ||
1476 | 174 | connections_.Add(session_->shutdown_requested.connect([this] (bool inhibitors) { | ||
1477 | 175 | object_->EmitSignal("ShutdownRequested", g_variant_new("(b)", inhibitors)); | ||
1478 | 176 | })); | ||
1479 | 177 | } | ||
1480 | 178 | |||
1481 | 179 | } // session | ||
1482 | 180 | } // unity | ||
1483 | 0 | 181 | ||
1484 | === added file 'shutdown/SessionDBusManager.h' | |||
1485 | --- shutdown/SessionDBusManager.h 1970-01-01 00:00:00 +0000 | |||
1486 | +++ shutdown/SessionDBusManager.h 2014-03-11 14:11:15 +0000 | |||
1487 | @@ -0,0 +1,50 @@ | |||
1488 | 1 | // -*- Mode: C++; indent-tabs-mode: nil; tab-width: 2 -*- | ||
1489 | 2 | /* | ||
1490 | 3 | * Copyright (C) 2014 Canonical Ltd | ||
1491 | 4 | * | ||
1492 | 5 | * This program is free software: you can redistribute it and/or modify | ||
1493 | 6 | * it under the terms of the GNU General Public License version 3 as | ||
1494 | 7 | * published by the Free Software Foundation. | ||
1495 | 8 | * | ||
1496 | 9 | * This program is distributed in the hope that it will be useful, | ||
1497 | 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
1498 | 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
1499 | 12 | * GNU General Public License for more details. | ||
1500 | 13 | * | ||
1501 | 14 | * You should have received a copy of the GNU General Public License | ||
1502 | 15 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
1503 | 16 | * | ||
1504 | 17 | * Authored by: Marco Trevisan <marco.trevisan@canonical.com> | ||
1505 | 18 | */ | ||
1506 | 19 | |||
1507 | 20 | #ifndef UNITYSHELL_SESSION_DBUS_MANAGER_H | ||
1508 | 21 | #define UNITYSHELL_SESSION_DBUS_MANAGER_H | ||
1509 | 22 | |||
1510 | 23 | #include <UnityCore/ConnectionManager.h> | ||
1511 | 24 | #include <UnityCore/GLibDBusServer.h> | ||
1512 | 25 | #include <UnityCore/SessionManager.h> | ||
1513 | 26 | |||
1514 | 27 | namespace unity | ||
1515 | 28 | { | ||
1516 | 29 | namespace session | ||
1517 | 30 | { | ||
1518 | 31 | |||
1519 | 32 | class DBusManager | ||
1520 | 33 | { | ||
1521 | 34 | public: | ||
1522 | 35 | typedef std::shared_ptr<DBusManager> Ptr; | ||
1523 | 36 | |||
1524 | 37 | DBusManager(session::Manager::Ptr const& manager); | ||
1525 | 38 | virtual ~DBusManager() = default; | ||
1526 | 39 | |||
1527 | 40 | private: | ||
1528 | 41 | session::Manager::Ptr session_; | ||
1529 | 42 | glib::DBusServer server_; | ||
1530 | 43 | glib::DBusObject::Ptr object_; | ||
1531 | 44 | connection::Manager connections_; | ||
1532 | 45 | }; | ||
1533 | 46 | |||
1534 | 47 | } // session | ||
1535 | 48 | } // unity | ||
1536 | 49 | |||
1537 | 50 | #endif | ||
1538 | 0 | 51 | ||
1539 | === modified file 'shutdown/StandaloneSession.cpp' | |||
1540 | --- shutdown/StandaloneSession.cpp 2013-03-07 22:30:02 +0000 | |||
1541 | +++ shutdown/StandaloneSession.cpp 2014-03-11 14:11:15 +0000 | |||
1542 | @@ -38,6 +38,7 @@ | |||
1543 | 38 | 38 | ||
1544 | 39 | std::string RealName() const { return "Marco Trevisan"; } | 39 | std::string RealName() const { return "Marco Trevisan"; } |
1545 | 40 | std::string UserName() const { return "marco"; } | 40 | std::string UserName() const { return "marco"; } |
1546 | 41 | std::string HostName() const { return "tricky"; } | ||
1547 | 41 | 42 | ||
1548 | 42 | void LockScreen() { std::cout << "LockScreen" << std::endl; } | 43 | void LockScreen() { std::cout << "LockScreen" << std::endl; } |
1549 | 43 | void Logout() { std::cout << "Logout" << std::endl; } | 44 | void Logout() { std::cout << "Logout" << std::endl; } |
1550 | 44 | 45 | ||
1551 | === modified file 'tests/data/external.gschema.xml' | |||
1552 | --- tests/data/external.gschema.xml 2014-03-11 14:11:14 +0000 | |||
1553 | +++ tests/data/external.gschema.xml 2014-03-11 14:11:15 +0000 | |||
1554 | @@ -57,6 +57,9 @@ | |||
1555 | 57 | <key type="s" name="logo"> | 57 | <key type="s" name="logo"> |
1556 | 58 | <default>'/usr/share/unity-greeter/logo.png'</default> | 58 | <default>'/usr/share/unity-greeter/logo.png'</default> |
1557 | 59 | </key> | 59 | </key> |
1558 | 60 | <key type="s" name="font-name"> | ||
1559 | 61 | <default>'Ubuntu 11'</default> | ||
1560 | 62 | </key> | ||
1561 | 60 | <key type="s" name="background"> | 63 | <key type="s" name="background"> |
1562 | 61 | <default>'/usr/share/backgrounds/warty-final-ubuntu.png'</default> | 64 | <default>'/usr/share/backgrounds/warty-final-ubuntu.png'</default> |
1563 | 62 | </key> | 65 | </key> |
1564 | @@ -69,5 +72,8 @@ | |||
1565 | 69 | <key type="b" name="draw-grid"> | 72 | <key type="b" name="draw-grid"> |
1566 | 70 | <default>true</default> | 73 | <default>true</default> |
1567 | 71 | </key> | 74 | </key> |
1568 | 75 | <key type="b" name="show-hostname"> | ||
1569 | 76 | <default>true</default> | ||
1570 | 77 | </key> | ||
1571 | 72 | </schema> | 78 | </schema> |
1572 | 73 | </schemalist> | 79 | </schemalist> |
1573 | 74 | 80 | ||
1574 | === modified file 'tests/test_lockscreen_controller.cpp' | |||
1575 | --- tests/test_lockscreen_controller.cpp 2014-03-11 14:11:14 +0000 | |||
1576 | +++ tests/test_lockscreen_controller.cpp 2014-03-11 14:11:15 +0000 | |||
1577 | @@ -62,11 +62,20 @@ | |||
1578 | 62 | 62 | ||
1579 | 63 | } | 63 | } |
1580 | 64 | 64 | ||
1581 | 65 | struct MockShield : AbstractShield | ||
1582 | 66 | { | ||
1583 | 67 | MockShield() | ||
1584 | 68 | : AbstractShield(nullptr, nullptr, 0, false) | ||
1585 | 69 | {} | ||
1586 | 70 | |||
1587 | 71 | MOCK_CONST_METHOD0(IsIndicatorOpen, bool()); | ||
1588 | 72 | }; | ||
1589 | 73 | |||
1590 | 65 | struct ShieldFactoryMock : ShieldFactoryInterface | 74 | struct ShieldFactoryMock : ShieldFactoryInterface |
1591 | 66 | { | 75 | { |
1593 | 67 | nux::ObjectPtr<AbstractShield> CreateShield(session::Manager::Ptr const&, int, bool) override | 76 | nux::ObjectPtr<AbstractShield> CreateShield(session::Manager::Ptr const&, indicator::Indicators::Ptr const&, int, bool) override |
1594 | 68 | { | 77 | { |
1596 | 69 | return nux::ObjectPtr<AbstractShield>(new AbstractShield(nullptr, 0, false)); | 78 | return nux::ObjectPtr<AbstractShield>(new MockShield()); |
1597 | 70 | } | 79 | } |
1598 | 71 | }; | 80 | }; |
1599 | 72 | 81 | ||
1600 | 73 | 82 | ||
1601 | === modified file 'tests/test_mock_session_manager.h' | |||
1602 | --- tests/test_mock_session_manager.h 2013-03-07 21:26:57 +0000 | |||
1603 | +++ tests/test_mock_session_manager.h 2014-03-11 14:11:15 +0000 | |||
1604 | @@ -31,6 +31,7 @@ | |||
1605 | 31 | 31 | ||
1606 | 32 | MOCK_CONST_METHOD0(RealName, std::string()); | 32 | MOCK_CONST_METHOD0(RealName, std::string()); |
1607 | 33 | MOCK_CONST_METHOD0(UserName, std::string()); | 33 | MOCK_CONST_METHOD0(UserName, std::string()); |
1608 | 34 | MOCK_CONST_METHOD0(HostName, std::string()); | ||
1609 | 34 | 35 | ||
1610 | 35 | MOCK_METHOD0(LockScreen, void()); | 36 | MOCK_METHOD0(LockScreen, void()); |
1611 | 36 | MOCK_METHOD0(Logout, void()); | 37 | MOCK_METHOD0(Logout, void()); |
1612 | 37 | 38 | ||
1613 | === modified file 'unity-shared/WindowManager.h' | |||
1614 | --- unity-shared/WindowManager.h 2014-02-17 21:17:51 +0000 | |||
1615 | +++ unity-shared/WindowManager.h 2014-03-11 14:11:15 +0000 | |||
1616 | @@ -166,6 +166,7 @@ | |||
1617 | 166 | 166 | ||
1618 | 167 | // Nux Modifiers, Nux Keycode (= X11 KeySym) | 167 | // Nux Modifiers, Nux Keycode (= X11 KeySym) |
1619 | 168 | nux::Property<std::pair<unsigned, unsigned>> close_window_key; | 168 | nux::Property<std::pair<unsigned, unsigned>> close_window_key; |
1620 | 169 | nux::Property<std::pair<unsigned, unsigned>> activate_indicators_key; | ||
1621 | 169 | nux::Property<nux::Color> average_color; | 170 | nux::Property<nux::Color> average_color; |
1622 | 170 | 171 | ||
1623 | 171 | // Signals | 172 | // Signals |
FAILED: Continuous integration, rev:3743 jenkins. qa.ubuntu. com/job/ unity-ci/ 767/ jenkins. qa.ubuntu. com/job/ unity-trusty- amd64-ci/ 303/console jenkins. qa.ubuntu. com/job/ unity-trusty- armhf-ci/ 299/console jenkins. qa.ubuntu. com/job/ unity-trusty- i386-ci/ 301/console
http://
Executed test runs:
FAILURE: http://
FAILURE: http://
FAILURE: http://
Click here to trigger a rebuild: s-jenkins. ubuntu- ci:8080/ job/unity- ci/767/ rebuild
http://