Merge lp:~thumper/unity/lock-out-hud into lp:unity
- lock-out-hud
- Merge into trunk
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 |
Related bugs: |
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:/
= 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 : Posted in a previous version of this proposal | # |
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?
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(
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 : 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.
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.
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...
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 :)
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 :)
Gord Allott (gordallott) wrote : | # |
Mr Cimitan is happy with the design, so approving
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://
3) the hud icon is using two different tiles when the launcher is on (bfb-like) and the launcher is hidden (normal tile)
Andrea Cimitan (cimi) wrote : | # |
three stuffs, of course I can count. welcome back from holiday cimi.
Andrea Cimitan (cimi) wrote : | # |
updated screenshot of issue 2) http://
Didier Roche-Tolomelli (didrocks) wrote : | # |
I reverted the branch in trunk, see bug #961169
Preview Diff
1 | === modified file 'manual-tests/Hud.txt' | |||
2 | --- manual-tests/Hud.txt 2012-03-20 14:00:00 +0000 | |||
3 | +++ manual-tests/Hud.txt 2012-03-21 04:27:19 +0000 | |||
4 | @@ -56,6 +56,20 @@ | |||
5 | 56 | After pressing escape in step three, the text "test" should be removed from the hud search | 56 | After pressing escape in step three, the text "test" should be removed from the hud search |
6 | 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. |
7 | 58 | 58 | ||
8 | 59 | Hud Reveal Behaviour | ||
9 | 60 | --------- | ||
10 | 61 | This test ensures that the hud behaves correctly with a locked out launcher | ||
11 | 62 | |||
12 | 63 | #. Ensure the launchers hide mode is set to "Never" | ||
13 | 64 | #. Tap Alt | ||
14 | 65 | |||
15 | 66 | Outcome | ||
16 | 67 | The Launcher should stick be locked out. | ||
17 | 68 | The Launcher icons should be desaturated. | ||
18 | 69 | The top most Launcher icon should be an icon related the the focused window | ||
19 | 70 | The BFB should not be present | ||
20 | 71 | |||
21 | 72 | |||
22 | 59 | Hud Sending Undo | 73 | Hud Sending Undo |
23 | 60 | ---------------- | 74 | ---------------- |
24 | 61 | This test ensure that the undo action is properly handle in a text editor. | 75 | This test ensure that the undo action is properly handle in a text editor. |
25 | 62 | 76 | ||
26 | === modified file 'plugins/unityshell/src/BFBLauncherIcon.cpp' | |||
27 | --- plugins/unityshell/src/BFBLauncherIcon.cpp 2012-03-20 10:18:20 +0000 | |||
28 | +++ plugins/unityshell/src/BFBLauncherIcon.cpp 2012-03-21 04:27:19 +0000 | |||
29 | @@ -32,9 +32,10 @@ | |||
30 | 32 | 32 | ||
31 | 33 | UBusManager BFBLauncherIcon::ubus_manager_; | 33 | UBusManager BFBLauncherIcon::ubus_manager_; |
32 | 34 | 34 | ||
34 | 35 | BFBLauncherIcon::BFBLauncherIcon() | 35 | BFBLauncherIcon::BFBLauncherIcon(LauncherHideMode hide_mode) |
35 | 36 | : SimpleLauncherIcon() | 36 | : SimpleLauncherIcon() |
36 | 37 | , reader_(dash::LensDirectoryReader::GetDefault()) | 37 | , reader_(dash::LensDirectoryReader::GetDefault()) |
37 | 38 | , launcher_hide_mode_(hide_mode) | ||
38 | 38 | { | 39 | { |
39 | 39 | tooltip_text = _("Dash Home"); | 40 | tooltip_text = _("Dash Home"); |
40 | 40 | icon_name = PKGDATADIR"/launcher_bfb.png"; | 41 | icon_name = PKGDATADIR"/launcher_bfb.png"; |
41 | @@ -45,6 +46,31 @@ | |||
42 | 45 | background_color_ = nux::color::White; | 46 | background_color_ = nux::color::White; |
43 | 46 | 47 | ||
44 | 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); }); |
45 | 49 | ubus_manager_.RegisterInterest(UBUS_OVERLAY_SHOWN, sigc::bind(sigc::mem_fun(this, &BFBLauncherIcon::OnOverlayShown), true)); | ||
46 | 50 | ubus_manager_.RegisterInterest(UBUS_OVERLAY_HIDDEN, sigc::bind(sigc::mem_fun(this, &BFBLauncherIcon::OnOverlayShown), false)); | ||
47 | 51 | } | ||
48 | 52 | |||
49 | 53 | void BFBLauncherIcon::SetHideMode(LauncherHideMode hide_mode) | ||
50 | 54 | { | ||
51 | 55 | launcher_hide_mode_ = hide_mode; | ||
52 | 56 | } | ||
53 | 57 | |||
54 | 58 | void BFBLauncherIcon::OnOverlayShown(GVariant *data, bool visible) | ||
55 | 59 | { | ||
56 | 60 | unity::glib::String overlay_identity; | ||
57 | 61 | gboolean can_maximise = FALSE; | ||
58 | 62 | gint32 overlay_monitor = 0; | ||
59 | 63 | g_variant_get(data, UBUS_OVERLAY_FORMAT_STRING, | ||
60 | 64 | &overlay_identity, &can_maximise, &overlay_monitor); | ||
61 | 65 | |||
62 | 66 | |||
63 | 67 | // If the hud is open, we hide the BFB iff we have a locked launcher | ||
64 | 68 | if (!g_strcmp0(overlay_identity, "hud") && | ||
65 | 69 | launcher_hide_mode_ == LAUNCHER_HIDE_NEVER) | ||
66 | 70 | { | ||
67 | 71 | SetQuirk(QUIRK_VISIBLE, !visible); | ||
68 | 72 | EmitNeedsRedraw(); | ||
69 | 73 | } | ||
70 | 48 | } | 74 | } |
71 | 49 | 75 | ||
72 | 50 | nux::Color BFBLauncherIcon::BackgroundColor() | 76 | nux::Color BFBLauncherIcon::BackgroundColor() |
73 | 51 | 77 | ||
74 | === modified file 'plugins/unityshell/src/BFBLauncherIcon.h' | |||
75 | --- plugins/unityshell/src/BFBLauncherIcon.h 2012-02-22 08:53:20 +0000 | |||
76 | +++ plugins/unityshell/src/BFBLauncherIcon.h 2012-03-21 04:27:19 +0000 | |||
77 | @@ -24,6 +24,7 @@ | |||
78 | 24 | 24 | ||
79 | 25 | #include <UnityCore/FilesystemLenses.h> | 25 | #include <UnityCore/FilesystemLenses.h> |
80 | 26 | 26 | ||
81 | 27 | #include "LauncherOptions.h" | ||
82 | 27 | #include "UBusWrapper.h" | 28 | #include "UBusWrapper.h" |
83 | 28 | 29 | ||
84 | 29 | namespace unity | 30 | namespace unity |
85 | @@ -35,23 +36,26 @@ | |||
86 | 35 | { | 36 | { |
87 | 36 | 37 | ||
88 | 37 | public: | 38 | public: |
90 | 38 | BFBLauncherIcon(); | 39 | BFBLauncherIcon(LauncherHideMode hide_mode); |
91 | 39 | 40 | ||
92 | 40 | virtual nux::Color BackgroundColor(); | 41 | virtual nux::Color BackgroundColor(); |
93 | 41 | virtual nux::Color GlowColor(); | 42 | virtual nux::Color GlowColor(); |
94 | 42 | 43 | ||
95 | 43 | void ActivateLauncherIcon(ActionArg arg); | 44 | void ActivateLauncherIcon(ActionArg arg); |
96 | 45 | void SetHideMode(LauncherHideMode hide_mode); | ||
97 | 44 | 46 | ||
98 | 45 | protected: | 47 | protected: |
99 | 46 | std::list<DbusmenuMenuitem*> GetMenus(); | 48 | std::list<DbusmenuMenuitem*> GetMenus(); |
100 | 47 | std::string GetName() const; | 49 | std::string GetName() const; |
101 | 48 | 50 | ||
102 | 49 | private: | 51 | private: |
103 | 52 | void OnOverlayShown(GVariant *data, bool visible); | ||
104 | 50 | static void OnMenuitemActivated(DbusmenuMenuitem* item, int time, gchar* lens); | 53 | static void OnMenuitemActivated(DbusmenuMenuitem* item, int time, gchar* lens); |
105 | 51 | 54 | ||
106 | 52 | static unity::UBusManager ubus_manager_; | 55 | static unity::UBusManager ubus_manager_; |
107 | 53 | nux::Color background_color_; | 56 | nux::Color background_color_; |
108 | 54 | dash::LensDirectoryReader::Ptr reader_; | 57 | dash::LensDirectoryReader::Ptr reader_; |
109 | 58 | LauncherHideMode launcher_hide_mode_; | ||
110 | 55 | }; | 59 | }; |
111 | 56 | 60 | ||
112 | 57 | } | 61 | } |
113 | 58 | 62 | ||
114 | === modified file 'plugins/unityshell/src/HudController.cpp' | |||
115 | --- plugins/unityshell/src/HudController.cpp 2012-03-20 10:27:41 +0000 | |||
116 | +++ plugins/unityshell/src/HudController.cpp 2012-03-21 04:27:19 +0000 | |||
117 | @@ -39,7 +39,7 @@ | |||
118 | 39 | } | 39 | } |
119 | 40 | 40 | ||
120 | 41 | Controller::Controller() | 41 | Controller::Controller() |
122 | 42 | : launcher_width(66) | 42 | : launcher_width(65) |
123 | 43 | , hud_service_("com.canonical.hud", "/com/canonical/hud") | 43 | , hud_service_("com.canonical.hud", "/com/canonical/hud") |
124 | 44 | , window_(nullptr) | 44 | , window_(nullptr) |
125 | 45 | , visible_(false) | 45 | , visible_(false) |
126 | @@ -47,6 +47,7 @@ | |||
127 | 47 | , timeline_id_(0) | 47 | , timeline_id_(0) |
128 | 48 | , last_opacity_(0.0f) | 48 | , last_opacity_(0.0f) |
129 | 49 | , start_time_(0) | 49 | , start_time_(0) |
130 | 50 | , launcher_is_locked_out_(false) | ||
131 | 50 | , view_(nullptr) | 51 | , view_(nullptr) |
132 | 51 | { | 52 | { |
133 | 52 | LOG_DEBUG(logger) << "hud startup"; | 53 | LOG_DEBUG(logger) << "hud startup"; |
134 | @@ -69,6 +70,8 @@ | |||
135 | 69 | } | 70 | } |
136 | 70 | }); | 71 | }); |
137 | 71 | 72 | ||
138 | 73 | launcher_width.changed.connect([this] (int new_width) { Relayout(); }); | ||
139 | 74 | |||
140 | 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)); |
141 | 73 | 76 | ||
142 | 74 | hud_service_.queries_updated.connect(sigc::mem_fun(this, &Controller::OnQueriesFinished)); | 77 | hud_service_.queries_updated.connect(sigc::mem_fun(this, &Controller::OnQueriesFinished)); |
143 | @@ -154,17 +157,23 @@ | |||
144 | 154 | 157 | ||
145 | 155 | nux::Geometry Controller::GetIdealWindowGeometry() | 158 | nux::Geometry Controller::GetIdealWindowGeometry() |
146 | 156 | { | 159 | { |
150 | 157 | UScreen *uscreen = UScreen::GetDefault(); | 160 | UScreen *uscreen = UScreen::GetDefault(); |
151 | 158 | int primary_monitor = uscreen->GetMonitorWithMouse(); | 161 | int primary_monitor = uscreen->GetMonitorWithMouse(); |
152 | 159 | auto monitor_geo = uscreen->GetMonitorGeometry(primary_monitor); | 162 | auto monitor_geo = uscreen->GetMonitorGeometry(primary_monitor); |
153 | 160 | 163 | ||
161 | 161 | // We want to cover as much of the screen as possible to grab any mouse events outside | 164 | // We want to cover as much of the screen as possible to grab any mouse events outside |
162 | 162 | // of our window | 165 | // of our window |
163 | 163 | panel::Style &panel_style = panel::Style::Instance(); | 166 | panel::Style &panel_style = panel::Style::Instance(); |
164 | 164 | return nux::Geometry (monitor_geo.x, | 167 | nux::Geometry geo(monitor_geo.x, |
165 | 165 | monitor_geo.y + panel_style.panel_height, | 168 | monitor_geo.y + panel_style.panel_height, |
166 | 166 | monitor_geo.width, | 169 | monitor_geo.width, |
167 | 167 | monitor_geo.height - panel_style.panel_height); | 170 | monitor_geo.height - panel_style.panel_height); |
168 | 171 | if (launcher_is_locked_out_) | ||
169 | 172 | { | ||
170 | 173 | geo.x += launcher_width; | ||
171 | 174 | geo.width -= launcher_width; | ||
172 | 175 | } | ||
173 | 176 | return geo; | ||
174 | 168 | } | 177 | } |
175 | 169 | 178 | ||
176 | 170 | void Controller::Relayout(GdkScreen*screen) | 179 | void Controller::Relayout(GdkScreen*screen) |
177 | @@ -224,6 +233,16 @@ | |||
178 | 224 | return visible_; | 233 | return visible_; |
179 | 225 | } | 234 | } |
180 | 226 | 235 | ||
181 | 236 | void Controller::SetLauncherIsLockedOut(bool launcher_is_locked_out) | ||
182 | 237 | { | ||
183 | 238 | launcher_is_locked_out_ = launcher_is_locked_out; | ||
184 | 239 | if (launcher_is_locked_out_) | ||
185 | 240 | view_->SetHideIcon(IconHideState::HIDE); | ||
186 | 241 | else | ||
187 | 242 | view_->SetHideIcon(IconHideState::SHOW); | ||
188 | 243 | Relayout(); | ||
189 | 244 | } | ||
190 | 245 | |||
191 | 227 | void Controller::ShowHud() | 246 | void Controller::ShowHud() |
192 | 228 | { | 247 | { |
193 | 229 | PluginAdapter* adaptor = PluginAdapter::Default(); | 248 | PluginAdapter* adaptor = PluginAdapter::Default(); |
194 | @@ -248,6 +267,7 @@ | |||
195 | 248 | focused_app_icon_ = view_icon.Str(); | 267 | focused_app_icon_ = view_icon.Str(); |
196 | 249 | 268 | ||
197 | 250 | LOG_DEBUG(logger) << "Taking application icon: " << focused_app_icon_; | 269 | LOG_DEBUG(logger) << "Taking application icon: " << focused_app_icon_; |
198 | 270 | ubus.SendMessage(UBUS_HUD_ICON_CHANGED, g_variant_new_string(focused_app_icon_.c_str())); | ||
199 | 251 | view_->SetIcon(focused_app_icon_); | 271 | view_->SetIcon(focused_app_icon_); |
200 | 252 | 272 | ||
201 | 253 | window_->ShowWindow(true); | 273 | window_->ShowWindow(true); |
202 | @@ -275,6 +295,7 @@ | |||
203 | 275 | nux::GetWindowCompositor().SetKeyFocusArea(view_->default_focus()); | 295 | nux::GetWindowCompositor().SetKeyFocusArea(view_->default_focus()); |
204 | 276 | window_->SetEnterFocusInputArea(view_->default_focus()); | 296 | window_->SetEnterFocusInputArea(view_->default_focus()); |
205 | 277 | } | 297 | } |
206 | 298 | |||
207 | 278 | void Controller::HideHud(bool restore) | 299 | void Controller::HideHud(bool restore) |
208 | 279 | { | 300 | { |
209 | 280 | LOG_DEBUG (logger) << "hiding the hud"; | 301 | LOG_DEBUG (logger) << "hiding the hud"; |
210 | @@ -398,6 +419,7 @@ | |||
211 | 398 | { | 419 | { |
212 | 399 | LOG_DEBUG(logger) << "Selected query, " << query->formatted_text; | 420 | LOG_DEBUG(logger) << "Selected query, " << query->formatted_text; |
213 | 400 | view_->SetIcon(query->icon_name); | 421 | view_->SetIcon(query->icon_name); |
214 | 422 | ubus.SendMessage(UBUS_HUD_ICON_CHANGED, g_variant_new_string(query->icon_name.c_str())); | ||
215 | 401 | } | 423 | } |
216 | 402 | 424 | ||
217 | 403 | 425 | ||
218 | @@ -416,6 +438,7 @@ | |||
219 | 416 | 438 | ||
220 | 417 | LOG_DEBUG(logger) << "setting icon to - " << icon_name; | 439 | LOG_DEBUG(logger) << "setting icon to - " << icon_name; |
221 | 418 | view_->SetIcon(icon_name); | 440 | view_->SetIcon(icon_name); |
222 | 441 | ubus.SendMessage(UBUS_HUD_ICON_CHANGED, g_variant_new_string(icon_name.c_str())); | ||
223 | 419 | } | 442 | } |
224 | 420 | 443 | ||
225 | 421 | // Introspectable | 444 | // Introspectable |
226 | 422 | 445 | ||
227 | === modified file 'plugins/unityshell/src/HudController.h' | |||
228 | --- plugins/unityshell/src/HudController.h 2012-02-13 04:21:04 +0000 | |||
229 | +++ plugins/unityshell/src/HudController.h 2012-03-21 04:27:19 +0000 | |||
230 | @@ -54,6 +54,8 @@ | |||
231 | 54 | void ShowHud(); | 54 | void ShowHud(); |
232 | 55 | void HideHud(bool restore_focus = true); | 55 | void HideHud(bool restore_focus = true); |
233 | 56 | bool IsVisible(); | 56 | bool IsVisible(); |
234 | 57 | void SetLauncherIsLockedOut(bool launcher_is_locked_out); | ||
235 | 58 | |||
236 | 57 | protected: | 59 | protected: |
237 | 58 | std::string GetName() const; | 60 | std::string GetName() const; |
238 | 59 | void AddProperties(GVariantBuilder* builder); | 61 | void AddProperties(GVariantBuilder* builder); |
239 | @@ -99,6 +101,8 @@ | |||
240 | 99 | guint timeline_id_; | 101 | guint timeline_id_; |
241 | 100 | float last_opacity_; | 102 | float last_opacity_; |
242 | 101 | gint64 start_time_; | 103 | gint64 start_time_; |
243 | 104 | |||
244 | 105 | bool launcher_is_locked_out_; | ||
245 | 102 | 106 | ||
246 | 103 | View* view_; | 107 | View* view_; |
247 | 104 | guint ensure_id_; | 108 | guint ensure_id_; |
248 | 105 | 109 | ||
249 | === added file 'plugins/unityshell/src/HudLauncherIcon.cpp' | |||
250 | --- plugins/unityshell/src/HudLauncherIcon.cpp 1970-01-01 00:00:00 +0000 | |||
251 | +++ plugins/unityshell/src/HudLauncherIcon.cpp 2012-03-21 04:27:19 +0000 | |||
252 | @@ -0,0 +1,125 @@ | |||
253 | 1 | // -*- Mode: C++; indent-tabs-mode: nil; tab-width: 2 -*- | ||
254 | 2 | /* | ||
255 | 3 | * Copyright (C) 2012 Canonical Ltd | ||
256 | 4 | * | ||
257 | 5 | * This program is free software: you can redistribute it and/or modify | ||
258 | 6 | * it under the terms of the GNU General Public License version 3 as | ||
259 | 7 | * published by the Free Software Foundation. | ||
260 | 8 | * | ||
261 | 9 | * This program is distributed in the hope that it will be useful, | ||
262 | 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
263 | 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
264 | 12 | * GNU General Public License for more details. | ||
265 | 13 | * | ||
266 | 14 | * You should have received a copy of the GNU General Public License | ||
267 | 15 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
268 | 16 | * | ||
269 | 17 | * Authored by: Gordon Allott <gord.allott@canonical.com> | ||
270 | 18 | */ | ||
271 | 19 | |||
272 | 20 | #include "HudLauncherIcon.h" | ||
273 | 21 | #include "Launcher.h" | ||
274 | 22 | #include "UnityCore/GLibWrapper.h" | ||
275 | 23 | #include <NuxCore/Logger.h> | ||
276 | 24 | |||
277 | 25 | #include "UBusMessages.h" | ||
278 | 26 | |||
279 | 27 | #include <glib/gi18n-lib.h> | ||
280 | 28 | |||
281 | 29 | namespace unity | ||
282 | 30 | { | ||
283 | 31 | namespace launcher | ||
284 | 32 | { | ||
285 | 33 | |||
286 | 34 | namespace | ||
287 | 35 | { | ||
288 | 36 | nux::logging::Logger logger("unity.launcher.hudlaunchericon"); | ||
289 | 37 | } | ||
290 | 38 | |||
291 | 39 | UBusManager HudLauncherIcon::ubus_manager_; | ||
292 | 40 | |||
293 | 41 | HudLauncherIcon::HudLauncherIcon(LauncherHideMode hide_mode) | ||
294 | 42 | : SimpleLauncherIcon() | ||
295 | 43 | , launcher_hide_mode_(hide_mode) | ||
296 | 44 | { | ||
297 | 45 | tooltip_text = _("HUD"); | ||
298 | 46 | icon_name = PKGDATADIR"/launcher_bfb.png"; | ||
299 | 47 | SetQuirk(QUIRK_VISIBLE, false); | ||
300 | 48 | SetQuirk(QUIRK_RUNNING, false); | ||
301 | 49 | SetQuirk(QUIRK_ACTIVE, true); | ||
302 | 50 | SetIconType(TYPE_HOME); | ||
303 | 51 | |||
304 | 52 | background_color_ = nux::color::White; | ||
305 | 53 | |||
306 | 54 | ubus_manager_.RegisterInterest(UBUS_HUD_ICON_CHANGED, [&](GVariant *data) | ||
307 | 55 | { | ||
308 | 56 | std::string hud_icon_name; | ||
309 | 57 | const gchar* data_string = g_variant_get_string(data, NULL); | ||
310 | 58 | if (data_string) | ||
311 | 59 | hud_icon_name = data_string; | ||
312 | 60 | LOG_DEBUG(logger) << "Hud icon change: " << hud_icon_name; | ||
313 | 61 | if (!hud_icon_name.empty() | ||
314 | 62 | && hud_icon_name != icon_name()) | ||
315 | 63 | { | ||
316 | 64 | icon_name = hud_icon_name; | ||
317 | 65 | EmitNeedsRedraw(); | ||
318 | 66 | } | ||
319 | 67 | }); | ||
320 | 68 | |||
321 | 69 | ubus_manager_.RegisterInterest(UBUS_OVERLAY_SHOWN, sigc::bind(sigc::mem_fun(this, &HudLauncherIcon::OnOverlayShown), true)); | ||
322 | 70 | ubus_manager_.RegisterInterest(UBUS_OVERLAY_HIDDEN, sigc::bind(sigc::mem_fun(this, &HudLauncherIcon::OnOverlayShown), false)); | ||
323 | 71 | |||
324 | 72 | mouse_enter.connect([&](int m) { ubus_manager_.SendMessage(UBUS_DASH_ABOUT_TO_SHOW, NULL); }); | ||
325 | 73 | } | ||
326 | 74 | |||
327 | 75 | void HudLauncherIcon::SetHideMode(LauncherHideMode hide_mode) | ||
328 | 76 | { | ||
329 | 77 | launcher_hide_mode_ = hide_mode; | ||
330 | 78 | } | ||
331 | 79 | |||
332 | 80 | void HudLauncherIcon::OnOverlayShown(GVariant* data, bool visible) | ||
333 | 81 | { | ||
334 | 82 | unity::glib::String overlay_identity; | ||
335 | 83 | gboolean can_maximise = FALSE; | ||
336 | 84 | gint32 overlay_monitor = 0; | ||
337 | 85 | g_variant_get(data, UBUS_OVERLAY_FORMAT_STRING, | ||
338 | 86 | &overlay_identity, &can_maximise, &overlay_monitor); | ||
339 | 87 | |||
340 | 88 | // If the hud is open, we show the HUD button iff we have a locked launcher | ||
341 | 89 | if (!g_strcmp0(overlay_identity, "hud") && | ||
342 | 90 | launcher_hide_mode_ == LAUNCHER_HIDE_NEVER) | ||
343 | 91 | { | ||
344 | 92 | SetQuirk(QUIRK_VISIBLE, visible); | ||
345 | 93 | EmitNeedsRedraw(); | ||
346 | 94 | } | ||
347 | 95 | } | ||
348 | 96 | |||
349 | 97 | nux::Color HudLauncherIcon::BackgroundColor() | ||
350 | 98 | { | ||
351 | 99 | return background_color_; | ||
352 | 100 | } | ||
353 | 101 | |||
354 | 102 | nux::Color HudLauncherIcon::GlowColor() | ||
355 | 103 | { | ||
356 | 104 | return background_color_; | ||
357 | 105 | } | ||
358 | 106 | |||
359 | 107 | void HudLauncherIcon::ActivateLauncherIcon(ActionArg arg) | ||
360 | 108 | { | ||
361 | 109 | // wut? activate? noo we don't do that. | ||
362 | 110 | } | ||
363 | 111 | |||
364 | 112 | std::list<DbusmenuMenuitem*> HudLauncherIcon::GetMenus() | ||
365 | 113 | { | ||
366 | 114 | std::list<DbusmenuMenuitem*> result; | ||
367 | 115 | return result; | ||
368 | 116 | } | ||
369 | 117 | |||
370 | 118 | std::string HudLauncherIcon::GetName() const | ||
371 | 119 | { | ||
372 | 120 | return "HudLauncherIcon"; | ||
373 | 121 | } | ||
374 | 122 | |||
375 | 123 | } // namespace launcher | ||
376 | 124 | } // namespace unity | ||
377 | 125 | |||
378 | 0 | 126 | ||
379 | === added file 'plugins/unityshell/src/HudLauncherIcon.h' | |||
380 | --- plugins/unityshell/src/HudLauncherIcon.h 1970-01-01 00:00:00 +0000 | |||
381 | +++ plugins/unityshell/src/HudLauncherIcon.h 2012-03-21 04:27:19 +0000 | |||
382 | @@ -0,0 +1,60 @@ | |||
383 | 1 | // -*- Mode: C++; indent-tabs-mode: nil; tab-width: 2 -*- | ||
384 | 2 | /* | ||
385 | 3 | * Copyright (C) 2012 Canonical Ltd | ||
386 | 4 | * | ||
387 | 5 | * This program is free software: you can redistribute it and/or modify | ||
388 | 6 | * it under the terms of the GNU General Public License version 3 as | ||
389 | 7 | * published by the Free Software Foundation. | ||
390 | 8 | * | ||
391 | 9 | * This program is distributed in the hope that it will be useful, | ||
392 | 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
393 | 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
394 | 12 | * GNU General Public License for more details. | ||
395 | 13 | * | ||
396 | 14 | * You should have received a copy of the GNU General Public License | ||
397 | 15 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
398 | 16 | * | ||
399 | 17 | * Authored by: Gordon Allott <gord.allott@gmail.com> | ||
400 | 18 | */ | ||
401 | 19 | |||
402 | 20 | #ifndef UNITYSHELL_HUDLAUNCHERICON_H | ||
403 | 21 | #define UNITYSHELL_HUDLAUNCHERICON_H | ||
404 | 22 | |||
405 | 23 | #include "SimpleLauncherIcon.h" | ||
406 | 24 | |||
407 | 25 | #include "LauncherOptions.h" | ||
408 | 26 | #include "UBusWrapper.h" | ||
409 | 27 | |||
410 | 28 | namespace unity | ||
411 | 29 | { | ||
412 | 30 | namespace launcher | ||
413 | 31 | { | ||
414 | 32 | |||
415 | 33 | class HudLauncherIcon : public SimpleLauncherIcon | ||
416 | 34 | { | ||
417 | 35 | |||
418 | 36 | public: | ||
419 | 37 | HudLauncherIcon(LauncherHideMode hide_mode); | ||
420 | 38 | |||
421 | 39 | virtual nux::Color BackgroundColor(); | ||
422 | 40 | virtual nux::Color GlowColor(); | ||
423 | 41 | |||
424 | 42 | void ActivateLauncherIcon(ActionArg arg); | ||
425 | 43 | void SetHideMode(LauncherHideMode hide_mode); | ||
426 | 44 | |||
427 | 45 | protected: | ||
428 | 46 | std::list<DbusmenuMenuitem*> GetMenus(); | ||
429 | 47 | std::string GetName() const; | ||
430 | 48 | |||
431 | 49 | private: | ||
432 | 50 | void OnOverlayShown(GVariant *data, bool visible); | ||
433 | 51 | |||
434 | 52 | static unity::UBusManager ubus_manager_; | ||
435 | 53 | nux::Color background_color_; | ||
436 | 54 | LauncherHideMode launcher_hide_mode_; | ||
437 | 55 | }; | ||
438 | 56 | |||
439 | 57 | } | ||
440 | 58 | } | ||
441 | 59 | |||
442 | 60 | #endif // UNITYSHELL_HUDLAUNCHERICON_H | ||
443 | 0 | 61 | ||
444 | === modified file 'plugins/unityshell/src/HudView.cpp' | |||
445 | --- plugins/unityshell/src/HudView.cpp 2012-03-20 15:15:18 +0000 | |||
446 | +++ plugins/unityshell/src/HudView.cpp 2012-03-21 04:27:19 +0000 | |||
447 | @@ -64,10 +64,11 @@ | |||
448 | 64 | , current_height_(0) | 64 | , current_height_(0) |
449 | 65 | , timeline_need_more_draw_(false) | 65 | , timeline_need_more_draw_(false) |
450 | 66 | , selected_button_(0) | 66 | , selected_button_(0) |
451 | 67 | , icon_state_(IconHideState::SHOW) | ||
452 | 67 | , activated_signal_sent_(false) | 68 | , activated_signal_sent_(false) |
453 | 68 | { | 69 | { |
454 | 69 | renderer_.SetOwner(this); | 70 | renderer_.SetOwner(this); |
456 | 70 | renderer_.need_redraw.connect([this] () { | 71 | renderer_.need_redraw.connect([this] () { |
457 | 71 | QueueDraw(); | 72 | QueueDraw(); |
458 | 72 | }); | 73 | }); |
459 | 73 | 74 | ||
460 | @@ -79,7 +80,7 @@ | |||
461 | 79 | SetupViews(); | 80 | SetupViews(); |
462 | 80 | search_bar_->key_down.connect (sigc::mem_fun (this, &View::OnKeyDown)); | 81 | search_bar_->key_down.connect (sigc::mem_fun (this, &View::OnKeyDown)); |
463 | 81 | 82 | ||
465 | 82 | search_bar_->activated.connect ([&]() | 83 | search_bar_->activated.connect ([&]() |
466 | 83 | { | 84 | { |
467 | 84 | if (!activated_signal_sent_) | 85 | if (!activated_signal_sent_) |
468 | 85 | search_activated.emit(search_bar_->search_string); | 86 | search_activated.emit(search_bar_->search_string); |
469 | @@ -115,12 +116,12 @@ | |||
470 | 115 | { | 116 | { |
471 | 116 | (*it)->fake_focused = false; | 117 | (*it)->fake_focused = false; |
472 | 117 | } | 118 | } |
474 | 118 | } | 119 | } |
475 | 119 | } | 120 | } |
476 | 120 | }); | 121 | }); |
477 | 121 | 122 | ||
478 | 122 | mouse_down.connect(sigc::mem_fun(this, &View::OnMouseButtonDown)); | 123 | mouse_down.connect(sigc::mem_fun(this, &View::OnMouseButtonDown)); |
480 | 123 | 124 | ||
481 | 124 | Relayout(); | 125 | Relayout(); |
482 | 125 | } | 126 | } |
483 | 126 | 127 | ||
484 | @@ -143,25 +144,25 @@ | |||
485 | 143 | float progress = (diff - pause_before_grow_length) / grow_anim_length; | 144 | float progress = (diff - pause_before_grow_length) / grow_anim_length; |
486 | 144 | int last_height = last_known_height_; | 145 | int last_height = last_known_height_; |
487 | 145 | int new_height = 0; | 146 | int new_height = 0; |
489 | 146 | 147 | ||
490 | 147 | if (last_height < target_height) | 148 | if (last_height < target_height) |
491 | 148 | { | 149 | { |
492 | 149 | // grow | 150 | // grow |
493 | 150 | new_height = last_height + ((target_height - last_height) * progress); | 151 | new_height = last_height + ((target_height - last_height) * progress); |
494 | 151 | } | 152 | } |
496 | 152 | else | 153 | else |
497 | 153 | { | 154 | { |
498 | 154 | //shrink | 155 | //shrink |
499 | 155 | new_height = last_height - ((last_height - target_height) * progress); | 156 | new_height = last_height - ((last_height - target_height) * progress); |
500 | 156 | } | 157 | } |
502 | 157 | 158 | ||
503 | 158 | LOG_DEBUG(logger) << "resizing to " << target_height << " (" << new_height << ")" | 159 | LOG_DEBUG(logger) << "resizing to " << target_height << " (" << new_height << ")" |
504 | 159 | << "View height: " << GetGeometry().height; | 160 | << "View height: " << GetGeometry().height; |
505 | 160 | current_height_ = new_height; | 161 | current_height_ = new_height; |
506 | 161 | } | 162 | } |
510 | 162 | 163 | ||
511 | 163 | QueueDraw(); | 164 | QueueDraw(); |
512 | 164 | 165 | ||
513 | 165 | if (diff > grow_anim_length + pause_before_grow_length) | 166 | if (diff > grow_anim_length + pause_before_grow_length) |
514 | 166 | { | 167 | { |
515 | 167 | // ensure we are at our final location and update last known height | 168 | // ensure we are at our final location and update last known height |
516 | @@ -187,7 +188,6 @@ | |||
517 | 187 | layout_->SetMinimumWidth(content_geo_.width); | 188 | layout_->SetMinimumWidth(content_geo_.width); |
518 | 188 | layout_->SetMaximumWidth(content_geo_.width); | 189 | layout_->SetMaximumWidth(content_geo_.width); |
519 | 189 | layout_->SetMaximumHeight(content_geo_.height); | 190 | layout_->SetMaximumHeight(content_geo_.height); |
520 | 190 | //layout_->SetMinMaxSize(content_geo_.width, content_geo_.height); | ||
521 | 191 | 191 | ||
522 | 192 | QueueDraw(); | 192 | QueueDraw(); |
523 | 193 | } | 193 | } |
524 | @@ -203,7 +203,7 @@ | |||
525 | 203 | // already started, just reset the last known height | 203 | // already started, just reset the last known height |
526 | 204 | last_known_height_ = current_height_; | 204 | last_known_height_ = current_height_; |
527 | 205 | } | 205 | } |
529 | 206 | 206 | ||
530 | 207 | timeline_need_more_draw_ = true; | 207 | timeline_need_more_draw_ = true; |
531 | 208 | start_time_ = g_get_monotonic_time(); | 208 | start_time_ = g_get_monotonic_time(); |
532 | 209 | QueueDraw(); | 209 | QueueDraw(); |
533 | @@ -276,17 +276,38 @@ | |||
534 | 276 | QueueDraw(); | 276 | QueueDraw(); |
535 | 277 | } | 277 | } |
536 | 278 | 278 | ||
537 | 279 | void View::SetHideIcon(IconHideState hide_icon) | ||
538 | 280 | { | ||
539 | 281 | LOG_DEBUG(logger) << "Hide icon called"; | ||
540 | 282 | if (hide_icon == icon_state_) | ||
541 | 283 | return; | ||
542 | 284 | |||
543 | 285 | icon_state_ = hide_icon; | ||
544 | 286 | |||
545 | 287 | if (icon_state_ == IconHideState::HIDE) | ||
546 | 288 | layout_->RemoveChildObject(dynamic_cast<nux::Area*>(icon_layout_.GetPointer())); | ||
547 | 289 | else | ||
548 | 290 | layout_->AddLayout(icon_layout_.GetPointer(), 0, nux::MINOR_POSITION_TOP, nux::MINOR_SIZE_MATCHCONTENT, 100.0f, nux::LayoutPosition::NUX_LAYOUT_BEGIN); | ||
549 | 291 | |||
550 | 292 | Relayout(); | ||
551 | 293 | } | ||
552 | 294 | |||
553 | 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", |
554 | 280 | // which means that the icons/views will not have uneccessary padding, everything will | 296 | // which means that the icons/views will not have uneccessary padding, everything will |
555 | 281 | // look tight | 297 | // look tight |
556 | 282 | nux::Geometry View::GetBestFitGeometry(nux::Geometry const& for_geo) | 298 | nux::Geometry View::GetBestFitGeometry(nux::Geometry const& for_geo) |
557 | 283 | { | 299 | { |
559 | 284 | //FIXME - remove magic values, replace with scalable text depending on DPI | 300 | //FIXME - remove magic values, replace with scalable text depending on DPI |
560 | 285 | // requires smarter font settings really... | 301 | // requires smarter font settings really... |
561 | 286 | int width, height = 0; | 302 | int width, height = 0; |
562 | 287 | width = 1024; | 303 | width = 1024; |
563 | 288 | height = 276; | 304 | height = 276; |
565 | 289 | 305 | ||
566 | 306 | if (icon_state_ == IconHideState::HIDE) | ||
567 | 307 | { | ||
568 | 308 | width -= icon_layout_->GetGeometry().width; | ||
569 | 309 | } | ||
570 | 310 | |||
571 | 290 | LOG_DEBUG (logger) << "best fit is, " << width << ", " << height; | 311 | LOG_DEBUG (logger) << "best fit is, " << width << ", " << height; |
572 | 291 | 312 | ||
573 | 292 | return nux::Geometry(0, 0, width, height); | 313 | return nux::Geometry(0, 0, width, height); |
574 | @@ -321,16 +342,16 @@ | |||
575 | 321 | 342 | ||
576 | 322 | void View::SetupViews() | 343 | void View::SetupViews() |
577 | 323 | { | 344 | { |
579 | 324 | nux::VLayout* super_layout = new nux::VLayout(); | 345 | nux::VLayout* super_layout = new nux::VLayout(); |
580 | 325 | layout_ = new nux::HLayout(); | 346 | layout_ = new nux::HLayout(); |
582 | 326 | { | 347 | { |
583 | 327 | // fill icon layout with icon | 348 | // fill icon layout with icon |
584 | 328 | icon_ = new Icon("", icon_size, true); | 349 | icon_ = new Icon("", icon_size, true); |
586 | 329 | nux::Layout* icon_layout = new nux::VLayout(); | 350 | icon_layout_ = new nux::VLayout(); |
587 | 330 | { | 351 | { |
591 | 331 | icon_layout->SetVerticalExternalMargin(icon_vertical_margin); | 352 | icon_layout_->SetVerticalExternalMargin(icon_vertical_margin); |
592 | 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); |
593 | 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); |
594 | 334 | } | 355 | } |
595 | 335 | 356 | ||
596 | 336 | // add padding to layout between icon and content | 357 | // add padding to layout between icon and content |
597 | @@ -338,11 +359,11 @@ | |||
598 | 338 | spacing_between_icon_and_content, | 359 | spacing_between_icon_and_content, |
599 | 339 | spacing_between_icon_and_content, | 360 | spacing_between_icon_and_content, |
600 | 340 | spacing_between_icon_and_content), 0); | 361 | spacing_between_icon_and_content), 0); |
602 | 341 | 362 | ||
603 | 342 | // fill the content layout | 363 | // fill the content layout |
604 | 343 | content_layout_ = new nux::VLayout(); | 364 | content_layout_ = new nux::VLayout(); |
605 | 344 | { | 365 | { |
607 | 345 | // add the top spacing | 366 | // add the top spacing |
608 | 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); |
609 | 347 | 368 | ||
610 | 348 | // add the search bar to the composite | 369 | // add the search bar to the composite |
611 | @@ -352,7 +373,7 @@ | |||
612 | 352 | search_bar_->search_changed.connect(sigc::mem_fun(this, &View::OnSearchChanged)); | 373 | search_bar_->search_changed.connect(sigc::mem_fun(this, &View::OnSearchChanged)); |
613 | 353 | AddChild(search_bar_.GetPointer()); | 374 | AddChild(search_bar_.GetPointer()); |
614 | 354 | content_layout_->AddView(search_bar_.GetPointer(), 0, nux::MINOR_POSITION_LEFT); | 375 | content_layout_->AddView(search_bar_.GetPointer(), 0, nux::MINOR_POSITION_LEFT); |
616 | 355 | 376 | ||
617 | 356 | button_views_ = new nux::VLayout(); | 377 | button_views_ = new nux::VLayout(); |
618 | 357 | button_views_->SetMaximumWidth(content_width); | 378 | button_views_->SetMaximumWidth(content_width); |
619 | 358 | 379 | ||
620 | @@ -365,7 +386,7 @@ | |||
621 | 365 | 386 | ||
622 | 366 | layout_->AddLayout(content_layout_.GetPointer(), 1, nux::MINOR_POSITION_TOP); | 387 | layout_->AddLayout(content_layout_.GetPointer(), 1, nux::MINOR_POSITION_TOP); |
623 | 367 | } | 388 | } |
625 | 368 | 389 | ||
626 | 369 | super_layout->AddLayout(layout_.GetPointer(), 0); | 390 | super_layout->AddLayout(layout_.GetPointer(), 0); |
627 | 370 | SetLayout(super_layout); | 391 | SetLayout(super_layout); |
628 | 371 | } | 392 | } |
629 | @@ -422,7 +443,7 @@ | |||
630 | 422 | draw_content_geo.height = current_height_; | 443 | draw_content_geo.height = current_height_; |
631 | 423 | 444 | ||
632 | 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_); |
634 | 425 | 446 | ||
635 | 426 | gfx_context.PushClippingRectangle(draw_content_geo); | 447 | gfx_context.PushClippingRectangle(draw_content_geo); |
636 | 427 | if (IsFullRedraw()) | 448 | if (IsFullRedraw()) |
637 | 428 | { | 449 | { |
638 | @@ -440,7 +461,7 @@ | |||
639 | 440 | 461 | ||
640 | 441 | if (timeline_need_more_draw_ && !timeline_id_) | 462 | if (timeline_need_more_draw_ && !timeline_id_) |
641 | 442 | { | 463 | { |
643 | 443 | timeline_id_ = g_timeout_add(0, [] (gpointer data) -> gboolean | 464 | timeline_id_ = g_timeout_add(0, [] (gpointer data) -> gboolean |
644 | 444 | { | 465 | { |
645 | 445 | View *self = static_cast<View*>(data); | 466 | View *self = static_cast<View*>(data); |
646 | 446 | self->QueueDraw(); | 467 | self->QueueDraw(); |
647 | 447 | 468 | ||
648 | === modified file 'plugins/unityshell/src/HudView.h' | |||
649 | --- plugins/unityshell/src/HudView.h 2012-03-16 22:09:15 +0000 | |||
650 | +++ plugins/unityshell/src/HudView.h 2012-03-21 04:27:19 +0000 | |||
651 | @@ -44,6 +44,12 @@ | |||
652 | 44 | namespace hud | 44 | namespace hud |
653 | 45 | { | 45 | { |
654 | 46 | 46 | ||
655 | 47 | enum IconHideState | ||
656 | 48 | { | ||
657 | 49 | HIDE, | ||
658 | 50 | SHOW | ||
659 | 51 | }; | ||
660 | 52 | |||
661 | 47 | class View : public nux::View, public unity::debug::Introspectable | 53 | class View : public nux::View, public unity::debug::Introspectable |
662 | 48 | { | 54 | { |
663 | 49 | NUX_DECLARE_OBJECT_TYPE(HudView, nux::View); | 55 | NUX_DECLARE_OBJECT_TYPE(HudView, nux::View); |
664 | @@ -59,7 +65,8 @@ | |||
665 | 59 | 65 | ||
666 | 60 | void SetQueries(Hud::Queries queries); | 66 | void SetQueries(Hud::Queries queries); |
667 | 61 | void SetIcon(std::string icon_name); | 67 | void SetIcon(std::string icon_name); |
669 | 62 | 68 | void SetHideIcon(IconHideState hide_icon); | |
670 | 69 | |||
671 | 63 | void AboutToShow(); | 70 | void AboutToShow(); |
672 | 64 | void AboutToHide(); | 71 | void AboutToHide(); |
673 | 65 | 72 | ||
674 | @@ -100,10 +107,11 @@ | |||
675 | 100 | nux::ObjectPtr<nux::Layout> content_layout_; | 107 | nux::ObjectPtr<nux::Layout> content_layout_; |
676 | 101 | nux::ObjectPtr<nux::VLayout> button_views_; | 108 | nux::ObjectPtr<nux::VLayout> button_views_; |
677 | 102 | std::list<HudButton::Ptr> buttons_; | 109 | std::list<HudButton::Ptr> buttons_; |
679 | 103 | 110 | ||
680 | 104 | //FIXME - replace with dash search bar once modifications to dash search bar land | 111 | //FIXME - replace with dash search bar once modifications to dash search bar land |
681 | 105 | SearchBar::Ptr search_bar_; | 112 | SearchBar::Ptr search_bar_; |
682 | 106 | Icon::Ptr icon_; | 113 | Icon::Ptr icon_; |
683 | 114 | nux::ObjectPtr<nux::Layout> icon_layout_; | ||
684 | 107 | bool visible_; | 115 | bool visible_; |
685 | 108 | 116 | ||
686 | 109 | Hud::Queries queries_; | 117 | Hud::Queries queries_; |
687 | @@ -118,6 +126,7 @@ | |||
688 | 118 | int current_height_; | 126 | int current_height_; |
689 | 119 | bool timeline_need_more_draw_; | 127 | bool timeline_need_more_draw_; |
690 | 120 | int selected_button_; | 128 | int selected_button_; |
691 | 129 | IconHideState icon_state_; | ||
692 | 121 | bool activated_signal_sent_; | 130 | bool activated_signal_sent_; |
693 | 122 | }; | 131 | }; |
694 | 123 | 132 | ||
695 | 124 | 133 | ||
696 | === modified file 'plugins/unityshell/src/Launcher.cpp' | |||
697 | --- plugins/unityshell/src/Launcher.cpp 2012-03-20 10:27:41 +0000 | |||
698 | +++ plugins/unityshell/src/Launcher.cpp 2012-03-21 04:27:19 +0000 | |||
699 | @@ -145,8 +145,8 @@ | |||
700 | 145 | , _collection_window(NULL) | 145 | , _collection_window(NULL) |
701 | 146 | , _background_color(nux::color::DimGray) | 146 | , _background_color(nux::color::DimGray) |
702 | 147 | , _dash_is_open(false) | 147 | , _dash_is_open(false) |
703 | 148 | , _hud_is_open(false) | ||
704 | 148 | { | 149 | { |
705 | 149 | |||
706 | 150 | _parent = parent; | 150 | _parent = parent; |
707 | 151 | _active_quicklist = nullptr; | 151 | _active_quicklist = nullptr; |
708 | 152 | 152 | ||
709 | @@ -909,7 +909,7 @@ | |||
710 | 909 | arg.saturation = 0.0; | 909 | arg.saturation = 0.0; |
711 | 910 | } | 910 | } |
712 | 911 | 911 | ||
714 | 912 | if (_dash_is_open) | 912 | if (IsOverlayOpen()) |
715 | 913 | arg.active_arrow = icon->GetIconType() == AbstractLauncherIcon::TYPE_HOME; | 913 | arg.active_arrow = icon->GetIconType() == AbstractLauncherIcon::TYPE_HOME; |
716 | 914 | else | 914 | else |
717 | 915 | arg.active_arrow = icon->GetQuirk(AbstractLauncherIcon::QUIRK_ACTIVE); | 915 | arg.active_arrow = icon->GetQuirk(AbstractLauncherIcon::QUIRK_ACTIVE); |
718 | @@ -1319,20 +1319,22 @@ | |||
719 | 1319 | g_variant_get(data, UBUS_OVERLAY_FORMAT_STRING, | 1319 | g_variant_get(data, UBUS_OVERLAY_FORMAT_STRING, |
720 | 1320 | &overlay_identity, &can_maximise, &overlay_monitor); | 1320 | &overlay_identity, &can_maximise, &overlay_monitor); |
721 | 1321 | 1321 | ||
724 | 1322 | 1322 | std::string identity = overlay_identity.Str(); | |
725 | 1323 | if (!g_strcmp0(overlay_identity, "dash")) | 1323 | if (overlay_monitor == monitor) |
726 | 1324 | { | 1324 | { |
728 | 1325 | if (overlay_monitor == monitor) | 1325 | if (identity == "dash") |
729 | 1326 | { | 1326 | { |
730 | 1327 | LauncherModel::iterator it; | ||
731 | 1328 | |||
732 | 1329 | _dash_is_open = true; | 1327 | _dash_is_open = true; |
733 | 1330 | bg_effect_helper_.enabled = true; | ||
734 | 1331 | _hide_machine->SetQuirk(LauncherHideMachine::PLACES_VISIBLE, true); | 1328 | _hide_machine->SetQuirk(LauncherHideMachine::PLACES_VISIBLE, true); |
735 | 1332 | _hover_machine->SetQuirk(LauncherHoverMachine::PLACES_VISIBLE, true); | 1329 | _hover_machine->SetQuirk(LauncherHoverMachine::PLACES_VISIBLE, true); |
736 | 1330 | } | ||
737 | 1331 | if (identity == "hud") | ||
738 | 1332 | { | ||
739 | 1333 | _hud_is_open = true; | ||
740 | 1334 | } | ||
741 | 1333 | 1335 | ||
744 | 1334 | DesaturateIcons(); | 1336 | bg_effect_helper_.enabled = true; |
745 | 1335 | } | 1337 | DesaturateIcons(); |
746 | 1336 | } | 1338 | } |
747 | 1337 | } | 1339 | } |
748 | 1338 | 1340 | ||
749 | @@ -1345,26 +1347,37 @@ | |||
750 | 1345 | g_variant_get(data, UBUS_OVERLAY_FORMAT_STRING, | 1347 | g_variant_get(data, UBUS_OVERLAY_FORMAT_STRING, |
751 | 1346 | &overlay_identity, &can_maximise, &overlay_monitor); | 1348 | &overlay_identity, &can_maximise, &overlay_monitor); |
752 | 1347 | 1349 | ||
754 | 1348 | if (!g_strcmp0(overlay_identity, "dash")) | 1350 | std::string identity = overlay_identity.Str(); |
755 | 1351 | if (overlay_monitor == monitor) | ||
756 | 1349 | { | 1352 | { |
774 | 1350 | if (!_dash_is_open) | 1353 | if (identity == "dash") |
775 | 1351 | return; | 1354 | { |
776 | 1352 | 1355 | _hide_machine->SetQuirk(LauncherHideMachine::PLACES_VISIBLE, false); | |
777 | 1353 | LauncherModel::iterator it; | 1356 | _hover_machine->SetQuirk(LauncherHoverMachine::PLACES_VISIBLE, false); |
778 | 1354 | 1357 | _dash_is_open = false; | |
779 | 1355 | _dash_is_open = false; | 1358 | } |
780 | 1356 | bg_effect_helper_.enabled = false; | 1359 | else if (identity == "hud") |
781 | 1357 | _hide_machine->SetQuirk(LauncherHideMachine::PLACES_VISIBLE, false); | 1360 | { |
782 | 1358 | _hover_machine->SetQuirk(LauncherHoverMachine::PLACES_VISIBLE, false); | 1361 | _hud_is_open = false; |
783 | 1359 | 1362 | } | |
784 | 1360 | // as the leave event is no more received when the place is opened | 1363 | |
785 | 1361 | // FIXME: remove when we change the mouse grab strategy in nux | 1364 | // If they are both now shut, then disable the effect helper and saturate the icons. |
786 | 1362 | nux::Point pt = nux::GetWindowCompositor().GetMousePosition(); | 1365 | if (!_dash_is_open and !_hud_is_open) |
787 | 1363 | 1366 | { | |
788 | 1364 | SetStateMouseOverLauncher(GetAbsoluteGeometry().IsInside(pt)); | 1367 | bg_effect_helper_.enabled = false; |
789 | 1365 | 1368 | SaturateIcons(); | |
790 | 1366 | SaturateIcons(); | 1369 | } |
791 | 1367 | } | 1370 | } |
792 | 1371 | |||
793 | 1372 | // as the leave event is no more received when the place is opened | ||
794 | 1373 | // FIXME: remove when we change the mouse grab strategy in nux | ||
795 | 1374 | nux::Point pt = nux::GetWindowCompositor().GetMousePosition(); | ||
796 | 1375 | SetStateMouseOverLauncher(GetAbsoluteGeometry().IsInside(pt)); | ||
797 | 1376 | } | ||
798 | 1377 | |||
799 | 1378 | bool Launcher::IsOverlayOpen() const | ||
800 | 1379 | { | ||
801 | 1380 | return _dash_is_open || _hud_is_open; | ||
802 | 1368 | } | 1381 | } |
803 | 1369 | 1382 | ||
804 | 1370 | void Launcher::OnActionDone(GVariant* data) | 1383 | void Launcher::OnActionDone(GVariant* data) |
805 | @@ -1451,7 +1464,7 @@ | |||
806 | 1451 | self->_collection_window->PushToBack(); | 1464 | self->_collection_window->PushToBack(); |
807 | 1452 | self->_collection_window->EnableInputWindow(false, "DNDCollectionWindow"); | 1465 | self->_collection_window->EnableInputWindow(false, "DNDCollectionWindow"); |
808 | 1453 | 1466 | ||
810 | 1454 | if (self->_dash_is_open && !self->_hovered) | 1467 | if (self->IsOverlayOpen() && !self->_hovered) |
811 | 1455 | self->DesaturateIcons(); | 1468 | self->DesaturateIcons(); |
812 | 1456 | 1469 | ||
813 | 1457 | self->DndReset(); | 1470 | self->DndReset(); |
814 | @@ -1634,7 +1647,7 @@ | |||
815 | 1634 | TimeUtil::SetTimeStruct(&_times[TIME_LEAVE], &_times[TIME_ENTER], ANIM_DURATION); | 1647 | TimeUtil::SetTimeStruct(&_times[TIME_LEAVE], &_times[TIME_ENTER], ANIM_DURATION); |
816 | 1635 | } | 1648 | } |
817 | 1636 | 1649 | ||
819 | 1637 | if (_dash_is_open && !_hide_machine->GetQuirk(LauncherHideMachine::EXTERNAL_DND_ACTIVE)) | 1650 | if (IsOverlayOpen() && !_hide_machine->GetQuirk(LauncherHideMachine::EXTERNAL_DND_ACTIVE)) |
820 | 1638 | { | 1651 | { |
821 | 1639 | if (hovered && !_hover_machine->GetQuirk(LauncherHoverMachine::SHORTCUT_KEYS_VISIBLE)) | 1652 | if (hovered && !_hover_machine->GetQuirk(LauncherHoverMachine::SHORTCUT_KEYS_VISIBLE)) |
822 | 1640 | SaturateIcons(); | 1653 | SaturateIcons(); |
823 | @@ -1883,7 +1896,7 @@ | |||
824 | 1883 | pressure_color); | 1896 | pressure_color); |
825 | 1884 | } | 1897 | } |
826 | 1885 | 1898 | ||
828 | 1886 | if (_dash_is_open) | 1899 | if (IsOverlayOpen()) |
829 | 1887 | { | 1900 | { |
830 | 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)) |
831 | 1889 | { | 1902 | { |
832 | @@ -1984,7 +1997,7 @@ | |||
833 | 1984 | icon_renderer->RenderIcon(GfxContext, *rev_it, bkg_box, base); | 1997 | icon_renderer->RenderIcon(GfxContext, *rev_it, bkg_box, base); |
834 | 1985 | } | 1998 | } |
835 | 1986 | 1999 | ||
837 | 1987 | if (!_dash_is_open) | 2000 | if (!IsOverlayOpen()) |
838 | 1988 | { | 2001 | { |
839 | 1989 | const double right_line_opacity = 0.15f * launcher_alpha; | 2002 | const double right_line_opacity = 0.15f * launcher_alpha; |
840 | 1990 | 2003 | ||
841 | @@ -2604,7 +2617,7 @@ | |||
842 | 2604 | 2617 | ||
843 | 2605 | _hide_machine->SetQuirk(LauncherHideMachine::EXTERNAL_DND_ACTIVE, true); | 2618 | _hide_machine->SetQuirk(LauncherHideMachine::EXTERNAL_DND_ACTIVE, true); |
844 | 2606 | 2619 | ||
846 | 2607 | if (_dash_is_open) | 2620 | if (IsOverlayOpen()) |
847 | 2608 | SaturateIcons(); | 2621 | SaturateIcons(); |
848 | 2609 | 2622 | ||
849 | 2610 | for (auto it : _dnd_data.Uris()) | 2623 | for (auto it : _dnd_data.Uris()) |
850 | @@ -2730,7 +2743,7 @@ | |||
851 | 2730 | 2743 | ||
852 | 2731 | SetMousePosition(x - parent->GetGeometry().x, y - parent->GetGeometry().y); | 2744 | SetMousePosition(x - parent->GetGeometry().x, y - parent->GetGeometry().y); |
853 | 2732 | 2745 | ||
855 | 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) |
856 | 2734 | { | 2747 | { |
857 | 2735 | if (_dnd_hovered_icon) | 2748 | if (_dnd_hovered_icon) |
858 | 2736 | _dnd_hovered_icon->SendDndLeave(); | 2749 | _dnd_hovered_icon->SendDndLeave(); |
859 | 2737 | 2750 | ||
860 | === modified file 'plugins/unityshell/src/Launcher.h' | |||
861 | --- plugins/unityshell/src/Launcher.h 2012-03-13 02:07:54 +0000 | |||
862 | +++ plugins/unityshell/src/Launcher.h 2012-03-21 04:27:19 +0000 | |||
863 | @@ -268,6 +268,7 @@ | |||
864 | 268 | 268 | ||
865 | 269 | void OnOverlayHidden(GVariant* data); | 269 | void OnOverlayHidden(GVariant* data); |
866 | 270 | void OnOverlayShown(GVariant* data); | 270 | void OnOverlayShown(GVariant* data); |
867 | 271 | bool IsOverlayOpen() const; | ||
868 | 271 | 272 | ||
869 | 272 | void DesaturateIcons(); | 273 | void DesaturateIcons(); |
870 | 273 | void SaturateIcons(); | 274 | void SaturateIcons(); |
871 | @@ -406,6 +407,7 @@ | |||
872 | 406 | BaseTexturePtr launcher_sheen_; | 407 | BaseTexturePtr launcher_sheen_; |
873 | 407 | BaseTexturePtr launcher_pressure_effect_; | 408 | BaseTexturePtr launcher_pressure_effect_; |
874 | 408 | bool _dash_is_open; | 409 | bool _dash_is_open; |
875 | 410 | bool _hud_is_open; | ||
876 | 409 | 411 | ||
877 | 410 | ui::AbstractIconRenderer::Ptr icon_renderer; | 412 | ui::AbstractIconRenderer::Ptr icon_renderer; |
878 | 411 | BackgroundEffectHelper bg_effect_helper_; | 413 | BackgroundEffectHelper bg_effect_helper_; |
879 | 412 | 414 | ||
880 | === modified file 'plugins/unityshell/src/LauncherController.cpp' | |||
881 | --- plugins/unityshell/src/LauncherController.cpp 2012-03-20 02:13:17 +0000 | |||
882 | +++ plugins/unityshell/src/LauncherController.cpp 2012-03-21 04:27:19 +0000 | |||
883 | @@ -32,6 +32,7 @@ | |||
884 | 32 | #include "DeviceLauncherIcon.h" | 32 | #include "DeviceLauncherIcon.h" |
885 | 33 | #include "DeviceLauncherSection.h" | 33 | #include "DeviceLauncherSection.h" |
886 | 34 | #include "FavoriteStore.h" | 34 | #include "FavoriteStore.h" |
887 | 35 | #include "HudLauncherIcon.h" | ||
888 | 35 | #include "Launcher.h" | 36 | #include "Launcher.h" |
889 | 36 | #include "LauncherController.h" | 37 | #include "LauncherController.h" |
890 | 37 | #include "LauncherEntryRemote.h" | 38 | #include "LauncherEntryRemote.h" |
891 | @@ -228,7 +229,18 @@ | |||
892 | 228 | FavoriteStore::GetDefault().favorite_removed.connect(sigc::mem_fun(this, &Impl::OnFavoriteStoreFavoriteRemoved)); | 229 | FavoriteStore::GetDefault().favorite_removed.connect(sigc::mem_fun(this, &Impl::OnFavoriteStoreFavoriteRemoved)); |
893 | 229 | FavoriteStore::GetDefault().reordered.connect(sigc::mem_fun(this, &Impl::OnFavoriteStoreReordered)); | 230 | FavoriteStore::GetDefault().reordered.connect(sigc::mem_fun(this, &Impl::OnFavoriteStoreReordered)); |
894 | 230 | 231 | ||
896 | 231 | RegisterIcon(AbstractLauncherIcon::Ptr(new BFBLauncherIcon())); | 232 | LauncherHideMode hide_mode = parent_->options()->hide_mode; |
897 | 233 | BFBLauncherIcon* bfb = new BFBLauncherIcon(hide_mode); | ||
898 | 234 | parent_->options()->hide_mode.changed.connect([bfb](LauncherHideMode mode) { | ||
899 | 235 | bfb->SetHideMode(mode); | ||
900 | 236 | }); | ||
901 | 237 | RegisterIcon(AbstractLauncherIcon::Ptr(bfb)); | ||
902 | 238 | |||
903 | 239 | HudLauncherIcon* hud = new HudLauncherIcon(hide_mode); | ||
904 | 240 | parent_->options()->hide_mode.changed.connect([hud](LauncherHideMode mode) { | ||
905 | 241 | hud->SetHideMode(mode); | ||
906 | 242 | }); | ||
907 | 243 | RegisterIcon(AbstractLauncherIcon::Ptr(hud)); | ||
908 | 232 | desktop_icon_ = AbstractLauncherIcon::Ptr(new DesktopLauncherIcon()); | 244 | desktop_icon_ = AbstractLauncherIcon::Ptr(new DesktopLauncherIcon()); |
909 | 233 | 245 | ||
910 | 234 | uscreen->changed.connect(sigc::mem_fun(this, &Controller::Impl::OnScreenChanged)); | 246 | uscreen->changed.connect(sigc::mem_fun(this, &Controller::Impl::OnScreenChanged)); |
911 | 235 | 247 | ||
912 | === modified file 'plugins/unityshell/src/LauncherHideMachine.cpp' | |||
913 | --- plugins/unityshell/src/LauncherHideMachine.cpp 2012-02-08 16:43:47 +0000 | |||
914 | +++ plugins/unityshell/src/LauncherHideMachine.cpp 2012-03-21 04:27:19 +0000 | |||
915 | @@ -134,19 +134,19 @@ | |||
916 | 134 | { | 134 | { |
917 | 135 | bool should_hide; | 135 | bool should_hide; |
918 | 136 | 136 | ||
920 | 137 | // early check to see if we are locking to hidden | 137 | if (_mode == HIDE_NEVER) |
921 | 138 | { | ||
922 | 139 | SetShouldHide(false, skip_delay); | ||
923 | 140 | return; | ||
924 | 141 | } | ||
925 | 142 | |||
926 | 143 | // early check to see if we are locking to hidden - but only if we are in non HIDE_NEVER | ||
927 | 138 | if (GetQuirk(LOCK_HIDE)) | 144 | if (GetQuirk(LOCK_HIDE)) |
928 | 139 | { | 145 | { |
929 | 140 | SetShouldHide(true, true); | 146 | SetShouldHide(true, true); |
930 | 141 | return; | 147 | return; |
931 | 142 | } | 148 | } |
932 | 143 | 149 | ||
933 | 144 | if (_mode == HIDE_NEVER) | ||
934 | 145 | { | ||
935 | 146 | SetShouldHide(false, skip_delay); | ||
936 | 147 | return; | ||
937 | 148 | } | ||
938 | 149 | |||
939 | 150 | do | 150 | do |
940 | 151 | { | 151 | { |
941 | 152 | // first we check the condition where external DND is active and the push off has happened | 152 | // first we check the condition where external DND is active and the push off has happened |
942 | 153 | 153 | ||
943 | === modified file 'plugins/unityshell/src/LauncherOptions.h' | |||
944 | --- plugins/unityshell/src/LauncherOptions.h 2012-03-13 02:43:20 +0000 | |||
945 | +++ plugins/unityshell/src/LauncherOptions.h 2012-03-21 04:27:19 +0000 | |||
946 | @@ -33,42 +33,42 @@ | |||
947 | 33 | namespace launcher | 33 | namespace launcher |
948 | 34 | { | 34 | { |
949 | 35 | 35 | ||
951 | 36 | typedef enum | 36 | enum LauncherHideMode |
952 | 37 | { | 37 | { |
953 | 38 | LAUNCHER_HIDE_NEVER, | 38 | LAUNCHER_HIDE_NEVER, |
954 | 39 | LAUNCHER_HIDE_AUTOHIDE, | 39 | LAUNCHER_HIDE_AUTOHIDE, |
956 | 40 | } LauncherHideMode; | 40 | }; |
957 | 41 | 41 | ||
959 | 42 | typedef enum | 42 | enum LaunchAnimation |
960 | 43 | { | 43 | { |
961 | 44 | LAUNCH_ANIMATION_NONE, | 44 | LAUNCH_ANIMATION_NONE, |
962 | 45 | LAUNCH_ANIMATION_PULSE, | 45 | LAUNCH_ANIMATION_PULSE, |
963 | 46 | LAUNCH_ANIMATION_BLINK, | 46 | LAUNCH_ANIMATION_BLINK, |
965 | 47 | } LaunchAnimation; | 47 | }; |
966 | 48 | 48 | ||
968 | 49 | typedef enum | 49 | enum UrgentAnimation |
969 | 50 | { | 50 | { |
970 | 51 | URGENT_ANIMATION_NONE, | 51 | URGENT_ANIMATION_NONE, |
971 | 52 | URGENT_ANIMATION_PULSE, | 52 | URGENT_ANIMATION_PULSE, |
972 | 53 | URGENT_ANIMATION_WIGGLE, | 53 | URGENT_ANIMATION_WIGGLE, |
974 | 54 | } UrgentAnimation; | 54 | }; |
975 | 55 | 55 | ||
977 | 56 | typedef enum | 56 | enum AutoHideAnimation |
978 | 57 | { | 57 | { |
979 | 58 | FADE_OR_SLIDE, | 58 | FADE_OR_SLIDE, |
980 | 59 | SLIDE_ONLY, | 59 | SLIDE_ONLY, |
981 | 60 | FADE_ONLY, | 60 | FADE_ONLY, |
982 | 61 | FADE_AND_SLIDE, | 61 | FADE_AND_SLIDE, |
984 | 62 | } AutoHideAnimation; | 62 | }; |
985 | 63 | 63 | ||
987 | 64 | typedef enum | 64 | enum BacklightMode |
988 | 65 | { | 65 | { |
989 | 66 | BACKLIGHT_ALWAYS_ON, | 66 | BACKLIGHT_ALWAYS_ON, |
990 | 67 | BACKLIGHT_NORMAL, | 67 | BACKLIGHT_NORMAL, |
991 | 68 | BACKLIGHT_ALWAYS_OFF, | 68 | BACKLIGHT_ALWAYS_OFF, |
992 | 69 | BACKLIGHT_EDGE_TOGGLE, | 69 | BACKLIGHT_EDGE_TOGGLE, |
993 | 70 | BACKLIGHT_NORMAL_EDGE_TOGGLE | 70 | BACKLIGHT_NORMAL_EDGE_TOGGLE |
995 | 71 | } BacklightMode; | 71 | }; |
996 | 72 | 72 | ||
997 | 73 | enum RevealTrigger | 73 | enum RevealTrigger |
998 | 74 | { | 74 | { |
999 | 75 | 75 | ||
1000 | === modified file 'plugins/unityshell/src/UBusMessages.h' | |||
1001 | --- plugins/unityshell/src/UBusMessages.h 2012-02-07 07:42:12 +0000 | |||
1002 | +++ plugins/unityshell/src/UBusMessages.h 2012-03-21 04:27:19 +0000 | |||
1003 | @@ -64,6 +64,9 @@ | |||
1004 | 64 | // Signal to force the launcher into locked mode, (b) | 64 | // Signal to force the launcher into locked mode, (b) |
1005 | 65 | #define UBUS_LAUNCHER_LOCK_HIDE "LAUNCHER_LOCK_HIDE" | 65 | #define UBUS_LAUNCHER_LOCK_HIDE "LAUNCHER_LOCK_HIDE" |
1006 | 66 | 66 | ||
1007 | 67 | // Signal to emit changes to the launcher hide mode behaviour (b), true = locked out, false = unlocked | ||
1008 | 68 | #define UBUS_LAUNCHER_HIDE_MODE_CHANGE "LAUNCHER_HIDE_MODE_CHANGE" | ||
1009 | 69 | |||
1010 | 67 | // Signal sent when a quicklist is shown. | 70 | // Signal sent when a quicklist is shown. |
1011 | 68 | #define UBUS_QUICKLIST_SHOWN "QUICKLIST_SHOWN" | 71 | #define UBUS_QUICKLIST_SHOWN "QUICKLIST_SHOWN" |
1012 | 69 | 72 | ||
1013 | @@ -78,6 +81,8 @@ | |||
1014 | 78 | // FIXME - fix the nux focus api so we don't need this | 81 | // FIXME - fix the nux focus api so we don't need this |
1015 | 79 | #define UBUS_RESULT_VIEW_KEYNAV_CHANGED "RESULT_VIEW_KEYNAV_CHANGED" | 82 | #define UBUS_RESULT_VIEW_KEYNAV_CHANGED "RESULT_VIEW_KEYNAV_CHANGED" |
1016 | 80 | 83 | ||
1017 | 84 | // Sends a string datatype containing the new icon name | ||
1018 | 85 | #define UBUS_HUD_ICON_CHANGED "HUD_ICON_CHANGED" | ||
1019 | 81 | #define UBUS_HUD_CLOSE_REQUEST "HUD_CLOSE_REQUEST" | 86 | #define UBUS_HUD_CLOSE_REQUEST "HUD_CLOSE_REQUEST" |
1020 | 82 | 87 | ||
1021 | 83 | // Signals sent when the switcher is shown, hidden or changes selection | 88 | // Signals sent when the switcher is shown, hidden or changes selection |
1022 | 84 | 89 | ||
1023 | === modified file 'plugins/unityshell/src/unityshell.cpp' | |||
1024 | --- plugins/unityshell/src/unityshell.cpp 2012-03-20 15:37:36 +0000 | |||
1025 | +++ plugins/unityshell/src/unityshell.cpp 2012-03-21 04:27:19 +0000 | |||
1026 | @@ -2521,8 +2521,11 @@ | |||
1027 | 2521 | break; | 2521 | break; |
1028 | 2522 | } | 2522 | } |
1029 | 2523 | case UnityshellOptions::LauncherHideMode: | 2523 | case UnityshellOptions::LauncherHideMode: |
1030 | 2524 | { | ||
1031 | 2524 | launcher_options->hide_mode = (unity::launcher::LauncherHideMode) optionGetLauncherHideMode(); | 2525 | launcher_options->hide_mode = (unity::launcher::LauncherHideMode) optionGetLauncherHideMode(); |
1032 | 2526 | hud_controller_->SetLauncherIsLockedOut(launcher_options->hide_mode == unity::launcher::LauncherHideMode::LAUNCHER_HIDE_NEVER); | ||
1033 | 2525 | break; | 2527 | break; |
1034 | 2528 | } | ||
1035 | 2526 | case UnityshellOptions::BacklightMode: | 2529 | case UnityshellOptions::BacklightMode: |
1036 | 2527 | launcher_options->backlight_mode = (unity::launcher::BacklightMode) optionGetBacklightMode(); | 2530 | launcher_options->backlight_mode = (unity::launcher::BacklightMode) optionGetBacklightMode(); |
1037 | 2528 | break; | 2531 | break; |
1038 | @@ -2754,6 +2757,8 @@ | |||
1039 | 2754 | 2757 | ||
1040 | 2755 | /* Setup Hud */ | 2758 | /* Setup Hud */ |
1041 | 2756 | hud_controller_.reset(new hud::Controller()); | 2759 | hud_controller_.reset(new hud::Controller()); |
1042 | 2760 | auto hide_mode = (unity::launcher::LauncherHideMode) optionGetLauncherHideMode(); | ||
1043 | 2761 | hud_controller_->SetLauncherIsLockedOut(hide_mode == unity::launcher::LauncherHideMode::LAUNCHER_HIDE_NEVER); | ||
1044 | 2757 | AddChild(hud_controller_.get()); | 2762 | AddChild(hud_controller_.get()); |
1045 | 2758 | LOG_INFO(logger) << "initLauncher-hud " << timer.ElapsedSeconds() << "s"; | 2763 | LOG_INFO(logger) << "initLauncher-hud " << timer.ElapsedSeconds() << "s"; |
1046 | 2759 | 2764 | ||
1047 | 2760 | 2765 | ||
1048 | === modified file 'tests/autopilot/autopilot/tests/test_hud.py' | |||
1049 | --- tests/autopilot/autopilot/tests/test_hud.py 2012-03-20 15:15:18 +0000 | |||
1050 | +++ tests/autopilot/autopilot/tests/test_hud.py 2012-03-21 04:27:19 +0000 | |||
1051 | @@ -15,8 +15,15 @@ | |||
1052 | 15 | 15 | ||
1053 | 16 | class HudTests(AutopilotTestCase): | 16 | class HudTests(AutopilotTestCase): |
1054 | 17 | 17 | ||
1055 | 18 | scenarios = [ | ||
1056 | 19 | ('Launcher never hide', {'launcher_hide_mode': 0}), | ||
1057 | 20 | ('Launcher autohide', {'launcher_hide_mode': 1}), | ||
1058 | 21 | ] | ||
1059 | 22 | |||
1060 | 18 | def setUp(self): | 23 | def setUp(self): |
1061 | 19 | super(HudTests, self).setUp() | 24 | super(HudTests, self).setUp() |
1062 | 25 | self.set_unity_option('launcher_hide_mode', self.launcher_hide_mode) | ||
1063 | 26 | sleep(0.5) | ||
1064 | 20 | self.hud = self.get_hud_controller() | 27 | self.hud = self.get_hud_controller() |
1065 | 21 | 28 | ||
1066 | 22 | def tearDown(self): | 29 | def tearDown(self): |
1067 | @@ -54,12 +61,16 @@ | |||
1068 | 54 | def test_check_a_values(self): | 61 | def test_check_a_values(self): |
1069 | 55 | self.reveal_hud() | 62 | self.reveal_hud() |
1070 | 56 | self.keyboard.type('a') | 63 | self.keyboard.type('a') |
1071 | 64 | # Give the HUD a second to get values. | ||
1072 | 65 | sleep(1) | ||
1073 | 57 | self.assertThat(self.hud.num_buttons, Equals(5)) | 66 | self.assertThat(self.hud.num_buttons, Equals(5)) |
1074 | 58 | self.assertThat(self.hud.selected_button, Equals(1)) | 67 | self.assertThat(self.hud.selected_button, Equals(1)) |
1075 | 59 | 68 | ||
1076 | 60 | def test_up_down_arrows(self): | 69 | def test_up_down_arrows(self): |
1077 | 61 | self.reveal_hud() | 70 | self.reveal_hud() |
1078 | 62 | self.keyboard.type('a') | 71 | self.keyboard.type('a') |
1079 | 72 | # Give the HUD a second to get values. | ||
1080 | 73 | sleep(1) | ||
1081 | 63 | self.keyboard.press_and_release('Down') | 74 | self.keyboard.press_and_release('Down') |
1082 | 64 | self.assertThat(self.hud.selected_button, Equals(2)) | 75 | self.assertThat(self.hud.selected_button, Equals(2)) |
1083 | 65 | self.keyboard.press_and_release('Down') | 76 | self.keyboard.press_and_release('Down') |
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.