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

Proposed by Tim Penhey
Status: Merged
Merge reported by: Didier Roche-Tolomelli
Merged at revision: not available
Proposed branch: lp:~thumper/unity/lock-out-hud
Merge into: lp:unity
Diff against target: 1083 lines (+427/-93)
17 files modified
manual-tests/Hud.txt (+14/-0)
plugins/unityshell/src/BFBLauncherIcon.cpp (+27/-1)
plugins/unityshell/src/BFBLauncherIcon.h (+5/-1)
plugins/unityshell/src/HudController.cpp (+34/-11)
plugins/unityshell/src/HudController.h (+4/-0)
plugins/unityshell/src/HudLauncherIcon.cpp (+125/-0)
plugins/unityshell/src/HudLauncherIcon.h (+60/-0)
plugins/unityshell/src/HudView.cpp (+47/-26)
plugins/unityshell/src/HudView.h (+11/-2)
plugins/unityshell/src/Launcher.cpp (+47/-34)
plugins/unityshell/src/Launcher.h (+2/-0)
plugins/unityshell/src/LauncherController.cpp (+13/-1)
plugins/unityshell/src/LauncherHideMachine.cpp (+7/-7)
plugins/unityshell/src/LauncherOptions.h (+10/-10)
plugins/unityshell/src/UBusMessages.h (+5/-0)
plugins/unityshell/src/unityshell.cpp (+5/-0)
tests/autopilot/autopilot/tests/test_hud.py (+11/-0)
To merge this branch: bzr merge lp:~thumper/unity/lock-out-hud
Reviewer Review Type Date Requested Status
Gord Allott (community) Approve
Marco Trevisan (Treviño) Approve
Mirco Müller Pending
Review via email: mp+98573@code.launchpad.net

This proposal supersedes a proposal from 2012-03-16.

Commit message

Adapt the HUD visuals to look nice with a locked out launcher.

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

See http://people.canonical.com/~tim/hud.ogv

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

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 : Posted in a previous version of this proposal

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 : Posted in a previous version of this proposal

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 : Posted in a previous version of this proposal

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 : Posted in a previous version of this proposal

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.

Revision history for this message
Marco Trevisan (Treviño) (3v1n0) wrote :

Interactions look good to me now.

We should add AP tests to check also that the launcher status change only as it should when using the HUD...

review: Approve
Revision history for this message
Gord Allott (gordallott) wrote :

+1, but technically I'm reviewing the changes Tim made to my code. I also give my code +1 but i may be bias :)

review: Approve
Revision history for this message
Tim Penhey (thumper) wrote :

On 21/03/12 23:07, Gord Allott wrote:
> Review: Approve
>
> +1, but technically I'm reviewing the changes Tim made to my code. I also give my code +1 but i may be bias :)

I approved of Gord's work, and extended. So we should have this covered :)

Revision history for this message
Gord Allott (gordallott) wrote :

Mr Cimitan is happy with the design, so approving

review: Approve
Revision history for this message
Andrea Cimitan (cimi) wrote :

I am fine with the design as a first iteration, two stuffs I noticed and I ask to fix for 12.04:
1) animation of bfb->icon when launcher is on (maybe designers need to provide a desired solution)
2) there's a duplicated separator line between the hud rectangle and the launcher http://i.imgur.com/xgV0L.png
3) the hud icon is using two different tiles when the launcher is on (bfb-like) and the launcher is hidden (normal tile)

Revision history for this message
Andrea Cimitan (cimi) wrote :

three stuffs, of course I can count. welcome back from holiday cimi.

Revision history for this message
Andrea Cimitan (cimi) wrote :

updated screenshot of issue 2) http://i.imgur.com/zYxJ8.png

Revision history for this message
Didier Roche-Tolomelli (didrocks) wrote :

