Merge lp:~gordallott/unity/lock-out-hud into lp:unity

Proposed by Gord Allott
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
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.

Description of the change

Changes the behaviour of the HUD/Launcher interaction in HideMode: Never

= The Problem =
See: https://bugs.launchpad.net/ayatana-design/+bug/921506

= 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

To post a comment you must log in.
Revision history for this message
Tim Penhey (thumper) wrote :

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.

Revision history for this message
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?

Revision history for this message
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(overlay_identity, "hud"))

Why not using overlay_identity.Str() == "hud" ?

 launcher_width.changed.connect([this] (int new_width) { Relayout(); });

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.

review: Needs Fixing
Revision history for this message
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.

Revision history for this message
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

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'manual-tests/Hud.txt'
--- manual-tests/Hud.txt 2012-02-12 18:23:18 +0000
+++ manual-tests/Hud.txt 2012-03-16 10:27:23 +0000
@@ -56,3 +56,16 @@
56 After pressing escape in step three, the text "test" should be removed from the hud search56 After pressing escape in step three, the text "test" should be removed from the hud search
57 After step four, the hud should dismiss itself and not be present.57 After step four, the hud should dismiss itself and not be present.
5858
59
60Hud Reveal Behaviour
61---------
62This test ensures that the hud behaves correctly with a locked out launcher
63
64#. Ensure the launchers hide mode is set to "Never"
65#. Tap Alt
66
67Outcome
68 The Launcher should stick be locked out.
69 The Launcher icons should be desaturated.
70 The top most Launcher icon should be an icon related the the focused window
71 The BFB should not be present
5972
=== modified file 'plugins/unityshell/src/BFBLauncherIcon.cpp'
--- plugins/unityshell/src/BFBLauncherIcon.cpp 2012-02-22 08:53:20 +0000
+++ plugins/unityshell/src/BFBLauncherIcon.cpp 2012-03-16 10:27:23 +0000
@@ -45,6 +45,25 @@
45 background_color_ = nux::color::White;45 background_color_ = nux::color::White;
4646
47 mouse_enter.connect([&](int m) { ubus_manager_.SendMessage(UBUS_DASH_ABOUT_TO_SHOW, NULL); });47 mouse_enter.connect([&](int m) { ubus_manager_.SendMessage(UBUS_DASH_ABOUT_TO_SHOW, NULL); });
48 ubus_manager_.RegisterInterest(UBUS_OVERLAY_SHOWN, sigc::bind(sigc::mem_fun(this, &BFBLauncherIcon::OnOverlayShown), true));
49 ubus_manager_.RegisterInterest(UBUS_OVERLAY_HIDDEN, sigc::bind(sigc::mem_fun(this, &BFBLauncherIcon::OnOverlayShown), false));
50}
51
52void BFBLauncherIcon::OnOverlayShown(GVariant *data, bool visible)
53{
54 unity::glib::String overlay_identity;
55 gboolean can_maximise = FALSE;
56 gint32 overlay_monitor = 0;
57 g_variant_get(data, UBUS_OVERLAY_FORMAT_STRING,
58 &overlay_identity, &can_maximise, &overlay_monitor);
59
60
61 if (!g_strcmp0(overlay_identity, "hud"))
62 {
63 // if the hud is open, we hide the BFB
64 SetQuirk(QUIRK_VISIBLE, !visible);
65 EmitNeedsRedraw();
66 }
48}67}
4968
50nux::Color BFBLauncherIcon::BackgroundColor()69nux::Color BFBLauncherIcon::BackgroundColor()
5170
=== modified file 'plugins/unityshell/src/BFBLauncherIcon.h'
--- plugins/unityshell/src/BFBLauncherIcon.h 2012-02-22 08:53:20 +0000
+++ plugins/unityshell/src/BFBLauncherIcon.h 2012-03-16 10:27:23 +0000
@@ -47,6 +47,7 @@
47 std::string GetName() const;47 std::string GetName() const;
4848
49private:49private:
50 void OnOverlayShown(GVariant *data, bool visible);
50 static void OnMenuitemActivated(DbusmenuMenuitem* item, int time, gchar* lens);51 static void OnMenuitemActivated(DbusmenuMenuitem* item, int time, gchar* lens);
5152
52 static unity::UBusManager ubus_manager_;53 static unity::UBusManager ubus_manager_;
5354
=== modified file 'plugins/unityshell/src/HudController.cpp'
--- plugins/unityshell/src/HudController.cpp 2012-03-09 15:38:35 +0000
+++ plugins/unityshell/src/HudController.cpp 2012-03-16 10:27:23 +0000
@@ -39,7 +39,7 @@
39}39}
4040
41Controller::Controller()41Controller::Controller()
42 : launcher_width(66)42 : launcher_width(65)
43 , hud_service_("com.canonical.hud", "/com/canonical/hud")43 , hud_service_("com.canonical.hud", "/com/canonical/hud")
44 , window_(nullptr)44 , window_(nullptr)
45 , visible_(false)45 , visible_(false)
@@ -47,6 +47,7 @@
47 , timeline_id_(0)47 , timeline_id_(0)
48 , last_opacity_(0.0f)48 , last_opacity_(0.0f)
49 , start_time_(0)49 , start_time_(0)
50 , launcher_is_locked_out_(false)
50 , view_(nullptr)51 , view_(nullptr)
51{52{
52 LOG_DEBUG(logger) << "hud startup";53 LOG_DEBUG(logger) << "hud startup";
@@ -69,6 +70,8 @@
69 }70 }
70 });71 });
7172
73 launcher_width.changed.connect([this] (int new_width) { Relayout(); });
74
72 PluginAdapter::Default()->compiz_screen_ungrabbed.connect(sigc::mem_fun(this, &Controller::OnScreenUngrabbed));75 PluginAdapter::Default()->compiz_screen_ungrabbed.connect(sigc::mem_fun(this, &Controller::OnScreenUngrabbed));
7376
74 hud_service_.queries_updated.connect(sigc::mem_fun(this, &Controller::OnQueriesFinished));77 hud_service_.queries_updated.connect(sigc::mem_fun(this, &Controller::OnQueriesFinished));
@@ -154,17 +157,23 @@
154157
155nux::Geometry Controller::GetIdealWindowGeometry()158nux::Geometry Controller::GetIdealWindowGeometry()
156{159{
157 UScreen *uscreen = UScreen::GetDefault();160 UScreen *uscreen = UScreen::GetDefault();
158 int primary_monitor = uscreen->GetMonitorWithMouse();161 int primary_monitor = uscreen->GetMonitorWithMouse();
159 auto monitor_geo = uscreen->GetMonitorGeometry(primary_monitor);162 auto monitor_geo = uscreen->GetMonitorGeometry(primary_monitor);
160163
161 // We want to cover as much of the screen as possible to grab any mouse events outside164 // We want to cover as much of the screen as possible to grab any mouse events outside
162 // of our window165 // of our window
163 panel::Style &panel_style = panel::Style::Instance();166 panel::Style &panel_style = panel::Style::Instance();
164 return nux::Geometry (monitor_geo.x,167 nux::Geometry geo(monitor_geo.x,
165 monitor_geo.y + panel_style.panel_height,168 monitor_geo.y + panel_style.panel_height,
166 monitor_geo.width,169 monitor_geo.width,
167 monitor_geo.height - panel_style.panel_height);170 monitor_geo.height - panel_style.panel_height);
171 if (launcher_is_locked_out_)
172 {
173 geo.x += launcher_width;
174 geo.width -= launcher_width;
175 }
176 return geo;
168}177}
169178
170void Controller::Relayout(GdkScreen*screen)179void Controller::Relayout(GdkScreen*screen)
@@ -224,6 +233,16 @@
224 return visible_;233 return visible_;
225}234}
226235
236void Controller::SetLauncherIsLockedOut(bool launcher_is_locked_out)
237{
238 launcher_is_locked_out_ = launcher_is_locked_out;
239 if (launcher_is_locked_out_)
240 view_->SetHideIcon(IconHideState::HIDE);
241 else
242 view_->SetHideIcon(IconHideState::SHOW);
243 Relayout();
244}
245
227void Controller::ShowHud()246void Controller::ShowHud()
228{247{
229 PluginAdapter* adaptor = PluginAdapter::Default();248 PluginAdapter* adaptor = PluginAdapter::Default();
@@ -248,6 +267,7 @@
248 focused_app_icon_ = view_icon.Str();267 focused_app_icon_ = view_icon.Str();
249268
250 LOG_DEBUG(logger) << "Taking application icon: " << focused_app_icon_;269 LOG_DEBUG(logger) << "Taking application icon: " << focused_app_icon_;
270 ubus.SendMessage(UBUS_HUD_ICON_CHANGED, g_variant_new_string(focused_app_icon_.c_str()));
251 view_->SetIcon(focused_app_icon_);271 view_->SetIcon(focused_app_icon_);
252272
253 window_->ShowWindow(true);273 window_->ShowWindow(true);
@@ -398,6 +418,7 @@
398{418{
399 LOG_DEBUG(logger) << "Selected query, " << query->formatted_text;419 LOG_DEBUG(logger) << "Selected query, " << query->formatted_text;
400 view_->SetIcon(query->icon_name);420 view_->SetIcon(query->icon_name);
421 ubus.SendMessage(UBUS_HUD_ICON_CHANGED, g_variant_new_string(query->icon_name.c_str()));
401}422}
402423
403424
@@ -416,6 +437,7 @@
416437
417 LOG_DEBUG(logger) << "setting icon to - " << icon_name;438 LOG_DEBUG(logger) << "setting icon to - " << icon_name;
418 view_->SetIcon(icon_name);439 view_->SetIcon(icon_name);
440 ubus.SendMessage(UBUS_HUD_ICON_CHANGED, g_variant_new_string(icon_name.c_str()));
419}441}
420442
421// Introspectable443// Introspectable
422444
=== modified file 'plugins/unityshell/src/HudController.h'
--- plugins/unityshell/src/HudController.h 2012-02-12 14:47:39 +0000
+++ plugins/unityshell/src/HudController.h 2012-03-16 10:27:23 +0000
@@ -54,6 +54,8 @@
54 void ShowHud();54 void ShowHud();
55 void HideHud(bool restore_focus = true);55 void HideHud(bool restore_focus = true);
56 bool IsVisible();56 bool IsVisible();
57 void SetLauncherIsLockedOut(bool launcher_is_locked_out);
58
57protected:59protected:
58 std::string GetName() const;60 std::string GetName() const;
59 void AddProperties(GVariantBuilder* builder);61 void AddProperties(GVariantBuilder* builder);
@@ -99,6 +101,8 @@
99 guint timeline_id_;101 guint timeline_id_;
100 float last_opacity_;102 float last_opacity_;
101 gint64 start_time_;103 gint64 start_time_;
104
105 bool launcher_is_locked_out_;
102106
103 View* view_;107 View* view_;
104 guint ensure_id_;108 guint ensure_id_;
105109
=== added file 'plugins/unityshell/src/HudLauncherIcon.cpp'
--- plugins/unityshell/src/HudLauncherIcon.cpp 1970-01-01 00:00:00 +0000
+++ plugins/unityshell/src/HudLauncherIcon.cpp 2012-03-16 10:27:23 +0000
@@ -0,0 +1,115 @@
1// -*- Mode: C++; indent-tabs-mode: nil; tab-width: 2 -*-
2/*
3 * Copyright (C) 2011 Canonical Ltd
4 *
5 * This program is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License version 3 as
7 * published by the Free Software Foundation.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program. If not, see <http://www.gnu.org/licenses/>.
16 *
17 * Authored by: Gordon Allott <gord.allott@canonical.com>
18 */
19
20#include "HudLauncherIcon.h"
21#include "Launcher.h"
22#include "UnityCore/GLibWrapper.h"
23#include <NuxCore/Logger.h>
24
25#include "UBusMessages.h"
26
27#include <glib/gi18n-lib.h>
28
29namespace unity
30{
31namespace launcher
32{
33
34namespace
35{
36nux::logging::Logger logger("unity.launcher.hudlaunchericon");
37}
38
39UBusManager HudLauncherIcon::ubus_manager_;
40
41HudLauncherIcon::HudLauncherIcon()
42 : SimpleLauncherIcon()
43{
44 tooltip_text = _("HUD");
45 icon_name = PKGDATADIR"/launcher_bfb.png";
46 SetQuirk(QUIRK_VISIBLE, false);
47 SetQuirk(QUIRK_RUNNING, false);
48 SetQuirk(QUIRK_ACTIVE, true);
49 SetIconType(TYPE_HOME);
50
51 background_color_ = nux::color::White;
52
53 ubus_manager_.RegisterInterest(UBUS_HUD_ICON_CHANGED, [&](GVariant *data)
54 {
55 LOG_DEBUG(logger) << "Hud icon change: " << g_variant_get_string(data, NULL);
56 glib::String hud_icon_name(g_strdup(g_variant_get_string(data, NULL)));
57 if (!hud_icon_name.Str().empty()
58 && hud_icon_name.Str() != icon_name())
59 {
60 icon_name = hud_icon_name.Str();
61 EmitNeedsRedraw();
62 }
63 });
64
65 ubus_manager_.RegisterInterest(UBUS_OVERLAY_SHOWN, sigc::bind(sigc::mem_fun(this, &HudLauncherIcon::OnOverlayShown), true));
66 ubus_manager_.RegisterInterest(UBUS_OVERLAY_HIDDEN, sigc::bind(sigc::mem_fun(this, &HudLauncherIcon::OnOverlayShown), false));
67
68 mouse_enter.connect([&](int m) { ubus_manager_.SendMessage(UBUS_DASH_ABOUT_TO_SHOW, NULL); });
69}
70
71void HudLauncherIcon::OnOverlayShown(GVariant *data, bool visible)
72{
73 unity::glib::String overlay_identity;
74 gboolean can_maximise = FALSE;
75 gint32 overlay_monitor = 0;
76 g_variant_get(data, UBUS_OVERLAY_FORMAT_STRING,
77 &overlay_identity, &can_maximise, &overlay_monitor);
78
79
80 if (!g_strcmp0(overlay_identity, "hud"))
81 {
82 SetQuirk(QUIRK_VISIBLE, visible);
83 EmitNeedsRedraw();
84 }
85}
86
87nux::Color HudLauncherIcon::BackgroundColor()
88{
89 return background_color_;
90}
91
92nux::Color HudLauncherIcon::GlowColor()
93{
94 return background_color_;
95}
96
97void HudLauncherIcon::ActivateLauncherIcon(ActionArg arg)
98{
99 // wut? activate? noo we don't do that.
100}
101
102std::list<DbusmenuMenuitem*> HudLauncherIcon::GetMenus()
103{
104 std::list<DbusmenuMenuitem*> result;
105 return result;
106}
107
108std::string HudLauncherIcon::GetName() const
109{
110 return "HudLauncherIcon";
111}
112
113} // namespace launcher
114} // namespace unity
115
0116
=== added file 'plugins/unityshell/src/HudLauncherIcon.h'
--- plugins/unityshell/src/HudLauncherIcon.h 1970-01-01 00:00:00 +0000
+++ plugins/unityshell/src/HudLauncherIcon.h 2012-03-16 10:27:23 +0000
@@ -0,0 +1,56 @@
1// -*- Mode: C++; indent-tabs-mode: nil; tab-width: 2 -*-
2/*
3 * Copyright (C) 2011 Canonical Ltd
4 *
5 * This program is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License version 3 as
7 * published by the Free Software Foundation.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program. If not, see <http://www.gnu.org/licenses/>.
16 *
17 * Authored by: Gordon Allott <gord.allott@gmail.com>
18 */
19
20#ifndef UNITYSHELL_HUDLAUNCHERICON_H
21#define UNITYSHELL_HUDLAUNCHERICON_H
22
23#include "SimpleLauncherIcon.h"
24#include "UBusWrapper.h"
25
26namespace unity
27{
28namespace launcher
29{
30
31class HudLauncherIcon : public SimpleLauncherIcon
32{
33
34public:
35 HudLauncherIcon();
36
37 virtual nux::Color BackgroundColor();
38 virtual nux::Color GlowColor();
39
40 void ActivateLauncherIcon(ActionArg arg);
41
42protected:
43 std::list<DbusmenuMenuitem*> GetMenus();
44 std::string GetName() const;
45
46private:
47 void OnOverlayShown(GVariant *data, bool visible);
48
49 static unity::UBusManager ubus_manager_;
50 nux::Color background_color_;
51};
52
53}
54}
55
56#endif // UNITYSHELL_HUDLAUNCHERICON_H
057
=== modified file 'plugins/unityshell/src/HudView.cpp'
--- plugins/unityshell/src/HudView.cpp 2012-03-02 02:00:18 +0000
+++ plugins/unityshell/src/HudView.cpp 2012-03-16 10:27:23 +0000
@@ -64,6 +64,7 @@
64 , current_height_(0)64 , current_height_(0)
65 , timeline_need_more_draw_(false)65 , timeline_need_more_draw_(false)
66 , selected_button_(0)66 , selected_button_(0)
67 , icon_state_(IconHideState::SHOW)
67{68{
68 renderer_.SetOwner(this);69 renderer_.SetOwner(this);
69 renderer_.need_redraw.connect([this] () { 70 renderer_.need_redraw.connect([this] () {
@@ -185,7 +186,6 @@
185 layout_->SetMinimumWidth(content_geo_.width);186 layout_->SetMinimumWidth(content_geo_.width);
186 layout_->SetMaximumWidth(content_geo_.width);187 layout_->SetMaximumWidth(content_geo_.width);
187 layout_->SetMaximumHeight(content_geo_.height);188 layout_->SetMaximumHeight(content_geo_.height);
188 //layout_->SetMinMaxSize(content_geo_.width, content_geo_.height);
189189
190 QueueDraw();190 QueueDraw();
191}191}
@@ -274,6 +274,22 @@
274 QueueDraw();274 QueueDraw();
275}275}
276276
277void View::SetHideIcon(IconHideState hide_icon)
278{
279 LOG_DEBUG(logger) << "Hide icon called";
280 if (hide_icon == icon_state_)
281 return;
282
283 icon_state_ = hide_icon;
284
285 if (icon_state_ == IconHideState::HIDE)
286 layout_->RemoveChildObject(dynamic_cast<nux::Area*>(icon_layout_.GetPointer()));
287 else
288 layout_->AddLayout(icon_layout_.GetPointer(), 0, nux::MINOR_POSITION_TOP, nux::MINOR_SIZE_MATCHCONTENT, 100.0f, nux::LayoutPosition::NUX_LAYOUT_BEGIN);
289
290 Relayout();
291}
292
277// Gives us the width and height of the contents that will give us the best "fit",293// Gives us the width and height of the contents that will give us the best "fit",
278// which means that the icons/views will not have uneccessary padding, everything will294// which means that the icons/views will not have uneccessary padding, everything will
279// look tight295// look tight
@@ -284,7 +300,12 @@
284 int width, height = 0;300 int width, height = 0;
285 width = 1024;301 width = 1024;
286 height = 276;302 height = 276;
287 303
304 if (icon_state_ == IconHideState::HIDE)
305 {
306 width -= icon_layout_->GetGeometry().width;
307 }
308
288 LOG_DEBUG (logger) << "best fit is, " << width << ", " << height;309 LOG_DEBUG (logger) << "best fit is, " << width << ", " << height;
289310
290 return nux::Geometry(0, 0, width, height);311 return nux::Geometry(0, 0, width, height);
@@ -324,11 +345,11 @@
324 { 345 {
325 // fill icon layout with icon346 // fill icon layout with icon
326 icon_ = new Icon("", icon_size, true);347 icon_ = new Icon("", icon_size, true);
327 nux::Layout* icon_layout = new nux::VLayout();348 icon_layout_ = new nux::VLayout();
328 {349 {
329 icon_layout->SetVerticalExternalMargin(icon_vertical_margin);350 icon_layout_->SetVerticalExternalMargin(icon_vertical_margin);
330 icon_layout->AddView(icon_.GetPointer(), 0, nux::MINOR_POSITION_LEFT, nux::MINOR_SIZE_FULL);351 icon_layout_->AddView(icon_.GetPointer(), 0, nux::MINOR_POSITION_LEFT, nux::MINOR_SIZE_FULL);
331 layout_->AddLayout(icon_layout, 0, nux::MINOR_POSITION_TOP, nux::MINOR_SIZE_MATCHCONTENT);352 layout_->AddLayout(icon_layout_.GetPointer(), 0, nux::MINOR_POSITION_TOP, nux::MINOR_SIZE_MATCHCONTENT);
332 }353 }
333354
334 // add padding to layout between icon and content355 // add padding to layout between icon and content
335356
=== modified file 'plugins/unityshell/src/HudView.h'
--- plugins/unityshell/src/HudView.h 2012-03-02 02:00:18 +0000
+++ plugins/unityshell/src/HudView.h 2012-03-16 10:27:23 +0000
@@ -44,6 +44,12 @@
44namespace hud44namespace hud
45{45{
4646
47enum IconHideState
48{
49 HIDE,
50 SHOW
51};
52
47class View : public nux::View, public unity::debug::Introspectable53class View : public nux::View, public unity::debug::Introspectable
48{54{
49 NUX_DECLARE_OBJECT_TYPE(HudView, nux::View);55 NUX_DECLARE_OBJECT_TYPE(HudView, nux::View);
@@ -59,7 +65,8 @@
5965
60 void SetQueries(Hud::Queries queries);66 void SetQueries(Hud::Queries queries);
61 void SetIcon(std::string icon_name);67 void SetIcon(std::string icon_name);
62 68 void SetHideIcon(IconHideState hide_icon);
69
63 void AboutToShow();70 void AboutToShow();
64 void AboutToHide();71 void AboutToHide();
6572
@@ -104,6 +111,7 @@
104 //FIXME - replace with dash search bar once modifications to dash search bar land111 //FIXME - replace with dash search bar once modifications to dash search bar land
105 SearchBar::Ptr search_bar_;112 SearchBar::Ptr search_bar_;
106 Icon::Ptr icon_;113 Icon::Ptr icon_;
114 nux::ObjectPtr<nux::Layout> icon_layout_;
107 bool visible_;115 bool visible_;
108116
109 Hud::Queries queries_;117 Hud::Queries queries_;
@@ -118,6 +126,7 @@
118 int current_height_;126 int current_height_;
119 bool timeline_need_more_draw_;127 bool timeline_need_more_draw_;
120 int selected_button_;128 int selected_button_;
129 IconHideState icon_state_;
121};130};
122131
123132
124133
=== modified file 'plugins/unityshell/src/Launcher.cpp'
--- plugins/unityshell/src/Launcher.cpp 2012-03-13 17:20:30 +0000
+++ plugins/unityshell/src/Launcher.cpp 2012-03-16 10:27:23 +0000
@@ -1320,19 +1320,16 @@
1320 &overlay_identity, &can_maximise, &overlay_monitor);1320 &overlay_identity, &can_maximise, &overlay_monitor);
13211321
13221322
1323 if (!g_strcmp0(overlay_identity, "dash"))1323 if (overlay_monitor == monitor)
1324 {1324 {
1325 if (overlay_monitor == monitor)1325 LauncherModel::iterator it;
1326 {1326
1327 LauncherModel::iterator it;1327 _dash_is_open = true;
13281328 bg_effect_helper_.enabled = true;
1329 _dash_is_open = true;1329 _hide_machine->SetQuirk(LauncherHideMachine::PLACES_VISIBLE, true);
1330 bg_effect_helper_.enabled = true;1330 _hover_machine->SetQuirk(LauncherHoverMachine::PLACES_VISIBLE, true);
1331 _hide_machine->SetQuirk(LauncherHideMachine::PLACES_VISIBLE, true);1331
1332 _hover_machine->SetQuirk(LauncherHoverMachine::PLACES_VISIBLE, true);1332 DesaturateIcons();
1333
1334 DesaturateIcons();
1335 }
1336 }1333 }
1337}1334}
13381335
@@ -1345,26 +1342,23 @@
1345 g_variant_get(data, UBUS_OVERLAY_FORMAT_STRING,1342 g_variant_get(data, UBUS_OVERLAY_FORMAT_STRING,
1346 &overlay_identity, &can_maximise, &overlay_monitor);1343 &overlay_identity, &can_maximise, &overlay_monitor);
13471344
1348 if (!g_strcmp0(overlay_identity, "dash"))1345 if (!_dash_is_open)
1349 {1346 return;
1350 if (!_dash_is_open)1347
1351 return;1348 LauncherModel::iterator it;
13521349
1353 LauncherModel::iterator it;1350 _dash_is_open = false;
13541351 bg_effect_helper_.enabled = false;
1355 _dash_is_open = false;1352 _hide_machine->SetQuirk(LauncherHideMachine::PLACES_VISIBLE, false);
1356 bg_effect_helper_.enabled = false;1353 _hover_machine->SetQuirk(LauncherHoverMachine::PLACES_VISIBLE, false);
1357 _hide_machine->SetQuirk(LauncherHideMachine::PLACES_VISIBLE, false);1354
1358 _hover_machine->SetQuirk(LauncherHoverMachine::PLACES_VISIBLE, false);1355 // as the leave event is no more received when the place is opened
13591356 // FIXME: remove when we change the mouse grab strategy in nux
1360 // as the leave event is no more received when the place is opened1357 nux::Point pt = nux::GetWindowCompositor().GetMousePosition();
1361 // FIXME: remove when we change the mouse grab strategy in nux1358
1362 nux::Point pt = nux::GetWindowCompositor().GetMousePosition();1359 SetStateMouseOverLauncher(GetAbsoluteGeometry().IsInside(pt));
13631360
1364 SetStateMouseOverLauncher(GetAbsoluteGeometry().IsInside(pt));1361 SaturateIcons();
1365
1366 SaturateIcons();
1367 }
1368}1362}
13691363
1370void Launcher::OnActionDone(GVariant* data)1364void Launcher::OnActionDone(GVariant* data)
13711365
=== modified file 'plugins/unityshell/src/LauncherController.cpp'
--- plugins/unityshell/src/LauncherController.cpp 2012-03-14 23:22:02 +0000
+++ plugins/unityshell/src/LauncherController.cpp 2012-03-16 10:27:23 +0000
@@ -32,6 +32,7 @@
32#include "DeviceLauncherIcon.h"32#include "DeviceLauncherIcon.h"
33#include "DeviceLauncherSection.h"33#include "DeviceLauncherSection.h"
34#include "FavoriteStore.h"34#include "FavoriteStore.h"
35#include "HudLauncherIcon.h"
35#include "Launcher.h"36#include "Launcher.h"
36#include "LauncherController.h"37#include "LauncherController.h"
37#include "LauncherEntryRemote.h"38#include "LauncherEntryRemote.h"
@@ -233,6 +234,7 @@
233 FavoriteStore::GetDefault().reordered.connect(sigc::mem_fun(this, &Impl::OnFavoriteStoreReordered));234 FavoriteStore::GetDefault().reordered.connect(sigc::mem_fun(this, &Impl::OnFavoriteStoreReordered));
234235
235 RegisterIcon(AbstractLauncherIcon::Ptr(new BFBLauncherIcon()));236 RegisterIcon(AbstractLauncherIcon::Ptr(new BFBLauncherIcon()));
237 RegisterIcon(AbstractLauncherIcon::Ptr(new HudLauncherIcon()));
236 desktop_icon_ = AbstractLauncherIcon::Ptr(new DesktopLauncherIcon());238 desktop_icon_ = AbstractLauncherIcon::Ptr(new DesktopLauncherIcon());
237239
238 uscreen->changed.connect(sigc::mem_fun(this, &Controller::Impl::OnScreenChanged));240 uscreen->changed.connect(sigc::mem_fun(this, &Controller::Impl::OnScreenChanged));
239241
=== modified file 'plugins/unityshell/src/LauncherHideMachine.cpp'
--- plugins/unityshell/src/LauncherHideMachine.cpp 2012-02-08 16:43:47 +0000
+++ plugins/unityshell/src/LauncherHideMachine.cpp 2012-03-16 10:27:23 +0000
@@ -134,19 +134,19 @@
134{134{
135 bool should_hide;135 bool should_hide;
136136
137 // early check to see if we are locking to hidden137 if (_mode == HIDE_NEVER)
138 {
139 SetShouldHide(false, skip_delay);
140 return;
141 }
142
143 // early check to see if we are locking to hidden - but only if we are in non HIDE_NEVER
138 if (GetQuirk(LOCK_HIDE))144 if (GetQuirk(LOCK_HIDE))
139 {145 {
140 SetShouldHide(true, true);146 SetShouldHide(true, true);
141 return;147 return;
142 }148 }
143149
144 if (_mode == HIDE_NEVER)
145 {
146 SetShouldHide(false, skip_delay);
147 return;
148 }
149
150 do150 do
151 {151 {
152 // first we check the condition where external DND is active and the push off has happened152 // first we check the condition where external DND is active and the push off has happened
153153
=== modified file 'plugins/unityshell/src/UBusMessages.h'
--- plugins/unityshell/src/UBusMessages.h 2012-02-07 07:42:12 +0000
+++ plugins/unityshell/src/UBusMessages.h 2012-03-16 10:27:23 +0000
@@ -64,6 +64,9 @@
64// Signal to force the launcher into locked mode, (b)64// Signal to force the launcher into locked mode, (b)
65#define UBUS_LAUNCHER_LOCK_HIDE "LAUNCHER_LOCK_HIDE"65#define UBUS_LAUNCHER_LOCK_HIDE "LAUNCHER_LOCK_HIDE"
6666
67// Signal to emit changes to the launcher hide mode behaviour (b), true = locked out, false = unlocked
68#define UBUS_LAUNCHER_HIDE_MODE_CHANGE "LAUNCHER_HIDE_MODE_CHANGE"
69
67// Signal sent when a quicklist is shown.70// Signal sent when a quicklist is shown.
68#define UBUS_QUICKLIST_SHOWN "QUICKLIST_SHOWN"71#define UBUS_QUICKLIST_SHOWN "QUICKLIST_SHOWN"
6972
@@ -78,6 +81,8 @@
78// FIXME - fix the nux focus api so we don't need this81// FIXME - fix the nux focus api so we don't need this
79#define UBUS_RESULT_VIEW_KEYNAV_CHANGED "RESULT_VIEW_KEYNAV_CHANGED"82#define UBUS_RESULT_VIEW_KEYNAV_CHANGED "RESULT_VIEW_KEYNAV_CHANGED"
8083
84// Sends a string datatype containing the new icon name
85#define UBUS_HUD_ICON_CHANGED "HUD_ICON_CHANGED"
81#define UBUS_HUD_CLOSE_REQUEST "HUD_CLOSE_REQUEST"86#define UBUS_HUD_CLOSE_REQUEST "HUD_CLOSE_REQUEST"
8287
83// Signals sent when the switcher is shown, hidden or changes selection88// Signals sent when the switcher is shown, hidden or changes selection
8489
=== modified file 'plugins/unityshell/src/unityshell.cpp'
--- plugins/unityshell/src/unityshell.cpp 2012-03-14 13:05:59 +0000
+++ plugins/unityshell/src/unityshell.cpp 2012-03-16 10:27:23 +0000
@@ -2505,8 +2505,11 @@
2505 break;2505 break;
2506 }2506 }
2507 case UnityshellOptions::LauncherHideMode:2507 case UnityshellOptions::LauncherHideMode:
2508 {
2508 launcher_options->hide_mode = (unity::launcher::LauncherHideMode) optionGetLauncherHideMode();2509 launcher_options->hide_mode = (unity::launcher::LauncherHideMode) optionGetLauncherHideMode();
2510 hud_controller_->SetLauncherIsLockedOut(launcher_options->hide_mode == unity::launcher::LauncherHideMode::LAUNCHER_HIDE_NEVER);
2509 break;2511 break;
2512 }
2510 case UnityshellOptions::BacklightMode:2513 case UnityshellOptions::BacklightMode:
2511 launcher_options->backlight_mode = (unity::launcher::BacklightMode) optionGetBacklightMode();2514 launcher_options->backlight_mode = (unity::launcher::BacklightMode) optionGetBacklightMode();
2512 break;2515 break;
@@ -2738,6 +2741,8 @@
27382741
2739 /* Setup Hud */2742 /* Setup Hud */
2740 hud_controller_.reset(new hud::Controller());2743 hud_controller_.reset(new hud::Controller());
2744 auto hide_mode = (unity::launcher::LauncherHideMode) optionGetLauncherHideMode();
2745 hud_controller_->SetLauncherIsLockedOut(hide_mode == unity::launcher::LauncherHideMode::LAUNCHER_HIDE_NEVER);
2741 AddChild(hud_controller_.get());2746 AddChild(hud_controller_.get());
2742 LOG_INFO(logger) << "initLauncher-hud " << timer.ElapsedSeconds() << "s";2747 LOG_INFO(logger) << "initLauncher-hud " << timer.ElapsedSeconds() << "s";
2743 2748