Merge lp:~gordallott/unity/lock-out-hud into lp:unity
- lock-out-hud
- Merge into trunk
Status: | Superseded |
---|---|
Proposed branch: | lp:~gordallott/unity/lock-out-hud |
Merge into: | lp:unity |
Diff against target: |
661 lines (+323/-57) 14 files modified
manual-tests/Hud.txt (+13/-0) plugins/unityshell/src/BFBLauncherIcon.cpp (+19/-0) plugins/unityshell/src/BFBLauncherIcon.h (+1/-0) plugins/unityshell/src/HudController.cpp (+33/-11) plugins/unityshell/src/HudController.h (+4/-0) plugins/unityshell/src/HudLauncherIcon.cpp (+115/-0) plugins/unityshell/src/HudLauncherIcon.h (+56/-0) plugins/unityshell/src/HudView.cpp (+27/-6) plugins/unityshell/src/HudView.h (+10/-1) plugins/unityshell/src/Launcher.cpp (+26/-32) plugins/unityshell/src/LauncherController.cpp (+2/-0) plugins/unityshell/src/LauncherHideMachine.cpp (+7/-7) plugins/unityshell/src/UBusMessages.h (+5/-0) plugins/unityshell/src/unityshell.cpp (+5/-0) |
To merge this branch: | bzr merge lp:~gordallott/unity/lock-out-hud |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Marco Trevisan (Treviño) | Needs Fixing | ||
Mirco Müller | Pending | ||
Review via email: mp+97831@code.launchpad.net |
This proposal has been superseded by a proposal from 2012-03-21.
Commit message
Description of the change
Changes the behaviour of the HUD/Launcher interaction in HideMode: Never
= The Problem =
See: https:/
= The Fix =
Modify the Launcher to accept a new LauncherIcon that will listen to a UBUS message dictating its icon
= Testing =
Manual test included, lock-out behaviour is not included in out AP tests so ensuring a valid AP test seems non trivial at this point, requires an AP test module that can modify compiz options
Tim Penhey (thumper) wrote : | # |
Didier Roche-Tolomelli (didrocks) wrote : | # |
we want that for this release isn't it? can someone review it and merge it with the manual test if anyone has the AP test for it?
Marco Trevisan (Treviño) (3v1n0) wrote : | # |
This has some conflicts with trunk, also you're using some lambda functions to connect to sigc::signal's, but in that case you need to disconnect from them in destructor or use a sigc::mem_fun instead (this doesn't apply to the ubus callback functions, of course).
Plus, I'm not sure if that's wanted, but if enabling the launcher's audohide feature, when closing the HUD, the launcher reveals and then closes again.
42 + if (!g_strcmp0(
Why not using overlay_
launcher_
I guess you can just pass [&] and please follow what said above. Even if the hud view shouldn't be destroyed, I guess it's better to stay safe.
Tim Penhey (thumper) wrote : | # |
As well as the launcher popping out when you close the hud, if you do the following:
press Alt
press Super
You get the dash with a hidden launcher.
Also, you get a peaking icon when you start the hud with a hidden launcher.
I'm fixing these now. I have a branch that fixes everything so far except making sure the icon saturation is right at the right time.
Tim Penhey (thumper) wrote : | # |
Also worth noting I guess, this branch doesn't fix the bug around the icon size for the hud when you don't have a fixed launcher.
Preview Diff
1 | === modified file 'manual-tests/Hud.txt' |
2 | --- manual-tests/Hud.txt 2012-02-12 18:23:18 +0000 |
3 | +++ manual-tests/Hud.txt 2012-03-16 10:27:23 +0000 |
4 | @@ -56,3 +56,16 @@ |
5 | After pressing escape in step three, the text "test" should be removed from the hud search |
6 | After step four, the hud should dismiss itself and not be present. |
7 | |
8 | + |
9 | +Hud Reveal Behaviour |
10 | +--------- |
11 | +This test ensures that the hud behaves correctly with a locked out launcher |
12 | + |
13 | +#. Ensure the launchers hide mode is set to "Never" |
14 | +#. Tap Alt |
15 | + |
16 | +Outcome |
17 | + The Launcher should stick be locked out. |
18 | + The Launcher icons should be desaturated. |
19 | + The top most Launcher icon should be an icon related the the focused window |
20 | + The BFB should not be present |
21 | |
22 | === modified file 'plugins/unityshell/src/BFBLauncherIcon.cpp' |
23 | --- plugins/unityshell/src/BFBLauncherIcon.cpp 2012-02-22 08:53:20 +0000 |
24 | +++ plugins/unityshell/src/BFBLauncherIcon.cpp 2012-03-16 10:27:23 +0000 |
25 | @@ -45,6 +45,25 @@ |
26 | background_color_ = nux::color::White; |
27 | |
28 | mouse_enter.connect([&](int m) { ubus_manager_.SendMessage(UBUS_DASH_ABOUT_TO_SHOW, NULL); }); |
29 | + ubus_manager_.RegisterInterest(UBUS_OVERLAY_SHOWN, sigc::bind(sigc::mem_fun(this, &BFBLauncherIcon::OnOverlayShown), true)); |
30 | + ubus_manager_.RegisterInterest(UBUS_OVERLAY_HIDDEN, sigc::bind(sigc::mem_fun(this, &BFBLauncherIcon::OnOverlayShown), false)); |
31 | +} |
32 | + |
33 | +void BFBLauncherIcon::OnOverlayShown(GVariant *data, bool visible) |
34 | +{ |
35 | + unity::glib::String overlay_identity; |
36 | + gboolean can_maximise = FALSE; |
37 | + gint32 overlay_monitor = 0; |
38 | + g_variant_get(data, UBUS_OVERLAY_FORMAT_STRING, |
39 | + &overlay_identity, &can_maximise, &overlay_monitor); |
40 | + |
41 | + |
42 | + if (!g_strcmp0(overlay_identity, "hud")) |
43 | + { |
44 | + // if the hud is open, we hide the BFB |
45 | + SetQuirk(QUIRK_VISIBLE, !visible); |
46 | + EmitNeedsRedraw(); |
47 | + } |
48 | } |
49 | |
50 | nux::Color BFBLauncherIcon::BackgroundColor() |
51 | |
52 | === modified file 'plugins/unityshell/src/BFBLauncherIcon.h' |
53 | --- plugins/unityshell/src/BFBLauncherIcon.h 2012-02-22 08:53:20 +0000 |
54 | +++ plugins/unityshell/src/BFBLauncherIcon.h 2012-03-16 10:27:23 +0000 |
55 | @@ -47,6 +47,7 @@ |
56 | std::string GetName() const; |
57 | |
58 | private: |
59 | + void OnOverlayShown(GVariant *data, bool visible); |
60 | static void OnMenuitemActivated(DbusmenuMenuitem* item, int time, gchar* lens); |
61 | |
62 | static unity::UBusManager ubus_manager_; |
63 | |
64 | === modified file 'plugins/unityshell/src/HudController.cpp' |
65 | --- plugins/unityshell/src/HudController.cpp 2012-03-09 15:38:35 +0000 |
66 | +++ plugins/unityshell/src/HudController.cpp 2012-03-16 10:27:23 +0000 |
67 | @@ -39,7 +39,7 @@ |
68 | } |
69 | |
70 | Controller::Controller() |
71 | - : launcher_width(66) |
72 | + : launcher_width(65) |
73 | , hud_service_("com.canonical.hud", "/com/canonical/hud") |
74 | , window_(nullptr) |
75 | , visible_(false) |
76 | @@ -47,6 +47,7 @@ |
77 | , timeline_id_(0) |
78 | , last_opacity_(0.0f) |
79 | , start_time_(0) |
80 | + , launcher_is_locked_out_(false) |
81 | , view_(nullptr) |
82 | { |
83 | LOG_DEBUG(logger) << "hud startup"; |
84 | @@ -69,6 +70,8 @@ |
85 | } |
86 | }); |
87 | |
88 | + launcher_width.changed.connect([this] (int new_width) { Relayout(); }); |
89 | + |
90 | PluginAdapter::Default()->compiz_screen_ungrabbed.connect(sigc::mem_fun(this, &Controller::OnScreenUngrabbed)); |
91 | |
92 | hud_service_.queries_updated.connect(sigc::mem_fun(this, &Controller::OnQueriesFinished)); |
93 | @@ -154,17 +157,23 @@ |
94 | |
95 | nux::Geometry Controller::GetIdealWindowGeometry() |
96 | { |
97 | - UScreen *uscreen = UScreen::GetDefault(); |
98 | - int primary_monitor = uscreen->GetMonitorWithMouse(); |
99 | - auto monitor_geo = uscreen->GetMonitorGeometry(primary_monitor); |
100 | + UScreen *uscreen = UScreen::GetDefault(); |
101 | + int primary_monitor = uscreen->GetMonitorWithMouse(); |
102 | + auto monitor_geo = uscreen->GetMonitorGeometry(primary_monitor); |
103 | |
104 | - // We want to cover as much of the screen as possible to grab any mouse events outside |
105 | - // of our window |
106 | - panel::Style &panel_style = panel::Style::Instance(); |
107 | - return nux::Geometry (monitor_geo.x, |
108 | - monitor_geo.y + panel_style.panel_height, |
109 | - monitor_geo.width, |
110 | - monitor_geo.height - panel_style.panel_height); |
111 | + // We want to cover as much of the screen as possible to grab any mouse events outside |
112 | + // of our window |
113 | + panel::Style &panel_style = panel::Style::Instance(); |
114 | + nux::Geometry geo(monitor_geo.x, |
115 | + monitor_geo.y + panel_style.panel_height, |
116 | + monitor_geo.width, |
117 | + monitor_geo.height - panel_style.panel_height); |
118 | + if (launcher_is_locked_out_) |
119 | + { |
120 | + geo.x += launcher_width; |
121 | + geo.width -= launcher_width; |
122 | + } |
123 | + return geo; |
124 | } |
125 | |
126 | void Controller::Relayout(GdkScreen*screen) |
127 | @@ -224,6 +233,16 @@ |
128 | return visible_; |
129 | } |
130 | |
131 | +void Controller::SetLauncherIsLockedOut(bool launcher_is_locked_out) |
132 | +{ |
133 | + launcher_is_locked_out_ = launcher_is_locked_out; |
134 | + if (launcher_is_locked_out_) |
135 | + view_->SetHideIcon(IconHideState::HIDE); |
136 | + else |
137 | + view_->SetHideIcon(IconHideState::SHOW); |
138 | + Relayout(); |
139 | +} |
140 | + |
141 | void Controller::ShowHud() |
142 | { |
143 | PluginAdapter* adaptor = PluginAdapter::Default(); |
144 | @@ -248,6 +267,7 @@ |
145 | focused_app_icon_ = view_icon.Str(); |
146 | |
147 | LOG_DEBUG(logger) << "Taking application icon: " << focused_app_icon_; |
148 | + ubus.SendMessage(UBUS_HUD_ICON_CHANGED, g_variant_new_string(focused_app_icon_.c_str())); |
149 | view_->SetIcon(focused_app_icon_); |
150 | |
151 | window_->ShowWindow(true); |
152 | @@ -398,6 +418,7 @@ |
153 | { |
154 | LOG_DEBUG(logger) << "Selected query, " << query->formatted_text; |
155 | view_->SetIcon(query->icon_name); |
156 | + ubus.SendMessage(UBUS_HUD_ICON_CHANGED, g_variant_new_string(query->icon_name.c_str())); |
157 | } |
158 | |
159 | |
160 | @@ -416,6 +437,7 @@ |
161 | |
162 | LOG_DEBUG(logger) << "setting icon to - " << icon_name; |
163 | view_->SetIcon(icon_name); |
164 | + ubus.SendMessage(UBUS_HUD_ICON_CHANGED, g_variant_new_string(icon_name.c_str())); |
165 | } |
166 | |
167 | // Introspectable |
168 | |
169 | === modified file 'plugins/unityshell/src/HudController.h' |
170 | --- plugins/unityshell/src/HudController.h 2012-02-12 14:47:39 +0000 |
171 | +++ plugins/unityshell/src/HudController.h 2012-03-16 10:27:23 +0000 |
172 | @@ -54,6 +54,8 @@ |
173 | void ShowHud(); |
174 | void HideHud(bool restore_focus = true); |
175 | bool IsVisible(); |
176 | + void SetLauncherIsLockedOut(bool launcher_is_locked_out); |
177 | + |
178 | protected: |
179 | std::string GetName() const; |
180 | void AddProperties(GVariantBuilder* builder); |
181 | @@ -99,6 +101,8 @@ |
182 | guint timeline_id_; |
183 | float last_opacity_; |
184 | gint64 start_time_; |
185 | + |
186 | + bool launcher_is_locked_out_; |
187 | |
188 | View* view_; |
189 | guint ensure_id_; |
190 | |
191 | === added file 'plugins/unityshell/src/HudLauncherIcon.cpp' |
192 | --- plugins/unityshell/src/HudLauncherIcon.cpp 1970-01-01 00:00:00 +0000 |
193 | +++ plugins/unityshell/src/HudLauncherIcon.cpp 2012-03-16 10:27:23 +0000 |
194 | @@ -0,0 +1,115 @@ |
195 | +// -*- Mode: C++; indent-tabs-mode: nil; tab-width: 2 -*- |
196 | +/* |
197 | + * Copyright (C) 2011 Canonical Ltd |
198 | + * |
199 | + * This program is free software: you can redistribute it and/or modify |
200 | + * it under the terms of the GNU General Public License version 3 as |
201 | + * published by the Free Software Foundation. |
202 | + * |
203 | + * This program is distributed in the hope that it will be useful, |
204 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
205 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
206 | + * GNU General Public License for more details. |
207 | + * |
208 | + * You should have received a copy of the GNU General Public License |
209 | + * along with this program. If not, see <http://www.gnu.org/licenses/>. |
210 | + * |
211 | + * Authored by: Gordon Allott <gord.allott@canonical.com> |
212 | + */ |
213 | + |
214 | +#include "HudLauncherIcon.h" |
215 | +#include "Launcher.h" |
216 | +#include "UnityCore/GLibWrapper.h" |
217 | +#include <NuxCore/Logger.h> |
218 | + |
219 | +#include "UBusMessages.h" |
220 | + |
221 | +#include <glib/gi18n-lib.h> |
222 | + |
223 | +namespace unity |
224 | +{ |
225 | +namespace launcher |
226 | +{ |
227 | + |
228 | +namespace |
229 | +{ |
230 | +nux::logging::Logger logger("unity.launcher.hudlaunchericon"); |
231 | +} |
232 | + |
233 | +UBusManager HudLauncherIcon::ubus_manager_; |
234 | + |
235 | +HudLauncherIcon::HudLauncherIcon() |
236 | + : SimpleLauncherIcon() |
237 | +{ |
238 | + tooltip_text = _("HUD"); |
239 | + icon_name = PKGDATADIR"/launcher_bfb.png"; |
240 | + SetQuirk(QUIRK_VISIBLE, false); |
241 | + SetQuirk(QUIRK_RUNNING, false); |
242 | + SetQuirk(QUIRK_ACTIVE, true); |
243 | + SetIconType(TYPE_HOME); |
244 | + |
245 | + background_color_ = nux::color::White; |
246 | + |
247 | + ubus_manager_.RegisterInterest(UBUS_HUD_ICON_CHANGED, [&](GVariant *data) |
248 | + { |
249 | + LOG_DEBUG(logger) << "Hud icon change: " << g_variant_get_string(data, NULL); |
250 | + glib::String hud_icon_name(g_strdup(g_variant_get_string(data, NULL))); |
251 | + if (!hud_icon_name.Str().empty() |
252 | + && hud_icon_name.Str() != icon_name()) |
253 | + { |
254 | + icon_name = hud_icon_name.Str(); |
255 | + EmitNeedsRedraw(); |
256 | + } |
257 | + }); |
258 | + |
259 | + ubus_manager_.RegisterInterest(UBUS_OVERLAY_SHOWN, sigc::bind(sigc::mem_fun(this, &HudLauncherIcon::OnOverlayShown), true)); |
260 | + ubus_manager_.RegisterInterest(UBUS_OVERLAY_HIDDEN, sigc::bind(sigc::mem_fun(this, &HudLauncherIcon::OnOverlayShown), false)); |
261 | + |
262 | + mouse_enter.connect([&](int m) { ubus_manager_.SendMessage(UBUS_DASH_ABOUT_TO_SHOW, NULL); }); |
263 | +} |
264 | + |
265 | +void HudLauncherIcon::OnOverlayShown(GVariant *data, bool visible) |
266 | +{ |
267 | + unity::glib::String overlay_identity; |
268 | + gboolean can_maximise = FALSE; |
269 | + gint32 overlay_monitor = 0; |
270 | + g_variant_get(data, UBUS_OVERLAY_FORMAT_STRING, |
271 | + &overlay_identity, &can_maximise, &overlay_monitor); |
272 | + |
273 | + |
274 | + if (!g_strcmp0(overlay_identity, "hud")) |
275 | + { |
276 | + SetQuirk(QUIRK_VISIBLE, visible); |
277 | + EmitNeedsRedraw(); |
278 | + } |
279 | +} |
280 | + |
281 | +nux::Color HudLauncherIcon::BackgroundColor() |
282 | +{ |
283 | + return background_color_; |
284 | +} |
285 | + |
286 | +nux::Color HudLauncherIcon::GlowColor() |
287 | +{ |
288 | + return background_color_; |
289 | +} |
290 | + |
291 | +void HudLauncherIcon::ActivateLauncherIcon(ActionArg arg) |
292 | +{ |
293 | + // wut? activate? noo we don't do that. |
294 | +} |
295 | + |
296 | +std::list<DbusmenuMenuitem*> HudLauncherIcon::GetMenus() |
297 | +{ |
298 | + std::list<DbusmenuMenuitem*> result; |
299 | + return result; |
300 | +} |
301 | + |
302 | +std::string HudLauncherIcon::GetName() const |
303 | +{ |
304 | + return "HudLauncherIcon"; |
305 | +} |
306 | + |
307 | +} // namespace launcher |
308 | +} // namespace unity |
309 | + |
310 | |
311 | === added file 'plugins/unityshell/src/HudLauncherIcon.h' |
312 | --- plugins/unityshell/src/HudLauncherIcon.h 1970-01-01 00:00:00 +0000 |
313 | +++ plugins/unityshell/src/HudLauncherIcon.h 2012-03-16 10:27:23 +0000 |
314 | @@ -0,0 +1,56 @@ |
315 | +// -*- Mode: C++; indent-tabs-mode: nil; tab-width: 2 -*- |
316 | +/* |
317 | + * Copyright (C) 2011 Canonical Ltd |
318 | + * |
319 | + * This program is free software: you can redistribute it and/or modify |
320 | + * it under the terms of the GNU General Public License version 3 as |
321 | + * published by the Free Software Foundation. |
322 | + * |
323 | + * This program is distributed in the hope that it will be useful, |
324 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
325 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
326 | + * GNU General Public License for more details. |
327 | + * |
328 | + * You should have received a copy of the GNU General Public License |
329 | + * along with this program. If not, see <http://www.gnu.org/licenses/>. |
330 | + * |
331 | + * Authored by: Gordon Allott <gord.allott@gmail.com> |
332 | + */ |
333 | + |
334 | +#ifndef UNITYSHELL_HUDLAUNCHERICON_H |
335 | +#define UNITYSHELL_HUDLAUNCHERICON_H |
336 | + |
337 | +#include "SimpleLauncherIcon.h" |
338 | +#include "UBusWrapper.h" |
339 | + |
340 | +namespace unity |
341 | +{ |
342 | +namespace launcher |
343 | +{ |
344 | + |
345 | +class HudLauncherIcon : public SimpleLauncherIcon |
346 | +{ |
347 | + |
348 | +public: |
349 | + HudLauncherIcon(); |
350 | + |
351 | + virtual nux::Color BackgroundColor(); |
352 | + virtual nux::Color GlowColor(); |
353 | + |
354 | + void ActivateLauncherIcon(ActionArg arg); |
355 | + |
356 | +protected: |
357 | + std::list<DbusmenuMenuitem*> GetMenus(); |
358 | + std::string GetName() const; |
359 | + |
360 | +private: |
361 | + void OnOverlayShown(GVariant *data, bool visible); |
362 | + |
363 | + static unity::UBusManager ubus_manager_; |
364 | + nux::Color background_color_; |
365 | +}; |
366 | + |
367 | +} |
368 | +} |
369 | + |
370 | +#endif // UNITYSHELL_HUDLAUNCHERICON_H |
371 | |
372 | === modified file 'plugins/unityshell/src/HudView.cpp' |
373 | --- plugins/unityshell/src/HudView.cpp 2012-03-02 02:00:18 +0000 |
374 | +++ plugins/unityshell/src/HudView.cpp 2012-03-16 10:27:23 +0000 |
375 | @@ -64,6 +64,7 @@ |
376 | , current_height_(0) |
377 | , timeline_need_more_draw_(false) |
378 | , selected_button_(0) |
379 | + , icon_state_(IconHideState::SHOW) |
380 | { |
381 | renderer_.SetOwner(this); |
382 | renderer_.need_redraw.connect([this] () { |
383 | @@ -185,7 +186,6 @@ |
384 | layout_->SetMinimumWidth(content_geo_.width); |
385 | layout_->SetMaximumWidth(content_geo_.width); |
386 | layout_->SetMaximumHeight(content_geo_.height); |
387 | - //layout_->SetMinMaxSize(content_geo_.width, content_geo_.height); |
388 | |
389 | QueueDraw(); |
390 | } |
391 | @@ -274,6 +274,22 @@ |
392 | QueueDraw(); |
393 | } |
394 | |
395 | +void View::SetHideIcon(IconHideState hide_icon) |
396 | +{ |
397 | + LOG_DEBUG(logger) << "Hide icon called"; |
398 | + if (hide_icon == icon_state_) |
399 | + return; |
400 | + |
401 | + icon_state_ = hide_icon; |
402 | + |
403 | + if (icon_state_ == IconHideState::HIDE) |
404 | + layout_->RemoveChildObject(dynamic_cast<nux::Area*>(icon_layout_.GetPointer())); |
405 | + else |
406 | + layout_->AddLayout(icon_layout_.GetPointer(), 0, nux::MINOR_POSITION_TOP, nux::MINOR_SIZE_MATCHCONTENT, 100.0f, nux::LayoutPosition::NUX_LAYOUT_BEGIN); |
407 | + |
408 | + Relayout(); |
409 | +} |
410 | + |
411 | // Gives us the width and height of the contents that will give us the best "fit", |
412 | // which means that the icons/views will not have uneccessary padding, everything will |
413 | // look tight |
414 | @@ -284,7 +300,12 @@ |
415 | int width, height = 0; |
416 | width = 1024; |
417 | height = 276; |
418 | - |
419 | + |
420 | + if (icon_state_ == IconHideState::HIDE) |
421 | + { |
422 | + width -= icon_layout_->GetGeometry().width; |
423 | + } |
424 | + |
425 | LOG_DEBUG (logger) << "best fit is, " << width << ", " << height; |
426 | |
427 | return nux::Geometry(0, 0, width, height); |
428 | @@ -324,11 +345,11 @@ |
429 | { |
430 | // fill icon layout with icon |
431 | icon_ = new Icon("", icon_size, true); |
432 | - nux::Layout* icon_layout = new nux::VLayout(); |
433 | + icon_layout_ = new nux::VLayout(); |
434 | { |
435 | - icon_layout->SetVerticalExternalMargin(icon_vertical_margin); |
436 | - icon_layout->AddView(icon_.GetPointer(), 0, nux::MINOR_POSITION_LEFT, nux::MINOR_SIZE_FULL); |
437 | - layout_->AddLayout(icon_layout, 0, nux::MINOR_POSITION_TOP, nux::MINOR_SIZE_MATCHCONTENT); |
438 | + icon_layout_->SetVerticalExternalMargin(icon_vertical_margin); |
439 | + icon_layout_->AddView(icon_.GetPointer(), 0, nux::MINOR_POSITION_LEFT, nux::MINOR_SIZE_FULL); |
440 | + layout_->AddLayout(icon_layout_.GetPointer(), 0, nux::MINOR_POSITION_TOP, nux::MINOR_SIZE_MATCHCONTENT); |
441 | } |
442 | |
443 | // add padding to layout between icon and content |
444 | |
445 | === modified file 'plugins/unityshell/src/HudView.h' |
446 | --- plugins/unityshell/src/HudView.h 2012-03-02 02:00:18 +0000 |
447 | +++ plugins/unityshell/src/HudView.h 2012-03-16 10:27:23 +0000 |
448 | @@ -44,6 +44,12 @@ |
449 | namespace hud |
450 | { |
451 | |
452 | +enum IconHideState |
453 | +{ |
454 | + HIDE, |
455 | + SHOW |
456 | +}; |
457 | + |
458 | class View : public nux::View, public unity::debug::Introspectable |
459 | { |
460 | NUX_DECLARE_OBJECT_TYPE(HudView, nux::View); |
461 | @@ -59,7 +65,8 @@ |
462 | |
463 | void SetQueries(Hud::Queries queries); |
464 | void SetIcon(std::string icon_name); |
465 | - |
466 | + void SetHideIcon(IconHideState hide_icon); |
467 | + |
468 | void AboutToShow(); |
469 | void AboutToHide(); |
470 | |
471 | @@ -104,6 +111,7 @@ |
472 | //FIXME - replace with dash search bar once modifications to dash search bar land |
473 | SearchBar::Ptr search_bar_; |
474 | Icon::Ptr icon_; |
475 | + nux::ObjectPtr<nux::Layout> icon_layout_; |
476 | bool visible_; |
477 | |
478 | Hud::Queries queries_; |
479 | @@ -118,6 +126,7 @@ |
480 | int current_height_; |
481 | bool timeline_need_more_draw_; |
482 | int selected_button_; |
483 | + IconHideState icon_state_; |
484 | }; |
485 | |
486 | |
487 | |
488 | === modified file 'plugins/unityshell/src/Launcher.cpp' |
489 | --- plugins/unityshell/src/Launcher.cpp 2012-03-13 17:20:30 +0000 |
490 | +++ plugins/unityshell/src/Launcher.cpp 2012-03-16 10:27:23 +0000 |
491 | @@ -1320,19 +1320,16 @@ |
492 | &overlay_identity, &can_maximise, &overlay_monitor); |
493 | |
494 | |
495 | - if (!g_strcmp0(overlay_identity, "dash")) |
496 | + if (overlay_monitor == monitor) |
497 | { |
498 | - if (overlay_monitor == monitor) |
499 | - { |
500 | - LauncherModel::iterator it; |
501 | - |
502 | - _dash_is_open = true; |
503 | - bg_effect_helper_.enabled = true; |
504 | - _hide_machine->SetQuirk(LauncherHideMachine::PLACES_VISIBLE, true); |
505 | - _hover_machine->SetQuirk(LauncherHoverMachine::PLACES_VISIBLE, true); |
506 | - |
507 | - DesaturateIcons(); |
508 | - } |
509 | + LauncherModel::iterator it; |
510 | + |
511 | + _dash_is_open = true; |
512 | + bg_effect_helper_.enabled = true; |
513 | + _hide_machine->SetQuirk(LauncherHideMachine::PLACES_VISIBLE, true); |
514 | + _hover_machine->SetQuirk(LauncherHoverMachine::PLACES_VISIBLE, true); |
515 | + |
516 | + DesaturateIcons(); |
517 | } |
518 | } |
519 | |
520 | @@ -1345,26 +1342,23 @@ |
521 | g_variant_get(data, UBUS_OVERLAY_FORMAT_STRING, |
522 | &overlay_identity, &can_maximise, &overlay_monitor); |
523 | |
524 | - if (!g_strcmp0(overlay_identity, "dash")) |
525 | - { |
526 | - if (!_dash_is_open) |
527 | - return; |
528 | - |
529 | - LauncherModel::iterator it; |
530 | - |
531 | - _dash_is_open = false; |
532 | - bg_effect_helper_.enabled = false; |
533 | - _hide_machine->SetQuirk(LauncherHideMachine::PLACES_VISIBLE, false); |
534 | - _hover_machine->SetQuirk(LauncherHoverMachine::PLACES_VISIBLE, false); |
535 | - |
536 | - // as the leave event is no more received when the place is opened |
537 | - // FIXME: remove when we change the mouse grab strategy in nux |
538 | - nux::Point pt = nux::GetWindowCompositor().GetMousePosition(); |
539 | - |
540 | - SetStateMouseOverLauncher(GetAbsoluteGeometry().IsInside(pt)); |
541 | - |
542 | - SaturateIcons(); |
543 | - } |
544 | + if (!_dash_is_open) |
545 | + return; |
546 | + |
547 | + LauncherModel::iterator it; |
548 | + |
549 | + _dash_is_open = false; |
550 | + bg_effect_helper_.enabled = false; |
551 | + _hide_machine->SetQuirk(LauncherHideMachine::PLACES_VISIBLE, false); |
552 | + _hover_machine->SetQuirk(LauncherHoverMachine::PLACES_VISIBLE, false); |
553 | + |
554 | + // as the leave event is no more received when the place is opened |
555 | + // FIXME: remove when we change the mouse grab strategy in nux |
556 | + nux::Point pt = nux::GetWindowCompositor().GetMousePosition(); |
557 | + |
558 | + SetStateMouseOverLauncher(GetAbsoluteGeometry().IsInside(pt)); |
559 | + |
560 | + SaturateIcons(); |
561 | } |
562 | |
563 | void Launcher::OnActionDone(GVariant* data) |
564 | |
565 | === modified file 'plugins/unityshell/src/LauncherController.cpp' |
566 | --- plugins/unityshell/src/LauncherController.cpp 2012-03-14 23:22:02 +0000 |
567 | +++ plugins/unityshell/src/LauncherController.cpp 2012-03-16 10:27:23 +0000 |
568 | @@ -32,6 +32,7 @@ |
569 | #include "DeviceLauncherIcon.h" |
570 | #include "DeviceLauncherSection.h" |
571 | #include "FavoriteStore.h" |
572 | +#include "HudLauncherIcon.h" |
573 | #include "Launcher.h" |
574 | #include "LauncherController.h" |
575 | #include "LauncherEntryRemote.h" |
576 | @@ -233,6 +234,7 @@ |
577 | FavoriteStore::GetDefault().reordered.connect(sigc::mem_fun(this, &Impl::OnFavoriteStoreReordered)); |
578 | |
579 | RegisterIcon(AbstractLauncherIcon::Ptr(new BFBLauncherIcon())); |
580 | + RegisterIcon(AbstractLauncherIcon::Ptr(new HudLauncherIcon())); |
581 | desktop_icon_ = AbstractLauncherIcon::Ptr(new DesktopLauncherIcon()); |
582 | |
583 | uscreen->changed.connect(sigc::mem_fun(this, &Controller::Impl::OnScreenChanged)); |
584 | |
585 | === modified file 'plugins/unityshell/src/LauncherHideMachine.cpp' |
586 | --- plugins/unityshell/src/LauncherHideMachine.cpp 2012-02-08 16:43:47 +0000 |
587 | +++ plugins/unityshell/src/LauncherHideMachine.cpp 2012-03-16 10:27:23 +0000 |
588 | @@ -134,19 +134,19 @@ |
589 | { |
590 | bool should_hide; |
591 | |
592 | - // early check to see if we are locking to hidden |
593 | + if (_mode == HIDE_NEVER) |
594 | + { |
595 | + SetShouldHide(false, skip_delay); |
596 | + return; |
597 | + } |
598 | + |
599 | + // early check to see if we are locking to hidden - but only if we are in non HIDE_NEVER |
600 | if (GetQuirk(LOCK_HIDE)) |
601 | { |
602 | SetShouldHide(true, true); |
603 | return; |
604 | } |
605 | |
606 | - if (_mode == HIDE_NEVER) |
607 | - { |
608 | - SetShouldHide(false, skip_delay); |
609 | - return; |
610 | - } |
611 | - |
612 | do |
613 | { |
614 | // first we check the condition where external DND is active and the push off has happened |
615 | |
616 | === modified file 'plugins/unityshell/src/UBusMessages.h' |
617 | --- plugins/unityshell/src/UBusMessages.h 2012-02-07 07:42:12 +0000 |
618 | +++ plugins/unityshell/src/UBusMessages.h 2012-03-16 10:27:23 +0000 |
619 | @@ -64,6 +64,9 @@ |
620 | // Signal to force the launcher into locked mode, (b) |
621 | #define UBUS_LAUNCHER_LOCK_HIDE "LAUNCHER_LOCK_HIDE" |
622 | |
623 | +// Signal to emit changes to the launcher hide mode behaviour (b), true = locked out, false = unlocked |
624 | +#define UBUS_LAUNCHER_HIDE_MODE_CHANGE "LAUNCHER_HIDE_MODE_CHANGE" |
625 | + |
626 | // Signal sent when a quicklist is shown. |
627 | #define UBUS_QUICKLIST_SHOWN "QUICKLIST_SHOWN" |
628 | |
629 | @@ -78,6 +81,8 @@ |
630 | // FIXME - fix the nux focus api so we don't need this |
631 | #define UBUS_RESULT_VIEW_KEYNAV_CHANGED "RESULT_VIEW_KEYNAV_CHANGED" |
632 | |
633 | +// Sends a string datatype containing the new icon name |
634 | +#define UBUS_HUD_ICON_CHANGED "HUD_ICON_CHANGED" |
635 | #define UBUS_HUD_CLOSE_REQUEST "HUD_CLOSE_REQUEST" |
636 | |
637 | // Signals sent when the switcher is shown, hidden or changes selection |
638 | |
639 | === modified file 'plugins/unityshell/src/unityshell.cpp' |
640 | --- plugins/unityshell/src/unityshell.cpp 2012-03-14 13:05:59 +0000 |
641 | +++ plugins/unityshell/src/unityshell.cpp 2012-03-16 10:27:23 +0000 |
642 | @@ -2505,8 +2505,11 @@ |
643 | break; |
644 | } |
645 | case UnityshellOptions::LauncherHideMode: |
646 | + { |
647 | launcher_options->hide_mode = (unity::launcher::LauncherHideMode) optionGetLauncherHideMode(); |
648 | + hud_controller_->SetLauncherIsLockedOut(launcher_options->hide_mode == unity::launcher::LauncherHideMode::LAUNCHER_HIDE_NEVER); |
649 | break; |
650 | + } |
651 | case UnityshellOptions::BacklightMode: |
652 | launcher_options->backlight_mode = (unity::launcher::BacklightMode) optionGetBacklightMode(); |
653 | break; |
654 | @@ -2738,6 +2741,8 @@ |
655 | |
656 | /* Setup Hud */ |
657 | hud_controller_.reset(new hud::Controller()); |
658 | + auto hide_mode = (unity::launcher::LauncherHideMode) optionGetLauncherHideMode(); |
659 | + hud_controller_->SetLauncherIsLockedOut(hide_mode == unity::launcher::LauncherHideMode::LAUNCHER_HIDE_NEVER); |
660 | AddChild(hud_controller_.get()); |
661 | LOG_INFO(logger) << "initLauncher-hud " << timer.ElapsedSeconds() << "s"; |
662 |
Actually adding an autopilot test for this is trivial.
What we can do is to run the HUD AP tests with the launcher in each state, locked out and auto-hide. We already do something like this for launchers for each monitor. I'll tackle the HUD tests with thomi tomorrow.