I reverted the branch in trunk, see bug #961169

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-03-20 14:00:00 +0000
+++ manual-tests/Hud.txt 2012-03-21 04:27:19 +0000
@@ -56,6 +56,20 @@
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
59Hud Reveal Behaviour
60---------
61This test ensures that the hud behaves correctly with a locked out launcher
62
63#. Ensure the launchers hide mode is set to "Never"
64#. Tap Alt
65
66Outcome
67 The Launcher should stick be locked out.
68 The Launcher icons should be desaturated.
69 The top most Launcher icon should be an icon related the the focused window
70 The BFB should not be present
71
72
59Hud Sending Undo73Hud Sending Undo
60----------------74----------------
61This test ensure that the undo action is properly handle in a text editor.75This test ensure that the undo action is properly handle in a text editor.
6276
=== modified file 'plugins/unityshell/src/BFBLauncherIcon.cpp'
--- plugins/unityshell/src/BFBLauncherIcon.cpp 2012-03-20 10:18:20 +0000
+++ plugins/unityshell/src/BFBLauncherIcon.cpp 2012-03-21 04:27:19 +0000
@@ -32,9 +32,10 @@
3232
33UBusManager BFBLauncherIcon::ubus_manager_;33UBusManager BFBLauncherIcon::ubus_manager_;
3434
35BFBLauncherIcon::BFBLauncherIcon()35BFBLauncherIcon::BFBLauncherIcon(LauncherHideMode hide_mode)
36 : SimpleLauncherIcon()36 : SimpleLauncherIcon()
37 , reader_(dash::LensDirectoryReader::GetDefault())37 , reader_(dash::LensDirectoryReader::GetDefault())
38 , launcher_hide_mode_(hide_mode)
38{39{
39 tooltip_text = _("Dash Home");40 tooltip_text = _("Dash Home");
40 icon_name = PKGDATADIR"/launcher_bfb.png";41 icon_name = PKGDATADIR"/launcher_bfb.png";
@@ -45,6 +46,31 @@
45 background_color_ = nux::color::White;46 background_color_ = nux::color::White;
4647
47 mouse_enter.connect([&](int m) { ubus_manager_.SendMessage(UBUS_DASH_ABOUT_TO_SHOW, NULL); });48 mouse_enter.connect([&](int m) { ubus_manager_.SendMessage(UBUS_DASH_ABOUT_TO_SHOW, NULL); });
49 ubus_manager_.RegisterInterest(UBUS_OVERLAY_SHOWN, sigc::bind(sigc::mem_fun(this, &BFBLauncherIcon::OnOverlayShown), true));
50 ubus_manager_.RegisterInterest(UBUS_OVERLAY_HIDDEN, sigc::bind(sigc::mem_fun(this, &BFBLauncherIcon::OnOverlayShown), false));
51}
52
53void BFBLauncherIcon::SetHideMode(LauncherHideMode hide_mode)
54{
55 launcher_hide_mode_ = hide_mode;
56}
57
58void BFBLauncherIcon::OnOverlayShown(GVariant *data, bool visible)
59{
60 unity::glib::String overlay_identity;
61 gboolean can_maximise = FALSE;
62 gint32 overlay_monitor = 0;
63 g_variant_get(data, UBUS_OVERLAY_FORMAT_STRING,
64 &overlay_identity, &can_maximise, &overlay_monitor);
65
66
67 // If the hud is open, we hide the BFB iff we have a locked launcher
68 if (!g_strcmp0(overlay_identity, "hud") &&
69 launcher_hide_mode_ == LAUNCHER_HIDE_NEVER)
70 {
71 SetQuirk(QUIRK_VISIBLE, !visible);
72 EmitNeedsRedraw();
73 }
48}74}
4975
50nux::Color BFBLauncherIcon::BackgroundColor()76nux::Color BFBLauncherIcon::BackgroundColor()
5177
=== 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-21 04:27:19 +0000
@@ -24,6 +24,7 @@
2424
25#include <UnityCore/FilesystemLenses.h>25#include <UnityCore/FilesystemLenses.h>
2626
27#include "LauncherOptions.h"
27#include "UBusWrapper.h"28#include "UBusWrapper.h"
2829
29namespace unity30namespace unity
@@ -35,23 +36,26 @@
35{36{
3637
37public:38public:
38 BFBLauncherIcon();39 BFBLauncherIcon(LauncherHideMode hide_mode);
3940
40 virtual nux::Color BackgroundColor();41 virtual nux::Color BackgroundColor();
41 virtual nux::Color GlowColor();42 virtual nux::Color GlowColor();
4243
43 void ActivateLauncherIcon(ActionArg arg);44 void ActivateLauncherIcon(ActionArg arg);
45 void SetHideMode(LauncherHideMode hide_mode);
4446
45protected:47protected:
46 std::list<DbusmenuMenuitem*> GetMenus();48 std::list<DbusmenuMenuitem*> GetMenus();
47 std::string GetName() const;49 std::string GetName() const;
4850
49private:51private:
52 void OnOverlayShown(GVariant *data, bool visible);
50 static void OnMenuitemActivated(DbusmenuMenuitem* item, int time, gchar* lens);53 static void OnMenuitemActivated(DbusmenuMenuitem* item, int time, gchar* lens);
5154
52 static unity::UBusManager ubus_manager_;55 static unity::UBusManager ubus_manager_;
53 nux::Color background_color_;56 nux::Color background_color_;
54 dash::LensDirectoryReader::Ptr reader_;57 dash::LensDirectoryReader::Ptr reader_;
58 LauncherHideMode launcher_hide_mode_;
55};59};
5660
57}61}
5862
=== modified file 'plugins/unityshell/src/HudController.cpp'
--- plugins/unityshell/src/HudController.cpp 2012-03-20 10:27:41 +0000
+++ plugins/unityshell/src/HudController.cpp 2012-03-21 04:27:19 +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);
@@ -275,6 +295,7 @@
275 nux::GetWindowCompositor().SetKeyFocusArea(view_->default_focus());295 nux::GetWindowCompositor().SetKeyFocusArea(view_->default_focus());
276 window_->SetEnterFocusInputArea(view_->default_focus());296 window_->SetEnterFocusInputArea(view_->default_focus());
277}297}
298
278void Controller::HideHud(bool restore)299void Controller::HideHud(bool restore)
279{300{
280 LOG_DEBUG (logger) << "hiding the hud";301 LOG_DEBUG (logger) << "hiding the hud";
@@ -398,6 +419,7 @@
398{419{
399 LOG_DEBUG(logger) << "Selected query, " << query->formatted_text;420 LOG_DEBUG(logger) << "Selected query, " << query->formatted_text;
400 view_->SetIcon(query->icon_name);421 view_->SetIcon(query->icon_name);
422 ubus.SendMessage(UBUS_HUD_ICON_CHANGED, g_variant_new_string(query->icon_name.c_str()));
401}423}
402424
403425
@@ -416,6 +438,7 @@
416438
417 LOG_DEBUG(logger) << "setting icon to - " << icon_name;439 LOG_DEBUG(logger) << "setting icon to - " << icon_name;
418 view_->SetIcon(icon_name);440 view_->SetIcon(icon_name);
441 ubus.SendMessage(UBUS_HUD_ICON_CHANGED, g_variant_new_string(icon_name.c_str()));
419}442}
420443
421// Introspectable444// Introspectable
422445
=== modified file 'plugins/unityshell/src/HudController.h'
--- plugins/unityshell/src/HudController.h 2012-02-13 04:21:04 +0000
+++ plugins/unityshell/src/HudController.h 2012-03-21 04:27:19 +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-21 04:27:19 +0000
@@ -0,0 +1,125 @@
1// -*- Mode: C++; indent-tabs-mode: nil; tab-width: 2 -*-
2/*
3 * Copyright (C) 2012 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(LauncherHideMode hide_mode)
42 : SimpleLauncherIcon()
43 , launcher_hide_mode_(hide_mode)
44{
45 tooltip_text = _("HUD");
46 icon_name = PKGDATADIR"/launcher_bfb.png";
47 SetQuirk(QUIRK_VISIBLE, false);
48 SetQuirk(QUIRK_RUNNING, false);
49 SetQuirk(QUIRK_ACTIVE, true);
50 SetIconType(TYPE_HOME);
51
52 background_color_ = nux::color::White;
53
54 ubus_manager_.RegisterInterest(UBUS_HUD_ICON_CHANGED, [&](GVariant *data)
55 {
56 std::string hud_icon_name;
57 const gchar* data_string = g_variant_get_string(data, NULL);
58 if (data_string)
59 hud_icon_name = data_string;
60 LOG_DEBUG(logger) << "Hud icon change: " << hud_icon_name;
61 if (!hud_icon_name.empty()
62 && hud_icon_name != icon_name())
63 {
64 icon_name = hud_icon_name;
65 EmitNeedsRedraw();
66 }
67 });
68
69 ubus_manager_.RegisterInterest(UBUS_OVERLAY_SHOWN, sigc::bind(sigc::mem_fun(this, &HudLauncherIcon::OnOverlayShown), true));
70 ubus_manager_.RegisterInterest(UBUS_OVERLAY_HIDDEN, sigc::bind(sigc::mem_fun(this, &HudLauncherIcon::OnOverlayShown), false));
71
72 mouse_enter.connect([&](int m) { ubus_manager_.SendMessage(UBUS_DASH_ABOUT_TO_SHOW, NULL); });
73}
74
75void HudLauncherIcon::SetHideMode(LauncherHideMode hide_mode)
76{
77 launcher_hide_mode_ = hide_mode;
78}
79
80void HudLauncherIcon::OnOverlayShown(GVariant* data, bool visible)
81{
82 unity::glib::String overlay_identity;
83 gboolean can_maximise = FALSE;
84 gint32 overlay_monitor = 0;
85 g_variant_get(data, UBUS_OVERLAY_FORMAT_STRING,
86 &overlay_identity, &can_maximise, &overlay_monitor);
87
88 // If the hud is open, we show the HUD button iff we have a locked launcher
89 if (!g_strcmp0(overlay_identity, "hud") &&
90 launcher_hide_mode_ == LAUNCHER_HIDE_NEVER)
91 {
92 SetQuirk(QUIRK_VISIBLE, visible);
93 EmitNeedsRedraw();
94 }
95}
96
97nux::Color HudLauncherIcon::BackgroundColor()
98{
99 return background_color_;
100}
101
102nux::Color HudLauncherIcon::GlowColor()
103{
104 return background_color_;
105}
106
107void HudLauncherIcon::ActivateLauncherIcon(ActionArg arg)
108{
109 // wut? activate? noo we don't do that.
110}
111
112std::list<DbusmenuMenuitem*> HudLauncherIcon::GetMenus()
113{
114 std::list<DbusmenuMenuitem*> result;
115 return result;
116}
117
118std::string HudLauncherIcon::GetName() const
119{
120 return "HudLauncherIcon";
121}
122
123} // namespace launcher
124} // namespace unity
125
0126
=== 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-21 04:27:19 +0000
@@ -0,0 +1,60 @@
1// -*- Mode: C++; indent-tabs-mode: nil; tab-width: 2 -*-
2/*
3 * Copyright (C) 2012 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
25#include "LauncherOptions.h"
26#include "UBusWrapper.h"
27
28namespace unity
29{
30namespace launcher
31{
32
33class HudLauncherIcon : public SimpleLauncherIcon
34{
35
36public:
37 HudLauncherIcon(LauncherHideMode hide_mode);
38
39 virtual nux::Color BackgroundColor();
40 virtual nux::Color GlowColor();
41
42 void ActivateLauncherIcon(ActionArg arg);
43 void SetHideMode(LauncherHideMode hide_mode);
44
45protected:
46 std::list<DbusmenuMenuitem*> GetMenus();
47 std::string GetName() const;
48
49private:
50 void OnOverlayShown(GVariant *data, bool visible);
51
52 static unity::UBusManager ubus_manager_;
53 nux::Color background_color_;
54 LauncherHideMode launcher_hide_mode_;
55};
56
57}
58}
59
60#endif // UNITYSHELL_HUDLAUNCHERICON_H
061
=== modified file 'plugins/unityshell/src/HudView.cpp'
--- plugins/unityshell/src/HudView.cpp 2012-03-20 15:15:18 +0000
+++ plugins/unityshell/src/HudView.cpp 2012-03-21 04:27:19 +0000
@@ -64,10 +64,11 @@
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 , activated_signal_sent_(false)68 , activated_signal_sent_(false)
68{69{
69 renderer_.SetOwner(this);70 renderer_.SetOwner(this);
70 renderer_.need_redraw.connect([this] () { 71 renderer_.need_redraw.connect([this] () {
71 QueueDraw();72 QueueDraw();
72 });73 });
7374
@@ -79,7 +80,7 @@
79 SetupViews();80 SetupViews();
80 search_bar_->key_down.connect (sigc::mem_fun (this, &View::OnKeyDown));81 search_bar_->key_down.connect (sigc::mem_fun (this, &View::OnKeyDown));
8182
82 search_bar_->activated.connect ([&]() 83 search_bar_->activated.connect ([&]()
83 {84 {
84 if (!activated_signal_sent_)85 if (!activated_signal_sent_)
85 search_activated.emit(search_bar_->search_string);86 search_activated.emit(search_bar_->search_string);
@@ -115,12 +116,12 @@
115 {116 {
116 (*it)->fake_focused = false;117 (*it)->fake_focused = false;
117 }118 }
118 } 119 }
119 }120 }
120 });121 });
121122
122 mouse_down.connect(sigc::mem_fun(this, &View::OnMouseButtonDown));123 mouse_down.connect(sigc::mem_fun(this, &View::OnMouseButtonDown));
123 124
124 Relayout();125 Relayout();
125}126}
126127
@@ -143,25 +144,25 @@
143 float progress = (diff - pause_before_grow_length) / grow_anim_length;144 float progress = (diff - pause_before_grow_length) / grow_anim_length;
144 int last_height = last_known_height_;145 int last_height = last_known_height_;
145 int new_height = 0;146 int new_height = 0;
146 147
147 if (last_height < target_height)148 if (last_height < target_height)
148 {149 {
149 // grow150 // grow
150 new_height = last_height + ((target_height - last_height) * progress);151 new_height = last_height + ((target_height - last_height) * progress);
151 }152 }
152 else 153 else
153 {154 {
154 //shrink155 //shrink
155 new_height = last_height - ((last_height - target_height) * progress);156 new_height = last_height - ((last_height - target_height) * progress);
156 }157 }
157 158
158 LOG_DEBUG(logger) << "resizing to " << target_height << " (" << new_height << ")"159 LOG_DEBUG(logger) << "resizing to " << target_height << " (" << new_height << ")"
159 << "View height: " << GetGeometry().height;160 << "View height: " << GetGeometry().height;
160 current_height_ = new_height;161 current_height_ = new_height;
161 }162 }
162 163
163 QueueDraw(); 164 QueueDraw();
164 165
165 if (diff > grow_anim_length + pause_before_grow_length)166 if (diff > grow_anim_length + pause_before_grow_length)
166 {167 {
167 // ensure we are at our final location and update last known height168 // ensure we are at our final location and update last known height
@@ -187,7 +188,6 @@
187 layout_->SetMinimumWidth(content_geo_.width);188 layout_->SetMinimumWidth(content_geo_.width);
188 layout_->SetMaximumWidth(content_geo_.width);189 layout_->SetMaximumWidth(content_geo_.width);
189 layout_->SetMaximumHeight(content_geo_.height);190 layout_->SetMaximumHeight(content_geo_.height);
190 //layout_->SetMinMaxSize(content_geo_.width, content_geo_.height);
191191
192 QueueDraw();192 QueueDraw();
193}193}
@@ -203,7 +203,7 @@
203 // already started, just reset the last known height203 // already started, just reset the last known height
204 last_known_height_ = current_height_;204 last_known_height_ = current_height_;
205 }205 }
206 206
207 timeline_need_more_draw_ = true;207 timeline_need_more_draw_ = true;
208 start_time_ = g_get_monotonic_time();208 start_time_ = g_get_monotonic_time();
209 QueueDraw();209 QueueDraw();
@@ -276,17 +276,38 @@
276 QueueDraw();276 QueueDraw();
277}277}
278278
279void View::SetHideIcon(IconHideState hide_icon)
280{
281 LOG_DEBUG(logger) << "Hide icon called";
282 if (hide_icon == icon_state_)
283 return;
284
285 icon_state_ = hide_icon;
286
287 if (icon_state_ == IconHideState::HIDE)
288 layout_->RemoveChildObject(dynamic_cast<nux::Area*>(icon_layout_.GetPointer()));
289 else
290 layout_->AddLayout(icon_layout_.GetPointer(), 0, nux::MINOR_POSITION_TOP, nux::MINOR_SIZE_MATCHCONTENT, 100.0f, nux::LayoutPosition::NUX_LAYOUT_BEGIN);
291
292 Relayout();
293}
294
279// Gives us the width and height of the contents that will give us the best "fit",295// Gives us the width and height of the contents that will give us the best "fit",
280// which means that the icons/views will not have uneccessary padding, everything will296// which means that the icons/views will not have uneccessary padding, everything will
281// look tight297// look tight
282nux::Geometry View::GetBestFitGeometry(nux::Geometry const& for_geo)298nux::Geometry View::GetBestFitGeometry(nux::Geometry const& for_geo)
283{299{
284 //FIXME - remove magic values, replace with scalable text depending on DPI 300 //FIXME - remove magic values, replace with scalable text depending on DPI
285 // requires smarter font settings really...301 // requires smarter font settings really...
286 int width, height = 0;302 int width, height = 0;
287 width = 1024;303 width = 1024;
288 height = 276;304 height = 276;
289 305
306 if (icon_state_ == IconHideState::HIDE)
307 {
308 width -= icon_layout_->GetGeometry().width;
309 }
310
290 LOG_DEBUG (logger) << "best fit is, " << width << ", " << height;311 LOG_DEBUG (logger) << "best fit is, " << width << ", " << height;
291312
292 return nux::Geometry(0, 0, width, height);313 return nux::Geometry(0, 0, width, height);
@@ -321,16 +342,16 @@
321342
322void View::SetupViews()343void View::SetupViews()
323{344{
324 nux::VLayout* super_layout = new nux::VLayout(); 345 nux::VLayout* super_layout = new nux::VLayout();
325 layout_ = new nux::HLayout();346 layout_ = new nux::HLayout();
326 { 347 {
327 // fill icon layout with icon348 // fill icon layout with icon
328 icon_ = new Icon("", icon_size, true);349 icon_ = new Icon("", icon_size, true);
329 nux::Layout* icon_layout = new nux::VLayout();350 icon_layout_ = new nux::VLayout();
330 {351 {
331 icon_layout->SetVerticalExternalMargin(icon_vertical_margin);352 icon_layout_->SetVerticalExternalMargin(icon_vertical_margin);
332 icon_layout->AddView(icon_.GetPointer(), 0, nux::MINOR_POSITION_LEFT, nux::MINOR_SIZE_FULL);353 icon_layout_->AddView(icon_.GetPointer(), 0, nux::MINOR_POSITION_LEFT, nux::MINOR_SIZE_FULL);
333 layout_->AddLayout(icon_layout, 0, nux::MINOR_POSITION_TOP, nux::MINOR_SIZE_MATCHCONTENT);354 layout_->AddLayout(icon_layout_.GetPointer(), 0, nux::MINOR_POSITION_TOP, nux::MINOR_SIZE_MATCHCONTENT);
334 }355 }
335356
336 // add padding to layout between icon and content357 // add padding to layout between icon and content
@@ -338,11 +359,11 @@
338 spacing_between_icon_and_content,359 spacing_between_icon_and_content,
339 spacing_between_icon_and_content,360 spacing_between_icon_and_content,
340 spacing_between_icon_and_content), 0);361 spacing_between_icon_and_content), 0);
341 362
342 // fill the content layout363 // fill the content layout
343 content_layout_ = new nux::VLayout();364 content_layout_ = new nux::VLayout();
344 {365 {
345 // add the top spacing 366 // add the top spacing
346 content_layout_->AddLayout(new nux::SpaceLayout(top_spacing,top_spacing,top_spacing,top_spacing), 0);367 content_layout_->AddLayout(new nux::SpaceLayout(top_spacing,top_spacing,top_spacing,top_spacing), 0);
347368
348 // add the search bar to the composite369 // add the search bar to the composite
@@ -352,7 +373,7 @@
352 search_bar_->search_changed.connect(sigc::mem_fun(this, &View::OnSearchChanged));373 search_bar_->search_changed.connect(sigc::mem_fun(this, &View::OnSearchChanged));
353 AddChild(search_bar_.GetPointer());374 AddChild(search_bar_.GetPointer());
354 content_layout_->AddView(search_bar_.GetPointer(), 0, nux::MINOR_POSITION_LEFT);375 content_layout_->AddView(search_bar_.GetPointer(), 0, nux::MINOR_POSITION_LEFT);
355 376
356 button_views_ = new nux::VLayout();377 button_views_ = new nux::VLayout();
357 button_views_->SetMaximumWidth(content_width);378 button_views_->SetMaximumWidth(content_width);
358379
@@ -365,7 +386,7 @@
365386
366 layout_->AddLayout(content_layout_.GetPointer(), 1, nux::MINOR_POSITION_TOP);387 layout_->AddLayout(content_layout_.GetPointer(), 1, nux::MINOR_POSITION_TOP);
367 }388 }
368 389
369 super_layout->AddLayout(layout_.GetPointer(), 0);390 super_layout->AddLayout(layout_.GetPointer(), 0);
370 SetLayout(super_layout);391 SetLayout(super_layout);
371}392}
@@ -422,7 +443,7 @@
422 draw_content_geo.height = current_height_;443 draw_content_geo.height = current_height_;
423444
424 renderer_.DrawInner(gfx_context, draw_content_geo, absolute_window_geometry_, window_geometry_);445 renderer_.DrawInner(gfx_context, draw_content_geo, absolute_window_geometry_, window_geometry_);
425 446
426 gfx_context.PushClippingRectangle(draw_content_geo);447 gfx_context.PushClippingRectangle(draw_content_geo);
427 if (IsFullRedraw())448 if (IsFullRedraw())
428 {449 {
@@ -440,7 +461,7 @@
440461
441 if (timeline_need_more_draw_ && !timeline_id_)462 if (timeline_need_more_draw_ && !timeline_id_)
442 {463 {
443 timeline_id_ = g_timeout_add(0, [] (gpointer data) -> gboolean 464 timeline_id_ = g_timeout_add(0, [] (gpointer data) -> gboolean
444 {465 {
445 View *self = static_cast<View*>(data);466 View *self = static_cast<View*>(data);
446 self->QueueDraw();467 self->QueueDraw();
447468
=== modified file 'plugins/unityshell/src/HudView.h'
--- plugins/unityshell/src/HudView.h 2012-03-16 22:09:15 +0000
+++ plugins/unityshell/src/HudView.h 2012-03-21 04:27:19 +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
@@ -100,10 +107,11 @@
100 nux::ObjectPtr<nux::Layout> content_layout_;107 nux::ObjectPtr<nux::Layout> content_layout_;
101 nux::ObjectPtr<nux::VLayout> button_views_;108 nux::ObjectPtr<nux::VLayout> button_views_;
102 std::list<HudButton::Ptr> buttons_;109 std::list<HudButton::Ptr> buttons_;
103 110
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 bool activated_signal_sent_;130 bool activated_signal_sent_;
122};131};
123132
124133
=== modified file 'plugins/unityshell/src/Launcher.cpp'
--- plugins/unityshell/src/Launcher.cpp 2012-03-20 10:27:41 +0000
+++ plugins/unityshell/src/Launcher.cpp 2012-03-21 04:27:19 +0000
@@ -145,8 +145,8 @@
145 , _collection_window(NULL)145 , _collection_window(NULL)
146 , _background_color(nux::color::DimGray)146 , _background_color(nux::color::DimGray)
147 , _dash_is_open(false)147 , _dash_is_open(false)
148 , _hud_is_open(false)
148{149{
149
150 _parent = parent;150 _parent = parent;
151 _active_quicklist = nullptr;151 _active_quicklist = nullptr;
152152
@@ -909,7 +909,7 @@
909 arg.saturation = 0.0;909 arg.saturation = 0.0;
910 }910 }
911911
912 if (_dash_is_open)912 if (IsOverlayOpen())
913 arg.active_arrow = icon->GetIconType() == AbstractLauncherIcon::TYPE_HOME;913 arg.active_arrow = icon->GetIconType() == AbstractLauncherIcon::TYPE_HOME;
914 else914 else
915 arg.active_arrow = icon->GetQuirk(AbstractLauncherIcon::QUIRK_ACTIVE);915 arg.active_arrow = icon->GetQuirk(AbstractLauncherIcon::QUIRK_ACTIVE);
@@ -1319,20 +1319,22 @@
1319 g_variant_get(data, UBUS_OVERLAY_FORMAT_STRING,1319 g_variant_get(data, UBUS_OVERLAY_FORMAT_STRING,
1320 &overlay_identity, &can_maximise, &overlay_monitor);1320 &overlay_identity, &can_maximise, &overlay_monitor);
13211321
13221322 std::string identity = overlay_identity.Str();
1323 if (!g_strcmp0(overlay_identity, "dash"))1323 if (overlay_monitor == monitor)
1324 {1324 {
1325 if (overlay_monitor == monitor)1325 if (identity == "dash")
1326 {1326 {
1327 LauncherModel::iterator it;
1328
1329 _dash_is_open = true;1327 _dash_is_open = true;
1330 bg_effect_helper_.enabled = true;
1331 _hide_machine->SetQuirk(LauncherHideMachine::PLACES_VISIBLE, true);1328 _hide_machine->SetQuirk(LauncherHideMachine::PLACES_VISIBLE, true);
1332 _hover_machine->SetQuirk(LauncherHoverMachine::PLACES_VISIBLE, true);1329 _hover_machine->SetQuirk(LauncherHoverMachine::PLACES_VISIBLE, true);
1330 }
1331 if (identity == "hud")
1332 {
1333 _hud_is_open = true;
1334 }
13331335
1334 DesaturateIcons();1336 bg_effect_helper_.enabled = true;
1335 }1337 DesaturateIcons();
1336 }1338 }
1337}1339}
13381340
@@ -1345,26 +1347,37 @@
1345 g_variant_get(data, UBUS_OVERLAY_FORMAT_STRING,1347 g_variant_get(data, UBUS_OVERLAY_FORMAT_STRING,
1346 &overlay_identity, &can_maximise, &overlay_monitor);1348 &overlay_identity, &can_maximise, &overlay_monitor);
13471349
1348 if (!g_strcmp0(overlay_identity, "dash"))1350 std::string identity = overlay_identity.Str();
1351 if (overlay_monitor == monitor)
1349 {1352 {
1350 if (!_dash_is_open)1353 if (identity == "dash")
1351 return;1354 {
13521355 _hide_machine->SetQuirk(LauncherHideMachine::PLACES_VISIBLE, false);
1353 LauncherModel::iterator it;1356 _hover_machine->SetQuirk(LauncherHoverMachine::PLACES_VISIBLE, false);
13541357 _dash_is_open = false;
1355 _dash_is_open = false;1358 }
1356 bg_effect_helper_.enabled = false;1359 else if (identity == "hud")
1357 _hide_machine->SetQuirk(LauncherHideMachine::PLACES_VISIBLE, false);1360 {
1358 _hover_machine->SetQuirk(LauncherHoverMachine::PLACES_VISIBLE, false);1361 _hud_is_open = false;
13591362 }
1360 // as the leave event is no more received when the place is opened1363
1361 // FIXME: remove when we change the mouse grab strategy in nux1364 // If they are both now shut, then disable the effect helper and saturate the icons.
1362 nux::Point pt = nux::GetWindowCompositor().GetMousePosition();1365 if (!_dash_is_open and !_hud_is_open)
13631366 {
1364 SetStateMouseOverLauncher(GetAbsoluteGeometry().IsInside(pt));1367 bg_effect_helper_.enabled = false;
13651368 SaturateIcons();
1366 SaturateIcons();1369 }
1367 }1370 }
1371
1372 // as the leave event is no more received when the place is opened
1373 // FIXME: remove when we change the mouse grab strategy in nux
1374 nux::Point pt = nux::GetWindowCompositor().GetMousePosition();
1375 SetStateMouseOverLauncher(GetAbsoluteGeometry().IsInside(pt));
1376}
1377
1378bool Launcher::IsOverlayOpen() const
1379{
1380 return _dash_is_open || _hud_is_open;
1368}1381}
13691382
1370void Launcher::OnActionDone(GVariant* data)1383void Launcher::OnActionDone(GVariant* data)
@@ -1451,7 +1464,7 @@
1451 self->_collection_window->PushToBack();1464 self->_collection_window->PushToBack();
1452 self->_collection_window->EnableInputWindow(false, "DNDCollectionWindow");1465 self->_collection_window->EnableInputWindow(false, "DNDCollectionWindow");
14531466
1454 if (self->_dash_is_open && !self->_hovered)1467 if (self->IsOverlayOpen() && !self->_hovered)
1455 self->DesaturateIcons();1468 self->DesaturateIcons();
14561469
1457 self->DndReset();1470 self->DndReset();
@@ -1634,7 +1647,7 @@
1634 TimeUtil::SetTimeStruct(&_times[TIME_LEAVE], &_times[TIME_ENTER], ANIM_DURATION);1647 TimeUtil::SetTimeStruct(&_times[TIME_LEAVE], &_times[TIME_ENTER], ANIM_DURATION);
1635 }1648 }
16361649
1637 if (_dash_is_open && !_hide_machine->GetQuirk(LauncherHideMachine::EXTERNAL_DND_ACTIVE))1650 if (IsOverlayOpen() && !_hide_machine->GetQuirk(LauncherHideMachine::EXTERNAL_DND_ACTIVE))
1638 {1651 {
1639 if (hovered && !_hover_machine->GetQuirk(LauncherHoverMachine::SHORTCUT_KEYS_VISIBLE))1652 if (hovered && !_hover_machine->GetQuirk(LauncherHoverMachine::SHORTCUT_KEYS_VISIBLE))
1640 SaturateIcons();1653 SaturateIcons();
@@ -1883,7 +1896,7 @@
1883 pressure_color);1896 pressure_color);
1884 }1897 }
18851898
1886 if (_dash_is_open)1899 if (IsOverlayOpen())
1887 {1900 {
1888 if (BackgroundEffectHelper::blur_type != unity::BLUR_NONE && (bkg_box.x + bkg_box.width > 0))1901 if (BackgroundEffectHelper::blur_type != unity::BLUR_NONE && (bkg_box.x + bkg_box.width > 0))
1889 {1902 {
@@ -1984,7 +1997,7 @@
1984 icon_renderer->RenderIcon(GfxContext, *rev_it, bkg_box, base);1997 icon_renderer->RenderIcon(GfxContext, *rev_it, bkg_box, base);
1985 }1998 }
19861999
1987 if (!_dash_is_open)2000 if (!IsOverlayOpen())
1988 {2001 {
1989 const double right_line_opacity = 0.15f * launcher_alpha;2002 const double right_line_opacity = 0.15f * launcher_alpha;
19902003
@@ -2604,7 +2617,7 @@
26042617
2605 _hide_machine->SetQuirk(LauncherHideMachine::EXTERNAL_DND_ACTIVE, true);2618 _hide_machine->SetQuirk(LauncherHideMachine::EXTERNAL_DND_ACTIVE, true);
26062619
2607 if (_dash_is_open)2620 if (IsOverlayOpen())
2608 SaturateIcons();2621 SaturateIcons();
26092622
2610 for (auto it : _dnd_data.Uris())2623 for (auto it : _dnd_data.Uris())
@@ -2730,7 +2743,7 @@
27302743
2731 SetMousePosition(x - parent->GetGeometry().x, y - parent->GetGeometry().y);2744 SetMousePosition(x - parent->GetGeometry().x, y - parent->GetGeometry().y);
27322745
2733 if (!_dash_is_open && _mouse_position.x == 0 && _mouse_position.y <= (_parent->GetGeometry().height - _icon_size - 2 * _space_between_icons) && !_drag_edge_touching)2746 if (!IsOverlayOpen() && _mouse_position.x == 0 && _mouse_position.y <= (_parent->GetGeometry().height - _icon_size - 2 * _space_between_icons) && !_drag_edge_touching)
2734 {2747 {
2735 if (_dnd_hovered_icon)2748 if (_dnd_hovered_icon)
2736 _dnd_hovered_icon->SendDndLeave();2749 _dnd_hovered_icon->SendDndLeave();
27372750
=== modified file 'plugins/unityshell/src/Launcher.h'
--- plugins/unityshell/src/Launcher.h 2012-03-13 02:07:54 +0000
+++ plugins/unityshell/src/Launcher.h 2012-03-21 04:27:19 +0000
@@ -268,6 +268,7 @@
268268
269 void OnOverlayHidden(GVariant* data);269 void OnOverlayHidden(GVariant* data);
270 void OnOverlayShown(GVariant* data);270 void OnOverlayShown(GVariant* data);
271 bool IsOverlayOpen() const;
271272
272 void DesaturateIcons();273 void DesaturateIcons();
273 void SaturateIcons();274 void SaturateIcons();
@@ -406,6 +407,7 @@
406 BaseTexturePtr launcher_sheen_;407 BaseTexturePtr launcher_sheen_;
407 BaseTexturePtr launcher_pressure_effect_;408 BaseTexturePtr launcher_pressure_effect_;
408 bool _dash_is_open;409 bool _dash_is_open;
410 bool _hud_is_open;
409411
410 ui::AbstractIconRenderer::Ptr icon_renderer;412 ui::AbstractIconRenderer::Ptr icon_renderer;
411 BackgroundEffectHelper bg_effect_helper_;413 BackgroundEffectHelper bg_effect_helper_;
412414
=== modified file 'plugins/unityshell/src/LauncherController.cpp'
--- plugins/unityshell/src/LauncherController.cpp 2012-03-20 02:13:17 +0000
+++ plugins/unityshell/src/LauncherController.cpp 2012-03-21 04:27:19 +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"
@@ -228,7 +229,18 @@
228 FavoriteStore::GetDefault().favorite_removed.connect(sigc::mem_fun(this, &Impl::OnFavoriteStoreFavoriteRemoved));229 FavoriteStore::GetDefault().favorite_removed.connect(sigc::mem_fun(this, &Impl::OnFavoriteStoreFavoriteRemoved));
229 FavoriteStore::GetDefault().reordered.connect(sigc::mem_fun(this, &Impl::OnFavoriteStoreReordered));230 FavoriteStore::GetDefault().reordered.connect(sigc::mem_fun(this, &Impl::OnFavoriteStoreReordered));
230231
231 RegisterIcon(AbstractLauncherIcon::Ptr(new BFBLauncherIcon()));232 LauncherHideMode hide_mode = parent_->options()->hide_mode;
233 BFBLauncherIcon* bfb = new BFBLauncherIcon(hide_mode);
234 parent_->options()->hide_mode.changed.connect([bfb](LauncherHideMode mode) {
235 bfb->SetHideMode(mode);
236 });
237 RegisterIcon(AbstractLauncherIcon::Ptr(bfb));
238
239 HudLauncherIcon* hud = new HudLauncherIcon(hide_mode);
240 parent_->options()->hide_mode.changed.connect([hud](LauncherHideMode mode) {
241 hud->SetHideMode(mode);
242 });
243 RegisterIcon(AbstractLauncherIcon::Ptr(hud));
232 desktop_icon_ = AbstractLauncherIcon::Ptr(new DesktopLauncherIcon());244 desktop_icon_ = AbstractLauncherIcon::Ptr(new DesktopLauncherIcon());
233245
234 uscreen->changed.connect(sigc::mem_fun(this, &Controller::Impl::OnScreenChanged));246 uscreen->changed.connect(sigc::mem_fun(this, &Controller::Impl::OnScreenChanged));
235247
=== 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-21 04:27:19 +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/LauncherOptions.h'
--- plugins/unityshell/src/LauncherOptions.h 2012-03-13 02:43:20 +0000
+++ plugins/unityshell/src/LauncherOptions.h 2012-03-21 04:27:19 +0000
@@ -33,42 +33,42 @@
33namespace launcher33namespace launcher
34{34{
3535
36typedef enum36enum LauncherHideMode
37{37{
38 LAUNCHER_HIDE_NEVER,38 LAUNCHER_HIDE_NEVER,
39 LAUNCHER_HIDE_AUTOHIDE,39 LAUNCHER_HIDE_AUTOHIDE,
40} LauncherHideMode;40};
4141
42typedef enum42enum LaunchAnimation
43{43{
44 LAUNCH_ANIMATION_NONE,44 LAUNCH_ANIMATION_NONE,
45 LAUNCH_ANIMATION_PULSE,45 LAUNCH_ANIMATION_PULSE,
46 LAUNCH_ANIMATION_BLINK,46 LAUNCH_ANIMATION_BLINK,
47} LaunchAnimation;47};
4848
49typedef enum49enum UrgentAnimation
50{50{
51 URGENT_ANIMATION_NONE,51 URGENT_ANIMATION_NONE,
52 URGENT_ANIMATION_PULSE,52 URGENT_ANIMATION_PULSE,
53 URGENT_ANIMATION_WIGGLE,53 URGENT_ANIMATION_WIGGLE,
54} UrgentAnimation;54};
5555
56typedef enum56enum AutoHideAnimation
57{57{
58 FADE_OR_SLIDE,58 FADE_OR_SLIDE,
59 SLIDE_ONLY,59 SLIDE_ONLY,
60 FADE_ONLY,60 FADE_ONLY,
61 FADE_AND_SLIDE,61 FADE_AND_SLIDE,
62} AutoHideAnimation;62};
6363
64typedef enum64enum BacklightMode
65{65{
66 BACKLIGHT_ALWAYS_ON,66 BACKLIGHT_ALWAYS_ON,
67 BACKLIGHT_NORMAL,67 BACKLIGHT_NORMAL,
68 BACKLIGHT_ALWAYS_OFF,68 BACKLIGHT_ALWAYS_OFF,
69 BACKLIGHT_EDGE_TOGGLE,69 BACKLIGHT_EDGE_TOGGLE,
70 BACKLIGHT_NORMAL_EDGE_TOGGLE70 BACKLIGHT_NORMAL_EDGE_TOGGLE
71} BacklightMode;71};
7272
73enum RevealTrigger73enum RevealTrigger
74{74{
7575
=== 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-21 04:27:19 +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-20 15:37:36 +0000
+++ plugins/unityshell/src/unityshell.cpp 2012-03-21 04:27:19 +0000
@@ -2521,8 +2521,11 @@
2521 break;2521 break;
2522 }2522 }
2523 case UnityshellOptions::LauncherHideMode:2523 case UnityshellOptions::LauncherHideMode:
2524 {
2524 launcher_options->hide_mode = (unity::launcher::LauncherHideMode) optionGetLauncherHideMode();2525 launcher_options->hide_mode = (unity::launcher::LauncherHideMode) optionGetLauncherHideMode();
2526 hud_controller_->SetLauncherIsLockedOut(launcher_options->hide_mode == unity::launcher::LauncherHideMode::LAUNCHER_HIDE_NEVER);
2525 break;2527 break;
2528 }
2526 case UnityshellOptions::BacklightMode:2529 case UnityshellOptions::BacklightMode:
2527 launcher_options->backlight_mode = (unity::launcher::BacklightMode) optionGetBacklightMode();2530 launcher_options->backlight_mode = (unity::launcher::BacklightMode) optionGetBacklightMode();
2528 break;2531 break;
@@ -2754,6 +2757,8 @@
27542757
2755 /* Setup Hud */2758 /* Setup Hud */
2756 hud_controller_.reset(new hud::Controller());2759 hud_controller_.reset(new hud::Controller());
2760 auto hide_mode = (unity::launcher::LauncherHideMode) optionGetLauncherHideMode();
2761 hud_controller_->SetLauncherIsLockedOut(hide_mode == unity::launcher::LauncherHideMode::LAUNCHER_HIDE_NEVER);
2757 AddChild(hud_controller_.get());2762 AddChild(hud_controller_.get());
2758 LOG_INFO(logger) << "initLauncher-hud " << timer.ElapsedSeconds() << "s";2763 LOG_INFO(logger) << "initLauncher-hud " << timer.ElapsedSeconds() << "s";
2759 2764
27602765
=== modified file 'tests/autopilot/autopilot/tests/test_hud.py'
--- tests/autopilot/autopilot/tests/test_hud.py 2012-03-20 15:15:18 +0000
+++ tests/autopilot/autopilot/tests/test_hud.py 2012-03-21 04:27:19 +0000
@@ -15,8 +15,15 @@
1515
16class HudTests(AutopilotTestCase):16class HudTests(AutopilotTestCase):
1717
18 scenarios = [
19 ('Launcher never hide', {'launcher_hide_mode': 0}),
20 ('Launcher autohide', {'launcher_hide_mode': 1}),
21 ]
22
18 def setUp(self):23 def setUp(self):
19 super(HudTests, self).setUp()24 super(HudTests, self).setUp()
25 self.set_unity_option('launcher_hide_mode', self.launcher_hide_mode)
26 sleep(0.5)
20 self.hud = self.get_hud_controller()27 self.hud = self.get_hud_controller()
2128
22 def tearDown(self):29 def tearDown(self):
@@ -54,12 +61,16 @@
54 def test_check_a_values(self):61 def test_check_a_values(self):
55 self.reveal_hud()62 self.reveal_hud()
56 self.keyboard.type('a')63 self.keyboard.type('a')
64 # Give the HUD a second to get values.
65 sleep(1)
57 self.assertThat(self.hud.num_buttons, Equals(5))66 self.assertThat(self.hud.num_buttons, Equals(5))
58 self.assertThat(self.hud.selected_button, Equals(1))67 self.assertThat(self.hud.selected_button, Equals(1))
5968
60 def test_up_down_arrows(self):69 def test_up_down_arrows(self):
61 self.reveal_hud()70 self.reveal_hud()
62 self.keyboard.type('a')71 self.keyboard.type('a')
72 # Give the HUD a second to get values.
73 sleep(1)
63 self.keyboard.press_and_release('Down')74 self.keyboard.press_and_release('Down')
64 self.assertThat(self.hud.selected_button, Equals(2))75 self.assertThat(self.hud.selected_button, Equals(2))
65 self.keyboard.press_and_release('Down')76 self.keyboard.press_and_release('Down')