Merge lp:~feng-kylin/unity/unityshell-rotated-kylin into lp:unity

Proposed by handsome_feng on 2015-12-22
Status: Merged
Approved by: Marco Trevisan (Treviño) on 2016-03-11
Approved revision: 4026
Merged at revision: 4089
Proposed branch: lp:~feng-kylin/unity/unityshell-rotated-kylin
Merge into: lp:unity
Diff against target: 3776 lines (+1504/-456)
49 files modified
com.canonical.Unity.gschema.xml (+9/-0)
dash/DashController.cpp (+22/-7)
hud/HudController.cpp (+11/-6)
launcher/BFBLauncherIcon.cpp (+4/-3)
launcher/BFBLauncherIcon.h (+1/-1)
launcher/EdgeBarrierController.cpp (+19/-4)
launcher/HudLauncherIcon.cpp (+5/-3)
launcher/HudLauncherIcon.h (+2/-3)
launcher/Launcher.cpp (+337/-94)
launcher/Launcher.h (+5/-0)
launcher/LauncherController.cpp (+57/-33)
launcher/LauncherControllerPrivate.h (+5/-3)
launcher/LauncherIcon.cpp (+8/-1)
launcher/QuicklistView.cpp (+205/-93)
launcher/SoftwareCenterLauncherIcon.cpp (+1/-0)
launcher/Tooltip.cpp (+213/-61)
launcher/Tooltip.h (+4/-0)
panel/PanelView.cpp (+4/-2)
plugins/unityshell/src/unityshell.cpp (+29/-15)
resources/launcher_arrow_btt_19.svg (+18/-0)
resources/launcher_arrow_btt_37.svg (+21/-0)
resources/launcher_arrow_outline_btt_19.svg (+15/-0)
resources/launcher_arrow_outline_btt_37.svg (+19/-0)
resources/launcher_arrow_ttb_19.svg (+16/-0)
resources/launcher_arrow_ttb_37.svg (+21/-0)
resources/launcher_pip_btt_19.svg (+18/-0)
resources/launcher_pip_btt_37.svg (+19/-0)
tests/autopilot/unity/emulators/__init__.py (+8/-1)
tests/autopilot/unity/emulators/launcher.py (+57/-26)
tests/autopilot/unity/tests/launcher/__init__.py (+10/-1)
tests/autopilot/unity/tests/launcher/test_icon_behavior.py (+13/-4)
tests/autopilot/unity/tests/launcher/test_keynav.py (+13/-13)
tests/autopilot/unity/tests/launcher/test_reveal.py (+2/-2)
tests/autopilot/unity/tests/launcher/test_scroll.py (+3/-2)
tests/autopilot/unity/tests/launcher/test_switcher.py (+1/-1)
tests/autopilot/unity/tests/launcher/test_tooltips.py (+2/-2)
tests/autopilot/unity/tests/test_dash.py (+6/-4)
tests/autopilot/unity/tests/test_hud.py (+30/-8)
tests/autopilot/unity/tests/test_quicklist.py (+16/-6)
tests/autopilot/unity/tests/test_spread.py (+1/-1)
tests/autopilot/unity/tests/test_wm_keybindings.py (+8/-2)
tests/test_bfb_launcher_icon.cpp (+1/-1)
tests/test_hud_launcher_icon.cpp (+1/-1)
tests/test_launcher.cpp (+35/-1)
tests/test_launcher_controller.cpp (+20/-0)
unity-shared/IconRenderer.cpp (+134/-37)
unity-shared/SpreadFilter.cpp (+5/-2)
unity-shared/UnitySettings.cpp (+39/-8)
unity-shared/UnitySettings.h (+11/-4)
To merge this branch: bzr merge lp:~feng-kylin/unity/unityshell-rotated-kylin
Reviewer Review Type Date Requested Status
Marco Trevisan (Treviño) 2015-12-22 Approve on 2016-03-11
Review via email: mp+281182@code.launchpad.net

Commit message

Launcher: add Bottom mode, so that the launcher can be positioned horisontally

Description of the change

Added an option that change the launcher from the left of the screen to the bottom.

To post a comment you must log in.
4012. By handsome_feng on 2015-12-22

Added a new EdgeBarrier for launcher on the bottom

Marco Trevisan (Treviño) (3v1n0) wrote :

From a high level prospective, I can say that launcher works quite well (nice work!).
I've not checked all the internals, but I like most of things I see.

The Hud should always show the embedded icon in this case, the changes are included in lp:~3v1n0/unity/rotated-improvements

Pips in switcher should be still horizontal, so please use this:
 - http://pastebin.ubuntu.com/14138663/

In general, when you call multiple times in the same function Settings::Instance().launcher_position(), please store the return value to a variable once and reuse it, instead of calling the property method.

Inside Launcher.cpp is probably worth to keep this saved as launcher_position_, so that you can reduce the overhead of calling the method everytime.

So, for now merge with lp:~3v1n0/unity/rotated-improvements, and please include the cleanups I mentioned.

4013. By handsome_feng on 2015-12-23

merge trunk

4014. By handsome_feng on 2015-12-23

merging lp:~3v1n0/unity/rotated-improvements

4015. By handsome_feng on 2015-12-23

cleanups

handsome_feng (feng-kylin) wrote :

> From a high level prospective, I can say that launcher works quite well (nice
> work!).
> I've not checked all the internals, but I like most of things I see.
>
> The Hud should always show the embedded icon in this case, the changes are
> included in lp:~3v1n0/unity/rotated-improvements
>
> Pips in switcher should be still horizontal, so please use this:
> - http://pastebin.ubuntu.com/14138663/
>
> In general, when you call multiple times in the same function
> Settings::Instance().launcher_position(), please store the return value to a
> variable once and reuse it, instead of calling the property method.
>
> Inside Launcher.cpp is probably worth to keep this saved as
> launcher_position_, so that you can reduce the overhead of calling the method
> everytime.
>
> So, for now merge with lp:~3v1n0/unity/rotated-improvements, and please
> include the cleanups I mentioned.

Done.

But change the "vertical" barriers depending on launcher position
cause the sticky edge do not work when launcher on the bottom.

4016. By handsome_feng on 2015-12-25

modified something about quicklist mousearea and launcher folding icon

4017. By handsome_feng on 2015-12-28

move the launcher-position from com.canonical.Unity to com.canonical.Unity.Launcher

4018. By handsome_feng on 2015-12-30

fix the error in test_launcher.cpp

4019. By handsome_feng on 2016-01-12

modified the x_offset for plugin 'expo' and 'scale'

4020. By handsome_feng on 2016-01-27

center the anchor of quicklist

4021. By handsome_feng on 2016-01-29

center the anchor of tooltip

4022. By handsome_feng on 2016-02-16

merge trunk

4023. By handsome_feng on 2016-03-02

fix the bug that launcher locate in the wrong position when scale changed

4024. By handsome_feng on 2016-03-02

merge trunk

4025. By handsome_feng on 2016-03-08

Recalculate launcher height

4026. By handsome_feng on 2016-03-11

Fix some fials in hud and dash autopilot tests

Marco Trevisan (Treviño) (3v1n0) wrote :

Looks good, there's just a slight change I'd like you to include: http://paste.ubuntu.com/15348300/

Thanks a lot for this huge contribution

review: Approve
Marco Trevisan (Treviño) (3v1n0) wrote :

So, this doesn't merge with latest trunk...

So please merge this against with trunk. Then merge lp:~feng-kylin/unity/MoveDashToBottom with this one.

4027. By handsome_feng on 2016-03-18

merge trunk

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'com.canonical.Unity.gschema.xml'
--- com.canonical.Unity.gschema.xml 2016-02-19 21:53:41 +0000
+++ com.canonical.Unity.gschema.xml 2016-03-18 01:19:20 +0000
@@ -9,6 +9,10 @@
9 <value nick="Not Expanded" value="0" />9 <value nick="Not Expanded" value="0" />
10 <value nick="Expanded" value="1" />10 <value nick="Expanded" value="1" />
11 </enum>11 </enum>
12 <enum id="launcher-position-enum">
13 <value nick="Left" value="0" />
14 <value nick="Bottom" value="1" />
15 </enum>
12 <enum id="desktop-type-enum">16 <enum id="desktop-type-enum">
13 <value nick="Ubuntu" value="0" />17 <value nick="Ubuntu" value="0" />
14 <value nick="UbuntuKylin" value="1" />18 <value nick="UbuntuKylin" value="1" />
@@ -145,6 +149,11 @@
145 <summary>Version of last migration done</summary>149 <summary>Version of last migration done</summary>
146 <description>This is a detection key for the favorite migration script to know whether the needed migration is done or not.</description>150 <description>This is a detection key for the favorite migration script to know whether the needed migration is done or not.</description>
147 </key>151 </key>
152 <key enum="launcher-position-enum" name="launcher-position">
153 <default>"Left"</default>
154 <summary>The position of launcher.</summary>
155 <description>The position of launcher.</description>
156 </key>
148 </schema>157 </schema>
149 <schema path="/com/canonical/unity/devices/" id="com.canonical.Unity.Devices" gettext-domain="unity">158 <schema path="/com/canonical/unity/devices/" id="com.canonical.Unity.Devices" gettext-domain="unity">
150 <key type="as" name="blacklist">159 <key type="as" name="blacklist">
151160
=== modified file 'dash/DashController.cpp'
--- dash/DashController.cpp 2016-02-17 18:47:09 +0000
+++ dash/DashController.cpp 2016-03-18 01:19:20 +0000
@@ -230,15 +230,22 @@
230nux::Geometry Controller::GetIdealWindowGeometry()230nux::Geometry Controller::GetIdealWindowGeometry()
231{231{
232 UScreen *uscreen = UScreen::GetDefault();232 UScreen *uscreen = UScreen::GetDefault();
233 auto monitor_geo = uscreen->GetMonitorGeometry(GetIdealMonitor());233 auto ideal_geo = uscreen->GetMonitorGeometry(GetIdealMonitor());
234 int launcher_width = unity::Settings::Instance().LauncherWidth(monitor_);234 int launcher_size = unity::Settings::Instance().LauncherSize(monitor_);
235235
236 // We want to cover as much of the screen as possible to grab any mouse events outside236 // We want to cover as much of the screen as possible to grab any mouse events outside
237 // of our window237 // of our window
238 return nux::Geometry (monitor_geo.x + launcher_width,238 if (Settings::Instance().launcher_position() == LauncherPosition::LEFT)
239 monitor_geo.y,239 {
240 monitor_geo.width - launcher_width,240 ideal_geo.x += launcher_size;
241 monitor_geo.height);241 ideal_geo.width -= launcher_size;
242 }
243 else
244 {
245 ideal_geo.height -= launcher_size;
246 }
247
248 return ideal_geo;
242}249}
243250
244void Controller::OnMonitorChanged(int primary, std::vector<nux::Geometry> const& monitors)251void Controller::OnMonitorChanged(int primary, std::vector<nux::Geometry> const& monitors)
@@ -262,8 +269,16 @@
262269
263void Controller::UpdateDashPosition()270void Controller::UpdateDashPosition()
264{271{
272 auto launcher_position = Settings::Instance().launcher_position();
273 int left_offset = 0;
265 int top_offset = panel::Style::Instance().PanelHeight(monitor_);274 int top_offset = panel::Style::Instance().PanelHeight(monitor_);
266 int left_offset = unity::Settings::Instance().LauncherWidth(monitor_);275 int launcher_size = unity::Settings::Instance().LauncherSize(monitor_);
276
277 if (launcher_position == LauncherPosition::LEFT)
278 {
279 left_offset = launcher_size;
280 }
281
267 view_->SetMonitorOffset(left_offset, top_offset);282 view_->SetMonitorOffset(left_offset, top_offset);
268}283}
269284
270285
=== modified file 'hud/HudController.cpp'
--- hud/HudController.cpp 2015-04-17 20:32:59 +0000
+++ hud/HudController.cpp 2016-03-18 01:19:20 +0000
@@ -174,7 +174,7 @@
174174
175bool Controller::IsLockedToLauncher(int monitor)175bool Controller::IsLockedToLauncher(int monitor)
176{176{
177 if (launcher_locked_out)177 if (launcher_locked_out && Settings::Instance().launcher_position() == LauncherPosition::LEFT)
178 {178 {
179 int primary_monitor = UScreen::GetDefault()->GetPrimaryMonitor();179 int primary_monitor = UScreen::GetDefault()->GetPrimaryMonitor();
180180
@@ -206,13 +206,13 @@
206void Controller::SetIcon(std::string const& icon_name)206void Controller::SetIcon(std::string const& icon_name)
207{207{
208 LOG_DEBUG(logger) << "setting icon to - " << icon_name;208 LOG_DEBUG(logger) << "setting icon to - " << icon_name;
209 int launcher_width = unity::Settings::Instance().LauncherWidth(monitor_index_);209 int launcher_size = unity::Settings::Instance().LauncherSize(monitor_index_);
210210
211 if (view_)211 if (view_)
212 {212 {
213 double scale = view_->scale();213 double scale = view_->scale();
214 int tsize = tile_size().CP(scale);214 int tsize = tile_size().CP(scale);
215 view_->SetIcon(icon_name, tsize, icon_size().CP(scale), launcher_width - tsize);215 view_->SetIcon(icon_name, tsize, icon_size().CP(scale), launcher_size - tsize);
216 }216 }
217217
218 ubus.SendMessage(UBUS_HUD_ICON_CHANGED, g_variant_new_string(icon_name.c_str()));218 ubus.SendMessage(UBUS_HUD_ICON_CHANGED, g_variant_new_string(icon_name.c_str()));
@@ -253,7 +253,7 @@
253253
254 if (IsLockedToLauncher(ideal_monitor))254 if (IsLockedToLauncher(ideal_monitor))
255 {255 {
256 int launcher_width = unity::Settings::Instance().LauncherWidth(ideal_monitor);256 int launcher_width = unity::Settings::Instance().LauncherSize(ideal_monitor);
257 geo.x += launcher_width;257 geo.x += launcher_width;
258 geo.width -= launcher_width;258 geo.width -= launcher_width;
259 }259 }
@@ -269,12 +269,17 @@
269 monitor_index_ = CLAMP(GetIdealMonitor(), 0, static_cast<int>(UScreen::GetDefault()->GetMonitors().size()-1));269 monitor_index_ = CLAMP(GetIdealMonitor(), 0, static_cast<int>(UScreen::GetDefault()->GetMonitors().size()-1));
270270
271 nux::Geometry const& geo = GetIdealWindowGeometry();271 nux::Geometry const& geo = GetIdealWindowGeometry();
272 int launcher_width = unity::Settings::Instance().LauncherWidth(monitor_index_);
273272
274 view_->QueueDraw();273 view_->QueueDraw();
275 window_->SetGeometry(geo);274 window_->SetGeometry(geo);
276 panel::Style &panel_style = panel::Style::Instance();275 panel::Style &panel_style = panel::Style::Instance();
277 view_->SetMonitorOffset(launcher_width, panel_style.PanelHeight(monitor_index_));276
277 int horizontal_offset = 0;
278
279 if (Settings::Instance().launcher_position() == LauncherPosition::LEFT)
280 horizontal_offset = unity::Settings::Instance().LauncherSize(monitor_index_);
281
282 view_->SetMonitorOffset(horizontal_offset, panel_style.PanelHeight(monitor_index_));
278}283}
279284
280void Controller::OnMouseDownOutsideWindow(int x, int y,285void Controller::OnMouseDownOutsideWindow(int x, int y,
281286
=== modified file 'launcher/BFBLauncherIcon.cpp'
--- launcher/BFBLauncherIcon.cpp 2016-02-10 18:03:01 +0000
+++ launcher/BFBLauncherIcon.cpp 2016-03-18 01:19:20 +0000
@@ -31,10 +31,10 @@
31namespace launcher31namespace launcher
32{32{
3333
34BFBLauncherIcon::BFBLauncherIcon(LauncherHideMode hide_mode)34BFBLauncherIcon::BFBLauncherIcon()
35 : SimpleLauncherIcon(IconType::HOME)35 : SimpleLauncherIcon(IconType::HOME)
36 , reader_(dash::GSettingsScopesReader::GetDefault())36 , reader_(dash::GSettingsScopesReader::GetDefault())
37 , launcher_hide_mode_(hide_mode)37 , launcher_hide_mode_(LAUNCHER_HIDE_NEVER)
38{38{
39 position = Position::BEGIN;39 position = Position::BEGIN;
40 SetQuirk(Quirk::VISIBLE, true);40 SetQuirk(Quirk::VISIBLE, true);
@@ -79,7 +79,8 @@
79 // If the hud is open, we hide the BFB if we have a locked launcher79 // If the hud is open, we hide the BFB if we have a locked launcher
80 else if (overlay_identity.Str() == "hud")80 else if (overlay_identity.Str() == "hud")
81 {81 {
82 if (launcher_hide_mode_ == LAUNCHER_HIDE_NEVER)82 if (launcher_hide_mode_ == LAUNCHER_HIDE_NEVER &&
83 Settings::Instance().launcher_position() == LauncherPosition::LEFT)
83 {84 {
84 SetVisibleOnMonitor(overlay_monitor, !visible);85 SetVisibleOnMonitor(overlay_monitor, !visible);
85 SkipQuirkAnimation(Quirk::VISIBLE, overlay_monitor);86 SkipQuirkAnimation(Quirk::VISIBLE, overlay_monitor);
8687
=== modified file 'launcher/BFBLauncherIcon.h'
--- launcher/BFBLauncherIcon.h 2016-02-10 18:03:01 +0000
+++ launcher/BFBLauncherIcon.h 2016-03-18 01:19:20 +0000
@@ -37,7 +37,7 @@
37{37{
3838
39public:39public:
40 BFBLauncherIcon(LauncherHideMode hide_mode);40 BFBLauncherIcon();
4141
42 virtual nux::Color BackgroundColor() const;42 virtual nux::Color BackgroundColor() const;
43 virtual nux::Color GlowColor();43 virtual nux::Color GlowColor();
4444
=== modified file 'launcher/EdgeBarrierController.cpp'
--- launcher/EdgeBarrierController.cpp 2015-05-28 00:45:21 +0000
+++ launcher/EdgeBarrierController.cpp 2016-03-18 01:19:20 +0000
@@ -23,6 +23,7 @@
23#include "EdgeBarrierControllerPrivate.h"23#include "EdgeBarrierControllerPrivate.h"
24#include "Decaymulator.h"24#include "Decaymulator.h"
25#include <NuxCore/Logger.h>25#include <NuxCore/Logger.h>
26#include "unity-shared/UnitySettings.h"
26#include "unity-shared/UScreen.h"27#include "unity-shared/UScreen.h"
27#include "UnityCore/GLibSource.h"28#include "UnityCore/GLibSource.h"
2829
@@ -93,6 +94,7 @@
93 }));*/94 }));*/
9495
95 uscreen->changed.connect(sigc::mem_fun(this, &EdgeBarrierController::Impl::OnUScreenChanged));96 uscreen->changed.connect(sigc::mem_fun(this, &EdgeBarrierController::Impl::OnUScreenChanged));
97 Settings::Instance().launcher_position.changed.connect(sigc::hide(sigc::mem_fun(this, &EdgeBarrierController::Impl::OnOptionsChanged)));
9698
97 parent_->force_disable.changed.connect(sigc::mem_fun(this, &EdgeBarrierController::Impl::OnForceDisableChanged));99 parent_->force_disable.changed.connect(sigc::mem_fun(this, &EdgeBarrierController::Impl::OnForceDisableChanged));
98100
@@ -218,6 +220,7 @@
218 return;220 return;
219221
220 bool edge_resist = parent_->sticky_edges();222 bool edge_resist = parent_->sticky_edges();
223 auto launcher_position = Settings::Instance().launcher_position();
221224
222 for (unsigned i = 0; i < layout.size(); i++)225 for (unsigned i = 0; i < layout.size(); i++)
223 {226 {
@@ -246,10 +249,22 @@
246 if (!edge_resist && parent_->options()->hide_mode() == launcher::LauncherHideMode::LAUNCHER_HIDE_NEVER)249 if (!edge_resist && parent_->options()->hide_mode() == launcher::LauncherHideMode::LAUNCHER_HIDE_NEVER)
247 continue;250 continue;
248251
249 vertical_barrier->x1 = monitor.x;252 if (launcher_position == LauncherPosition::LEFT)
250 vertical_barrier->x2 = monitor.x;253 {
251 vertical_barrier->y1 = monitor.y;254 vertical_barrier->x1 = monitor.x;
252 vertical_barrier->y2 = monitor.y + monitor.height;255 vertical_barrier->x2 = monitor.x;
256 vertical_barrier->y1 = monitor.y;
257 vertical_barrier->y2 = monitor.y + monitor.height;
258 }
259 else
260 {
261 vertical_barrier->x1 = monitor.x;
262 vertical_barrier->x2 = monitor.x + monitor.width;
263 vertical_barrier->y1 = monitor.y + monitor.height;
264 vertical_barrier->y2 = monitor.y + monitor.height;
265 vertical_barrier->direction = DOWN;
266 }
267
253 vertical_barrier->index = i;268 vertical_barrier->index = i;
254269
255 vertical_barrier->threshold = parent_->options()->edge_stop_velocity();270 vertical_barrier->threshold = parent_->options()->edge_stop_velocity();
256271
=== modified file 'launcher/HudLauncherIcon.cpp'
--- launcher/HudLauncherIcon.cpp 2014-01-31 16:19:39 +0000
+++ launcher/HudLauncherIcon.cpp 2016-03-18 01:19:20 +0000
@@ -22,6 +22,7 @@
22#include <NuxCore/Logger.h>22#include <NuxCore/Logger.h>
2323
24#include "unity-shared/UBusMessages.h"24#include "unity-shared/UBusMessages.h"
25#include "unity-shared/UnitySettings.h"
2526
26#include "config.h"27#include "config.h"
27#include <glib/gi18n-lib.h>28#include <glib/gi18n-lib.h>
@@ -32,9 +33,9 @@
32{33{
33DECLARE_LOGGER(logger, "unity.launcher.icon.hud");34DECLARE_LOGGER(logger, "unity.launcher.icon.hud");
3435
35HudLauncherIcon::HudLauncherIcon(LauncherHideMode hide_mode)36HudLauncherIcon::HudLauncherIcon()
36 : SingleMonitorLauncherIcon(IconType::HUD)37 : SingleMonitorLauncherIcon(IconType::HUD)
37 , launcher_hide_mode_(hide_mode)38 , launcher_hide_mode_(LAUNCHER_HIDE_NEVER)
38 , overlay_monitor_(0)39 , overlay_monitor_(0)
39 , single_launcher_(false)40 , single_launcher_(false)
40 , launcher_monitor_(0)41 , launcher_monitor_(0)
@@ -90,7 +91,7 @@
90{91{
91 if (single_launcher_ == single_launcher && launcher_monitor_ == launcher_monitor)92 if (single_launcher_ == single_launcher && launcher_monitor_ == launcher_monitor)
92 return;93 return;
93 94
94 single_launcher_ = single_launcher;95 single_launcher_ = single_launcher;
95 launcher_monitor_ = launcher_monitor;96 launcher_monitor_ = launcher_monitor;
9697
@@ -112,6 +113,7 @@
112 // If the hud is open, we show the HUD button if we have a locked launcher113 // If the hud is open, we show the HUD button if we have a locked launcher
113 if (overlay_identity.Str() == "hud" &&114 if (overlay_identity.Str() == "hud" &&
114 launcher_hide_mode_ == LAUNCHER_HIDE_NEVER &&115 launcher_hide_mode_ == LAUNCHER_HIDE_NEVER &&
116 Settings::Instance().launcher_position() == LauncherPosition::LEFT &&
115 (!single_launcher_ || (single_launcher_ && launcher_monitor_ == overlay_monitor_)))117 (!single_launcher_ || (single_launcher_ && launcher_monitor_ == overlay_monitor_)))
116 {118 {
117 SetMonitor(visible ? overlay_monitor_ : -1);119 SetMonitor(visible ? overlay_monitor_ : -1);
118120
=== modified file 'launcher/HudLauncherIcon.h'
--- launcher/HudLauncherIcon.h 2014-01-31 16:19:39 +0000
+++ launcher/HudLauncherIcon.h 2016-03-18 01:19:20 +0000
@@ -32,9 +32,8 @@
3232
33class HudLauncherIcon : public SingleMonitorLauncherIcon33class HudLauncherIcon : public SingleMonitorLauncherIcon
34{34{
35
36public:35public:
37 HudLauncherIcon(LauncherHideMode hide_mode);36 HudLauncherIcon();
3837
39 virtual nux::Color BackgroundColor() const;38 virtual nux::Color BackgroundColor() const;
40 virtual nux::Color GlowColor();39 virtual nux::Color GlowColor();
@@ -53,7 +52,7 @@
53 nux::Color background_color_;52 nux::Color background_color_;
54 LauncherHideMode launcher_hide_mode_;53 LauncherHideMode launcher_hide_mode_;
55 UBusManager ubus_manager_;54 UBusManager ubus_manager_;
56 gint32 overlay_monitor_; 55 gint32 overlay_monitor_;
57 bool single_launcher_;56 bool single_launcher_;
58 int launcher_monitor_;57 int launcher_monitor_;
59};58};
6059
=== modified file 'launcher/Launcher.cpp'
--- launcher/Launcher.cpp 2015-11-25 23:16:57 +0000
+++ launcher/Launcher.cpp 2016-03-18 01:19:20 +0000
@@ -66,7 +66,7 @@
6666
67const float BACKLIGHT_STRENGTH = 0.9f;67const float BACKLIGHT_STRENGTH = 0.9f;
68const RawPixel ICON_PADDING = 6_em;68const RawPixel ICON_PADDING = 6_em;
69const RawPixel RIGHT_LINE_WIDTH = 1_em;69const RawPixel SIDE_LINE_WIDTH = 1_em;
7070
71const int ANIM_DURATION_SHORT = 125;71const int ANIM_DURATION_SHORT = 125;
72const int ANIM_DURATION_SHORT_SHORT = 100;72const int ANIM_DURATION_SHORT_SHORT = 100;
@@ -126,6 +126,7 @@
126 , launcher_drag_delta_(0)126 , launcher_drag_delta_(0)
127 , launcher_drag_delta_max_(0)127 , launcher_drag_delta_max_(0)
128 , launcher_drag_delta_min_(0)128 , launcher_drag_delta_min_(0)
129 , enter_x_(0)
129 , enter_y_(0)130 , enter_y_(0)
130 , last_button_press_(0)131 , last_button_press_(0)
131 , urgent_animation_period_(0)132 , urgent_animation_period_(0)
@@ -135,6 +136,7 @@
135 , last_reveal_progress_(0.0f)136 , last_reveal_progress_(0.0f)
136 , drag_action_(nux::DNDACTION_NONE)137 , drag_action_(nux::DNDACTION_NONE)
137 , bg_effect_helper_(this)138 , bg_effect_helper_(this)
139 , launcher_position_(unity::Settings::Instance().launcher_position())
138 , auto_hide_animation_(ANIM_DURATION_SHORT)140 , auto_hide_animation_(ANIM_DURATION_SHORT)
139 , hover_animation_(ANIM_DURATION)141 , hover_animation_(ANIM_DURATION)
140 , drag_over_animation_(ANIM_DURATION_LONG)142 , drag_over_animation_(ANIM_DURATION_LONG)
@@ -184,11 +186,16 @@
184186
185 TextureCache& cache = TextureCache::GetDefault();187 TextureCache& cache = TextureCache::GetDefault();
186 launcher_sheen_ = cache.FindTexture("dash_sheen.png");188 launcher_sheen_ = cache.FindTexture("dash_sheen.png");
187 launcher_pressure_effect_ = cache.FindTexture("launcher_pressure_effect.png");
188189
189 options.changed.connect(sigc::mem_fun(this, &Launcher::OnOptionsChanged));190 options.changed.connect(sigc::mem_fun(this, &Launcher::OnOptionsChanged));
190 monitor.changed.connect(sigc::mem_fun(this, &Launcher::OnMonitorChanged));191 monitor.changed.connect(sigc::mem_fun(this, &Launcher::OnMonitorChanged));
191192
193 launcher_position_changed_ = unity::Settings::Instance().launcher_position.changed.connect([this] (LauncherPosition const& position) {
194 launcher_position_ = position;
195 OnMonitorChanged(monitor);
196 QueueDraw();
197 });
198
192 unity::Settings::Instance().dpi_changed.connect(sigc::mem_fun(this, &Launcher::OnDPIChanged));199 unity::Settings::Instance().dpi_changed.connect(sigc::mem_fun(this, &Launcher::OnDPIChanged));
193200
194 auto_hide_animation_.updated.connect(redraw_cb);201 auto_hide_animation_.updated.connect(redraw_cb);
@@ -303,7 +310,12 @@
303bool Launcher::MouseBeyondDragThreshold() const310bool Launcher::MouseBeyondDragThreshold() const
304{311{
305 if (GetActionState() == ACTION_DRAG_ICON)312 if (GetActionState() == ACTION_DRAG_ICON)
306 return mouse_position_.x > GetGeometry().width + icon_size_.CP(cv_) / 2;313 {
314 if (launcher_position_ == LauncherPosition::LEFT)
315 return mouse_position_.x > GetGeometry().width + icon_size_.CP(cv_) / 2;
316 else
317 return mouse_position_.y < GetGeometry().y - icon_size_.CP(cv_) / 2;
318 }
307 return false;319 return false;
308}320}
309321
@@ -343,23 +355,31 @@
343355
344void Launcher::SetDndDelta(float x, float y, nux::Geometry const& geo)356void Launcher::SetDndDelta(float x, float y, nux::Geometry const& geo)
345{357{
346 auto const& anchor = MouseIconIntersection(x, enter_y_);358 auto const& anchor = (launcher_position_ == LauncherPosition::LEFT) ? MouseIconIntersection(x, enter_y_) : MouseIconIntersection(enter_x_, y);
347
348 int c_icon_size = icon_size_.CP(cv_);359 int c_icon_size = icon_size_.CP(cv_);
349360
350 if (anchor)361 if (anchor)
351 {362 {
352 float position = y;363 float position =(launcher_position_ == LauncherPosition::LEFT) ? y: x;
364
353 for (AbstractLauncherIcon::Ptr const& model_icon : *model_)365 for (AbstractLauncherIcon::Ptr const& model_icon : *model_)
354 {366 {
355 if (model_icon == anchor)367 if (model_icon == anchor)
356 {368 {
357 position += c_icon_size / 2;369 position += c_icon_size / 2;
358 launcher_drag_delta_ = enter_y_ - position;370 if (launcher_position_ == LauncherPosition::LEFT)
359371 {
360 if (position + c_icon_size / 2 + launcher_drag_delta_ > geo.height)372 launcher_drag_delta_ = enter_y_ - position;
361 launcher_drag_delta_ -= (position + c_icon_size / 2 + launcher_drag_delta_) - geo.height;373 if (position + c_icon_size / 2 + launcher_drag_delta_ > geo.height)
362374 launcher_drag_delta_ -= (position + c_icon_size / 2 + launcher_drag_delta_) - geo.height;
375 }
376 else
377 {
378 launcher_drag_delta_ = enter_x_ - position;
379
380 if (position + c_icon_size / 2 + launcher_drag_delta_ > geo.width)
381 launcher_drag_delta_ -= (position + c_icon_size / 2 + launcher_drag_delta_) - geo.width;
382 }
363 break;383 break;
364 }384 }
365 float visibility = model_icon->GetQuirkProgress(AbstractLauncherIcon::Quirk::VISIBLE, monitor());385 float visibility = model_icon->GetQuirkProgress(AbstractLauncherIcon::Quirk::VISIBLE, monitor());
@@ -667,8 +687,9 @@
667 arg.skip = true;687 arg.skip = true;
668688
669 int c_icon_size = icon_size_.CP(cv_);689 int c_icon_size = icon_size_.CP(cv_);
690 auto moving_center = (launcher_position_ == LauncherPosition::LEFT) ? center.y : center.x;
670 // goes for 0.0f when fully unfolded, to 1.0f folded691 // goes for 0.0f when fully unfolded, to 1.0f folded
671 float folding_progress = CLAMP((center.y + c_icon_size - folding_threshold) / (float) c_icon_size, 0.0f, 1.0f);692 float folding_progress = CLAMP((moving_center + c_icon_size - folding_threshold) / (float) c_icon_size, 0.0f, 1.0f);
672 float unfold_progress = icon->GetQuirkProgress(AbstractLauncherIcon::Quirk::UNFOLDED, monitor());693 float unfold_progress = icon->GetQuirkProgress(AbstractLauncherIcon::Quirk::UNFOLDED, monitor());
673 float active_progress = icon->GetQuirkProgress(AbstractLauncherIcon::Quirk::ACTIVE, monitor());694 float active_progress = icon->GetQuirkProgress(AbstractLauncherIcon::Quirk::ACTIVE, monitor());
674695
@@ -688,23 +709,41 @@
688709
689 // icon is crossing threshold, start folding710 // icon is crossing threshold, start folding
690 center.z += folded_z_distance * folding_progress;711 center.z += folded_z_distance * folding_progress;
691 arg.rotation.x = animation_neg_rads * folding_progress;712 if (launcher_position_ == LauncherPosition::LEFT)
713 arg.rotation.x = animation_neg_rads * folding_progress;
714 else
715 arg.rotation.y = animation_neg_rads * folding_progress;
692716
693 float spacing_overlap = CLAMP((float)(center.y + (2.0f * half_size * size_modifier) + (SPACE_BETWEEN_ICONS.CP(cv_) * size_modifier) - folding_threshold) / (float) c_icon_size, 0.0f, 1.0f);717 float spacing_overlap = CLAMP((float)(moving_center + (2.0f * half_size * size_modifier) + (SPACE_BETWEEN_ICONS.CP(cv_) * size_modifier) - folding_threshold) / (float) c_icon_size, 0.0f, 1.0f);
694 float spacing = (SPACE_BETWEEN_ICONS.CP(cv_) * (1.0f - spacing_overlap) + folded_spacing * spacing_overlap) * size_modifier;718 float spacing = (SPACE_BETWEEN_ICONS.CP(cv_) * (1.0f - spacing_overlap) + folded_spacing * spacing_overlap) * size_modifier;
695719
696 nux::Point3 centerOffset;720 nux::Point3 centerOffset;
697 float center_transit_progress = icon->GetQuirkProgress(AbstractLauncherIcon::Quirk::CENTER_SAVED, monitor());721 float center_transit_progress = icon->GetQuirkProgress(AbstractLauncherIcon::Quirk::CENTER_SAVED, monitor());
698 if (center_transit_progress <= 1.0f)722 if (center_transit_progress <= 1.0f)
699 {723 {
700 int saved_center = icon->GetSavedCenter(monitor).y - parent_abs_geo.y;724 if (launcher_position_ == LauncherPosition::LEFT)
701 centerOffset.y = (saved_center - (center.y + (half_size * size_modifier))) * (1.0f - center_transit_progress);725 {
702 }726 int saved_center = icon->GetSavedCenter(monitor).y - parent_abs_geo.y;
703727 centerOffset.y = (saved_center - (center.y + (half_size * size_modifier))) * (1.0f - center_transit_progress);
704 center.y += half_size * size_modifier; // move to center728 }
705729 else
706 arg.render_center = nux::Point3(roundf(center.x + icon_hide_offset), roundf(center.y + centerOffset.y), roundf(center.z));730 {
707 arg.logical_center = nux::Point3(roundf(center.x + icon_hide_offset), roundf(center.y), roundf(center.z));731 int saved_center = icon->GetSavedCenter(monitor).x - parent_abs_geo.x;
732 centerOffset.x = (saved_center - (center.x + (half_size * size_modifier))) * (1.0f - center_transit_progress);
733 }
734 }
735 if (launcher_position_ == LauncherPosition::LEFT)
736 {
737 center.y += half_size * size_modifier; // move to center
738 arg.render_center = nux::Point3(roundf(center.x + icon_hide_offset), roundf(center.y + centerOffset.y), roundf(center.z));
739 arg.logical_center = nux::Point3(roundf(center.x + icon_hide_offset), roundf(center.y), roundf(center.z));
740 }
741 else
742 {
743 center.x += half_size * size_modifier;
744 arg.render_center = nux::Point3(roundf(center.x + centerOffset.x), roundf(center.y + icon_hide_offset), roundf(center.z));
745 arg.logical_center = nux::Point3(roundf(center.x), roundf(center.y + icon_hide_offset), roundf(center.z));
746 }
708747
709 nux::Point3 icon_center(parent_abs_geo.x + roundf(center.x), parent_abs_geo.y + roundf(center.y), roundf(center.z));748 nux::Point3 icon_center(parent_abs_geo.x + roundf(center.x), parent_abs_geo.y + roundf(center.y), roundf(center.z));
710 icon->SetCenter(icon_center, monitor);749 icon->SetCenter(icon_center, monitor);
@@ -715,7 +754,10 @@
715 drag_window_->SetAnimationTarget(icon_center.x, icon_center.y);754 drag_window_->SetAnimationTarget(icon_center.x, icon_center.y);
716 }755 }
717756
718 center.y += (half_size * size_modifier) + spacing; // move to end757 if (launcher_position_ == LauncherPosition::LEFT)
758 center.y += (half_size * size_modifier) + spacing; // move to end
759 else
760 center.x += (half_size * size_modifier) + spacing;
719}761}
720762
721float Launcher::DragLimiter(float x)763float Launcher::DragLimiter(float x)
@@ -757,21 +799,30 @@
757 float folded_size = c_icon_size * folding_not_constant;799 float folded_size = c_icon_size * folding_not_constant;
758 float folded_spacing = SPACE_BETWEEN_ICONS.CP(cv_) * folding_not_constant;800 float folded_spacing = SPACE_BETWEEN_ICONS.CP(cv_) * folding_not_constant;
759801
760 center.x = geo.width / 2;802 if (launcher_position_ == LauncherPosition::LEFT)
761 center.y = SPACE_BETWEEN_ICONS.CP(cv_);803 {
804 center.x = geo.width / 2;
805 center.y = SPACE_BETWEEN_ICONS.CP(cv_);
806 }
807 else
808 {
809 center.x = SPACE_BETWEEN_ICONS.CP(cv_);
810 center.y = geo.height / 2;
811 }
762 center.z = 0;812 center.z = 0;
763813
764 int launcher_height = geo.height;814 int launcher_size = (launcher_position_ == LauncherPosition::LEFT) ? geo.height : geo.width;
765 folded_ = true;815 folded_ = true;
766816
767 // compute required height of launcher AND folding threshold817 // compute required height/width of launcher AND folding threshold
768 float sum = 0.0f + center.y;818 float sum = (launcher_position_ == LauncherPosition::LEFT) ? (0.0f + center.y) : (0.0f + center.x);
769 float folding_threshold = launcher_height - c_icon_size / 2.5f;819 float folding_threshold = launcher_size - c_icon_size / 2.5f;
820
770 for (it = model_->begin(); it != model_->end(); ++it)821 for (it = model_->begin(); it != model_->end(); ++it)
771 {822 {
772 float visibility = (*it)->GetQuirkProgress(AbstractLauncherIcon::Quirk::VISIBLE, monitor());823 float visibility = (*it)->GetQuirkProgress(AbstractLauncherIcon::Quirk::VISIBLE, monitor());
773 float height = (c_icon_size + SPACE_BETWEEN_ICONS.CP(cv_)) * visibility;824 float size = (c_icon_size + SPACE_BETWEEN_ICONS.CP(cv_)) * visibility;
774 sum += height;825 sum += size;
775826
776 // magic constant must some day be explained, for now suffice to say this constant prevents the bottom from "marching";827 // magic constant must some day be explained, for now suffice to say this constant prevents the bottom from "marching";
777 const float magic_constant = 1.3f;828 const float magic_constant = 1.3f;
@@ -780,12 +831,12 @@
780 float active_progress = (*it)->GetQuirkProgress(AbstractLauncherIcon::Quirk::ACTIVE, monitor());831 float active_progress = (*it)->GetQuirkProgress(AbstractLauncherIcon::Quirk::ACTIVE, monitor());
781832
782 unfold_progress = CLAMP(unfold_progress + active_progress, 0.0f, 1.0f);833 unfold_progress = CLAMP(unfold_progress + active_progress, 0.0f, 1.0f);
783 folding_threshold -= CLAMP(sum - launcher_height, 0.0f, height * magic_constant) * (folding_constant + (1.0f - folding_constant) * unfold_progress);834 folding_threshold -= CLAMP(sum - launcher_size, 0.0f, size * magic_constant) * (folding_constant + (1.0f - folding_constant) * unfold_progress);
784 }835 }
785836
786 if (sum - SPACE_BETWEEN_ICONS.CP(cv_) <= launcher_height)837 if (sum - SPACE_BETWEEN_ICONS.CP(cv_) <= launcher_size)
787 {838 {
788 folding_threshold = launcher_height;839 folding_threshold = launcher_size;
789 folded_ = false;840 folded_ = false;
790 }841 }
791842
@@ -806,7 +857,10 @@
806 {857 {
807 if (autohide_progress > 0.0f)858 if (autohide_progress > 0.0f)
808 {859 {
809 autohide_offset -= geo.width * autohide_progress;860 if (launcher_position_ == LauncherPosition::LEFT)
861 autohide_offset -= geo.width * autohide_progress;
862 else
863 autohide_offset += geo.height * autohide_progress;
810 if (options()->auto_hide_animation() == FADE_AND_SLIDE)864 if (options()->auto_hide_animation() == FADE_AND_SLIDE)
811 *launcher_alpha = 1.0f - 0.5f * autohide_progress;865 *launcher_alpha = 1.0f - 0.5f * autohide_progress;
812 }866 }
@@ -816,7 +870,10 @@
816 if (options()->hide_mode != LAUNCHER_HIDE_NEVER)870 if (options()->hide_mode != LAUNCHER_HIDE_NEVER)
817 {871 {
818 float drag_hide_progress = dnd_hide_animation_.GetCurrentValue();872 float drag_hide_progress = dnd_hide_animation_.GetCurrentValue();
819 autohide_offset -= geo.width * 0.25f * drag_hide_progress;873 if (launcher_position_ == LauncherPosition::LEFT)
874 autohide_offset -= geo.width * 0.25f * drag_hide_progress;
875 else
876 autohide_offset += geo.height * 0.25f * drag_hide_progress;
820 hide_machine_.SetQuirk(LauncherHideMachine::DND_PUSHED_OFF, (drag_hide_progress >= 1.0f));877 hide_machine_.SetQuirk(LauncherHideMachine::DND_PUSHED_OFF, (drag_hide_progress >= 1.0f));
821 }878 }
822879
@@ -824,7 +881,12 @@
824 box_geo = geo;881 box_geo = geo;
825882
826 if (options()->hide_mode != LAUNCHER_HIDE_NEVER || hide_machine_.GetQuirk(LauncherHideMachine::LOCK_HIDE))883 if (options()->hide_mode != LAUNCHER_HIDE_NEVER || hide_machine_.GetQuirk(LauncherHideMachine::LOCK_HIDE))
827 box_geo.x += autohide_offset;884 {
885 if (launcher_position_ == LauncherPosition::LEFT)
886 box_geo.x += autohide_offset;
887 else
888 box_geo.y += autohide_offset;
889 }
828890
829 /* Why we need last_geo? It stores the last box_geo (note: as it is a static variable,891 /* Why we need last_geo? It stores the last box_geo (note: as it is a static variable,
830 * it is initialized only first time). Infact we call SetDndDelta that calls MouseIconIntersection892 * it is initialized only first time). Infact we call SetDndDelta that calls MouseIconIntersection
@@ -835,26 +897,35 @@
835 static nux::Geometry last_geo = box_geo;897 static nux::Geometry last_geo = box_geo;
836898
837 // this happens on hover, basically its a flag and a value in one, we translate this into a dnd offset899 // this happens on hover, basically its a flag and a value in one, we translate this into a dnd offset
838 if (enter_y_ != 0 && enter_y_ + c_icon_size / 2 > folding_threshold)900 if (launcher_position_ == LauncherPosition::LEFT)
839 SetDndDelta(last_geo.x + last_geo.width / 2, center.y, geo);901 {
902 if (enter_y_ != 0 && enter_y_ + c_icon_size / 2 > folding_threshold)
903 SetDndDelta(last_geo.x + last_geo.width / 2, center.y, geo);
904 }
905 else
906 {
907 if (enter_x_ != 0 && enter_x_ + c_icon_size / 2 > folding_threshold)
908 SetDndDelta(center.x, last_geo.y + last_geo.height / 2, geo);
909 }
840910
841 // Update the last_geo value.911 // Update the last_geo value.
842 last_geo = box_geo;912 last_geo = box_geo;
843 enter_y_ = 0;913 enter_y_ = 0;
914 enter_x_ = 0;
844915
845 // logically dnd exit only restores to the clamped ranges916 // logically dnd exit only restores to the clamped ranges
846 // hover_progress restores to 0917 // hover_progress restores to 0
847 launcher_drag_delta_max_ = 0.0f;918 launcher_drag_delta_max_ = 0.0f;
848 launcher_drag_delta_min_ = MIN(0.0f, launcher_height - sum);919 launcher_drag_delta_min_ = MIN(0.0f, launcher_size - sum);
849920
850 if (hover_progress > 0.0f && launcher_drag_delta_ != 0)921 if (hover_progress > 0.0f && launcher_drag_delta_ != 0)
851 {922 {
852 float delta_y = launcher_drag_delta_;923 float delta = launcher_drag_delta_;
853924
854 if (launcher_drag_delta_ > launcher_drag_delta_max_)925 if (launcher_drag_delta_ > launcher_drag_delta_max_)
855 delta_y = launcher_drag_delta_max_ + DragLimiter(delta_y - launcher_drag_delta_max_);926 delta = launcher_drag_delta_max_ + DragLimiter(delta - launcher_drag_delta_max_);
856 else if (launcher_drag_delta_ < launcher_drag_delta_min_)927 else if (launcher_drag_delta_ < launcher_drag_delta_min_)
857 delta_y = launcher_drag_delta_min_ + DragLimiter(delta_y - launcher_drag_delta_min_);928 delta = launcher_drag_delta_min_ + DragLimiter(delta - launcher_drag_delta_min_);
858929
859 if (GetActionState() != ACTION_DRAG_LAUNCHER)930 if (GetActionState() != ACTION_DRAG_LAUNCHER)
860 {931 {
@@ -862,17 +933,21 @@
862 float dnd_progress = std::pow(drag_over_animation_.GetCurrentValue(), 2);933 float dnd_progress = std::pow(drag_over_animation_.GetCurrentValue(), 2);
863934
864 if (launcher_drag_delta_ > launcher_drag_delta_max_)935 if (launcher_drag_delta_ > launcher_drag_delta_max_)
865 delta_y = launcher_drag_delta_max_ + (delta_y - launcher_drag_delta_max_) * dnd_progress;936 delta = launcher_drag_delta_max_ + (delta - launcher_drag_delta_max_) * dnd_progress;
866 else if (launcher_drag_delta_ < launcher_drag_delta_min_)937 else if (launcher_drag_delta_ < launcher_drag_delta_min_)
867 delta_y = launcher_drag_delta_min_ + (delta_y - launcher_drag_delta_min_) * dnd_progress;938 delta = launcher_drag_delta_min_ + (delta - launcher_drag_delta_min_) * dnd_progress;
868939
869 if (dnd_progress == 0.0f)940 if (dnd_progress == 0.0f)
870 launcher_drag_delta_ = (int) delta_y;941 launcher_drag_delta_ = (int) delta;
871 }942 }
872943
873 delta_y *= hover_progress;944 delta *= hover_progress;
874 center.y += delta_y;945 folding_threshold += delta;
875 folding_threshold += delta_y;946
947 if (launcher_position_ == LauncherPosition::LEFT)
948 center.y += delta;
949 else
950 center.x += delta;
876 }951 }
877 else952 else
878 {953 {
@@ -903,17 +978,26 @@
903 for (it = model_->shelf_begin(); it != model_->shelf_end(); ++it)978 for (it = model_->shelf_begin(); it != model_->shelf_end(); ++it)
904 {979 {
905 float visibility = (*it)->GetQuirkProgress(AbstractLauncherIcon::Quirk::VISIBLE, monitor());980 float visibility = (*it)->GetQuirkProgress(AbstractLauncherIcon::Quirk::VISIBLE, monitor());
906 float height = (c_icon_size + SPACE_BETWEEN_ICONS.CP(cv_)) * visibility;981 float size = (c_icon_size + SPACE_BETWEEN_ICONS.CP(cv_)) * visibility;
907 shelf_sum += height;982 shelf_sum += size;
908 }983 }
909984
910 // add bottom padding985 // add bottom padding
911 if (shelf_sum > 0.0f)986 if (shelf_sum > 0.0f)
912 shelf_sum += SPACE_BETWEEN_ICONS.CP(cv_);987 shelf_sum += SPACE_BETWEEN_ICONS.CP(cv_);
913988
914 float shelf_delta = MAX(((launcher_height - shelf_sum) + SPACE_BETWEEN_ICONS.CP(cv_)) - center.y, 0.0f);989 float shelf_delta = 0;
990 if (launcher_position_ == LauncherPosition::LEFT)
991 {
992 shelf_delta = MAX(((launcher_size - shelf_sum) + SPACE_BETWEEN_ICONS.CP(cv_)) - center.y, 0.0f);
993 center.y += shelf_delta;
994 }
995 else
996 {
997 shelf_delta = MAX(((launcher_size - shelf_sum) + SPACE_BETWEEN_ICONS.CP(cv_)) - center.x, 0.0f);
998 center.x += shelf_delta;
999 }
915 folding_threshold += shelf_delta;1000 folding_threshold += shelf_delta;
916 center.y += shelf_delta;
9171001
918 force_show_window = false;1002 force_show_window = false;
9191003
@@ -1225,9 +1309,14 @@
1225 auto monitor_geo = uscreen->GetMonitorGeometry(new_monitor);1309 auto monitor_geo = uscreen->GetMonitorGeometry(new_monitor);
1226 unity::panel::Style &panel_style = panel::Style::Instance();1310 unity::panel::Style &panel_style = panel::Style::Instance();
1227 int panel_height = panel_style.PanelHeight(new_monitor);1311 int panel_height = panel_style.PanelHeight(new_monitor);
12281312 RawPixel launcher_height = icon_size_ + ICON_PADDING * 2 + SIDE_LINE_WIDTH - 2;
1229 cv_ = unity::Settings::Instance().em(monitor);1313 cv_ = unity::Settings::Instance().em(monitor);
1230 Resize(nux::Point(monitor_geo.x, monitor_geo.y + panel_height), monitor_geo.height - panel_height);1314 launcher_height = launcher_height.CP(cv_) - (1_em).CP(cv_);
1315
1316 if (launcher_position_ == LauncherPosition::LEFT)
1317 Resize(nux::Point(monitor_geo.x, monitor_geo.y + panel_height), monitor_geo.height - panel_height);
1318 else
1319 Resize(nux::Point(monitor_geo.x, monitor_geo.y + monitor_geo.height - launcher_height), monitor_geo.width);
12311320
1232 icon_renderer_->monitor = new_monitor;1321 icon_renderer_->monitor = new_monitor;
1233 icon_renderer_->scale = cv_->DPIScale();1322 icon_renderer_->scale = cv_->DPIScale();
@@ -1240,6 +1329,7 @@
1240 SetHideMode(options->hide_mode);1329 SetHideMode(options->hide_mode);
1241 SetScrollInactiveIcons(options->scroll_inactive_icons);1330 SetScrollInactiveIcons(options->scroll_inactive_icons);
1242 SetLauncherMinimizeWindow(options->minimize_window_on_click);1331 SetLauncherMinimizeWindow(options->minimize_window_on_click);
1332 OnMonitorChanged(monitor);
12431333
1244 if (model_)1334 if (model_)
1245 {1335 {
@@ -1318,7 +1408,10 @@
1318 hovered_ = hovered;1408 hovered_ = hovered;
13191409
1320 if (!IsInKeyNavMode() && hovered_)1410 if (!IsInKeyNavMode() && hovered_)
1411 {
1321 enter_y_ = mouse_position_.y;1412 enter_y_ = mouse_position_.y;
1413 enter_x_ = mouse_position_.x;
1414 }
13221415
1323 if (folded_)1416 if (folded_)
1324 animation::StartOrReverseIf(hover_animation_, hovered_);1417 animation::StartOrReverseIf(hover_animation_, hovered_);
@@ -1334,12 +1427,18 @@
13341427
1335bool Launcher::MouseOverTopScrollArea()1428bool Launcher::MouseOverTopScrollArea()
1336{1429{
1337 return mouse_position_.y < SCROLL_AREA_HEIGHT.CP(cv_);1430 if (launcher_position_ == LauncherPosition::LEFT)
1431 return mouse_position_.y < SCROLL_AREA_HEIGHT.CP(cv_);
1432 else
1433 return mouse_position_.x < SCROLL_AREA_HEIGHT.CP(cv_);
1338}1434}
13391435
1340bool Launcher::MouseOverBottomScrollArea()1436bool Launcher::MouseOverBottomScrollArea()
1341{1437{
1342 return mouse_position_.y >= GetGeometry().height - SCROLL_AREA_HEIGHT.CP(cv_);1438 if (launcher_position_ == LauncherPosition::LEFT)
1439 return mouse_position_.y >= GetGeometry().height - SCROLL_AREA_HEIGHT.CP(cv_);
1440 else
1441 return mouse_position_.x >= GetGeometry().width - SCROLL_AREA_HEIGHT.CP(cv_);
1343}1442}
13441443
1345bool Launcher::OnScrollTimeout()1444bool Launcher::OnScrollTimeout()
@@ -1358,7 +1457,11 @@
1358 }1457 }
1359 else1458 else
1360 {1459 {
1361 int mouse_distance = (SCROLL_AREA_HEIGHT.CP(cv_) - mouse_position_.y);1460 int mouse_distance = 0;
1461 if (launcher_position_ == LauncherPosition::LEFT)
1462 mouse_distance = (SCROLL_AREA_HEIGHT.CP(cv_) - mouse_position_.y);
1463 else
1464 mouse_distance = (SCROLL_AREA_HEIGHT.CP(cv_) - mouse_position_.x);
1362 int speed = static_cast<float>(mouse_distance) / SCROLL_AREA_HEIGHT.CP(cv_) * SCROLL_FPS;1465 int speed = static_cast<float>(mouse_distance) / SCROLL_AREA_HEIGHT.CP(cv_) * SCROLL_FPS;
1363 launcher_drag_delta_ += speed;1466 launcher_drag_delta_ += speed;
1364 }1467 }
@@ -1371,7 +1474,11 @@
1371 }1474 }
1372 else1475 else
1373 {1476 {
1374 int mouse_distance = (mouse_position_.y + 1) - (GetGeometry().height - SCROLL_AREA_HEIGHT.CP(cv_));1477 int mouse_distance = 0;
1478 if (launcher_position_ == LauncherPosition::LEFT)
1479 mouse_distance = (mouse_position_.y + 1) - (GetGeometry().height - SCROLL_AREA_HEIGHT.CP(cv_));
1480 else
1481 mouse_distance = (mouse_position_.x + 1) - (GetGeometry().width - SCROLL_AREA_HEIGHT.CP(cv_));
1375 int speed = static_cast<float>(mouse_distance) / SCROLL_AREA_HEIGHT.CP(cv_) * SCROLL_FPS;1482 int speed = static_cast<float>(mouse_distance) / SCROLL_AREA_HEIGHT.CP(cv_) * SCROLL_FPS;
1376 launcher_drag_delta_ -= speed;1483 launcher_drag_delta_ -= speed;
1377 }1484 }
@@ -1533,7 +1640,10 @@
1533 AbstractLauncherIcon::icon_size = icon_size_;1640 AbstractLauncherIcon::icon_size = icon_size_;
15341641
1535 nux::Geometry const& parent_geo = parent_->GetGeometry();1642 nux::Geometry const& parent_geo = parent_->GetGeometry();
1536 Resize(nux::Point(parent_geo.x, parent_geo.y), parent_geo.height);1643 if (launcher_position_ == LauncherPosition::LEFT)
1644 Resize(nux::Point(parent_geo.x, parent_geo.y), parent_geo.height);
1645 else
1646 Resize(nux::Point(parent_geo.x, parent_geo.y), parent_geo.width);
1537}1647}
15381648
1539int Launcher::GetIconSize() const1649int Launcher::GetIconSize() const
@@ -1541,13 +1651,24 @@
1541 return icon_size_.CP(cv_);1651 return icon_size_.CP(cv_);
1542}1652}
15431653
1544void Launcher::Resize(nux::Point const& offset, int height)1654void Launcher::Resize(nux::Point const& offset, int size)
1545{1655{
1546 RawPixel width = icon_size_ + ICON_PADDING * 2 + RIGHT_LINE_WIDTH - 2;1656 RawPixel width = 0, height = 0;
15471657 if (launcher_position_ == LauncherPosition::LEFT)
1548 width = width.CP(cv_);1658 {
15491659 width = icon_size_ + ICON_PADDING * 2 + SIDE_LINE_WIDTH - 2;
1550 SetMaximumHeight(height);1660 width = width.CP(cv_);
1661 height = size;
1662 SetMaximumHeight(height);
1663 }
1664 else
1665 {
1666 height = icon_size_ + ICON_PADDING * 2 + SIDE_LINE_WIDTH - 2;
1667 height = height.CP(cv_);
1668 width = size;
1669 SetMaximumWidth(width);
1670 }
1671
1551 SetGeometry(nux::Geometry(0, 0, width, height));1672 SetGeometry(nux::Geometry(0, 0, width, height));
1552 parent_->SetGeometry(nux::Geometry(offset.x, offset.y, width, height));1673 parent_->SetGeometry(nux::Geometry(offset.x, offset.y, width, height));
15531674
@@ -1692,7 +1813,11 @@
1692 bool force_show_window;1813 bool force_show_window;
1693 nux::Geometry const& geo_absolute = GetAbsoluteGeometry();1814 nux::Geometry const& geo_absolute = GetAbsoluteGeometry();
1694 RenderArgs(args, bkg_box, &launcher_alpha, geo_absolute, force_show_window);1815 RenderArgs(args, bkg_box, &launcher_alpha, geo_absolute, force_show_window);
1695 bkg_box.width -= RIGHT_LINE_WIDTH.CP(cv_);1816
1817 if (launcher_position_ == LauncherPosition::LEFT)
1818 bkg_box.width -= SIDE_LINE_WIDTH.CP(cv_);
1819 else
1820 bkg_box.height -= SIDE_LINE_WIDTH.CP(cv_);
16961821
1697 if (options()->hide_mode != LAUNCHER_HIDE_NEVER &&1822 if (options()->hide_mode != LAUNCHER_HIDE_NEVER &&
1698 bkg_box.x + bkg_box.width <= 0 &&1823 bkg_box.x + bkg_box.width <= 0 &&
@@ -1717,10 +1842,19 @@
17171842
1718 int push_count = 1;1843 int push_count = 1;
17191844
1720 // clip vertically but not horizontally1845 if (launcher_position_ == LauncherPosition::LEFT)
1721 GfxContext.PushClippingRectangle(nux::Geometry(base.x, bkg_box.y, base.width, bkg_box.height));1846 GfxContext.PushClippingRectangle(nux::Geometry(base.x, bkg_box.y, base.width, bkg_box.height));
1847 else
1848 GfxContext.PushClippingRectangle(nux::Geometry(bkg_box.x, base.y, bkg_box.width, base.height));
17221849
1723 float reveal_progress = hide_machine_.reveal_progress;1850 float reveal_progress = hide_machine_.reveal_progress;
1851 TextureCache& cache = TextureCache::GetDefault();
1852
1853 std::string launcher_pressure_icon = "launcher_pressure_effect.png";
1854 if (launcher_position_ == LauncherPosition::BOTTOM)
1855 launcher_pressure_icon = "launcher_pressure_effect_rotated.png";
1856
1857 launcher_pressure_effect_ = cache.FindTexture(launcher_pressure_icon);
17241858
1725 if ((reveal_progress > 0 || last_reveal_progress_ > 0) && launcher_pressure_effect_.IsValid())1859 if ((reveal_progress > 0 || last_reveal_progress_ > 0) && launcher_pressure_effect_.IsValid())
1726 {1860 {
@@ -1737,7 +1871,22 @@
1737 }1871 }
1738 nux::Color pressure_color = nux::color::White * last_reveal_progress_;1872 nux::Color pressure_color = nux::color::White * last_reveal_progress_;
1739 nux::TexCoordXForm texxform_pressure;1873 nux::TexCoordXForm texxform_pressure;
1740 GfxContext.QRP_1Tex(base.x, base.y, launcher_pressure_effect_->GetWidth(), base.height,1874
1875 int pressure_y = 0, pressure_width = 0, pressure_height = 0;
1876 if (launcher_position_ == LauncherPosition::LEFT)
1877 {
1878 pressure_y = base.y;
1879 pressure_width = launcher_pressure_effect_->GetWidth();
1880 pressure_height = base.height;
1881 }
1882 else
1883 {
1884 pressure_y = base.y + base.height - SIDE_LINE_WIDTH.CP(cv_) - launcher_pressure_effect_->GetHeight();
1885 pressure_width = base.width;
1886 pressure_height = launcher_pressure_effect_->GetHeight();
1887 }
1888
1889 GfxContext.QRP_1Tex(base.x, pressure_y, pressure_width, pressure_height,
1741 launcher_pressure_effect_->GetDeviceTexture(),1890 launcher_pressure_effect_->GetDeviceTexture(),
1742 texxform_pressure,1891 texxform_pressure,
1743 pressure_color);1892 pressure_color);
@@ -1749,7 +1898,12 @@
1749 {1898 {
1750 nux::ObjectPtr<nux::IOpenGLBaseTexture> blur_texture;1899 nux::ObjectPtr<nux::IOpenGLBaseTexture> blur_texture;
17511900
1752 if (BackgroundEffectHelper::blur_type != unity::BLUR_NONE && (bkg_box.x + bkg_box.width > 0))1901 bool visible = false;
1902 if ((launcher_position_ == LauncherPosition::LEFT && (bkg_box.x + bkg_box.width > 0)) ||
1903 (launcher_position_ == LauncherPosition::BOTTOM && (bkg_box.y < bkg_box.height)))
1904 visible = true;
1905
1906 if (BackgroundEffectHelper::blur_type != unity::BLUR_NONE && visible)
1753 {1907 {
1754 blur_texture = bg_effect_helper_.GetBlurRegion();1908 blur_texture = bg_effect_helper_.GetBlurRegion();
1755 }1909 }
@@ -1849,13 +2003,42 @@
1849 icon_renderer_->PreprocessIcons(args, base);2003 icon_renderer_->PreprocessIcons(args, base);
1850 EventLogic();2004 EventLogic();
18512005
2006 if (!IsOverlayOpen() && launcher_position_ == LauncherPosition::BOTTOM)
2007 {
2008 const double top_line_opacity = 0.15f * launcher_alpha;
2009
2010 gPainter.Paint2DQuadColor(GfxContext,
2011 nux::Geometry(bkg_box.x,
2012 bkg_box.y,
2013 bkg_box.width,
2014 SIDE_LINE_WIDTH.CP(cv_)),
2015 nux::color::White * top_line_opacity);
2016
2017 gPainter.Paint2DQuadColor(GfxContext,
2018 nux::Geometry(bkg_box.x,
2019 bkg_box.y,
2020 bkg_box.width,
2021 8),
2022 nux::Color(0x70000000),
2023 nux::Color(0x00000000),
2024 nux::Color(0x00000000),
2025 nux::Color(0x70000000));
2026 }
2027
1852 /* draw launcher */2028 /* draw launcher */
1853 for (rev_it = args.rbegin(); rev_it != args.rend(); ++rev_it)2029 for (rev_it = args.rbegin(); rev_it != args.rend(); ++rev_it)
1854 {2030 {
1855 if ((*rev_it).stick_thingy)2031 if ((*rev_it).stick_thingy)
1856 gPainter.Paint2DQuadColor(GfxContext,2032 {
1857 nux::Geometry(bkg_box.x, (*rev_it).render_center.y - 3, bkg_box.width, 2),2033 if (launcher_position_ == LauncherPosition::LEFT)
1858 nux::Color(0xAAAAAAAA));2034 gPainter.Paint2DQuadColor(GfxContext,
2035 nux::Geometry(bkg_box.x, (*rev_it).render_center.y - 3, bkg_box.width, 2),
2036 nux::Color(0xAAAAAAAA));
2037 else
2038 gPainter.Paint2DQuadColor(GfxContext,
2039 nux::Geometry((*rev_it).render_center.x - 3, bkg_box.y, 2, bkg_box.height),
2040 nux::Color(0xAAAAAAAA));
2041 }
18592042
1860 if ((*rev_it).skip)2043 if ((*rev_it).skip)
1861 continue;2044 continue;
@@ -1863,14 +2046,14 @@
1863 icon_renderer_->RenderIcon(GfxContext, *rev_it, bkg_box, base);2046 icon_renderer_->RenderIcon(GfxContext, *rev_it, bkg_box, base);
1864 }2047 }
18652048
1866 if (!IsOverlayOpen())2049 if (!IsOverlayOpen() && launcher_position_ == LauncherPosition::LEFT)
1867 {2050 {
1868 const double right_line_opacity = 0.15f * launcher_alpha;2051 const double right_line_opacity = 0.15f * launcher_alpha;
18692052
1870 gPainter.Paint2DQuadColor(GfxContext,2053 gPainter.Paint2DQuadColor(GfxContext,
1871 nux::Geometry(bkg_box.x + bkg_box.width,2054 nux::Geometry(bkg_box.x + bkg_box.width,
1872 bkg_box.y,2055 bkg_box.y,
1873 RIGHT_LINE_WIDTH.CP(cv_),2056 SIDE_LINE_WIDTH.CP(cv_),
1874 bkg_box.height),2057 bkg_box.height),
1875 nux::color::White * right_line_opacity);2058 nux::color::White * right_line_opacity);
18762059
@@ -1929,7 +2112,18 @@
1929void Launcher::StartIconDragRequest(int x, int y)2112void Launcher::StartIconDragRequest(int x, int y)
1930{2113{
1931 auto const& abs_geo = GetAbsoluteGeometry();2114 auto const& abs_geo = GetAbsoluteGeometry();
1932 auto const& drag_icon = MouseIconIntersection(abs_geo.width / 2.0f, y);2115 int mouse_x = 0, mouse_y = 0;
2116 if (launcher_position_ == LauncherPosition::LEFT)
2117 {
2118 mouse_x = abs_geo.width / 2.0f;
2119 mouse_y = y;
2120 }
2121 else
2122 {
2123 mouse_x = x;
2124 mouse_y = abs_geo.height / 2.0f;
2125 }
2126 auto const& drag_icon = MouseIconIntersection(mouse_x, mouse_y);
19332127
1934 // FIXME: nux doesn't give nux::GetEventButton (button_flags) there, relying2128 // FIXME: nux doesn't give nux::GetEventButton (button_flags) there, relying
1935 // on an internal Launcher property then2129 // on an internal Launcher property then
@@ -2064,7 +2258,18 @@
2064 return;2258 return;
20652259
2066 auto const& launcher_geo = GetGeometry();2260 auto const& launcher_geo = GetGeometry();
2067 auto const& hovered_icon = MouseIconIntersection((launcher_geo.x + launcher_geo.width) / 2.0, y - GetAbsoluteY());2261 int mouse_x = 0, mouse_y = 0;
2262 if (launcher_position_ == LauncherPosition::LEFT)
2263 {
2264 mouse_x = (launcher_geo.x + launcher_geo.width) / 2.0;
2265 mouse_y = y - GetAbsoluteY();
2266 }
2267 else
2268 {
2269 mouse_x = x - GetAbsoluteX();
2270 mouse_y = (launcher_geo.y + launcher_geo.height) / 2.0;
2271 }
2272 auto const& hovered_icon = MouseIconIntersection(mouse_x, mouse_y);
2068 bool mouse_beyond_drag_threshold = MouseBeyondDragThreshold();2273 bool mouse_beyond_drag_threshold = MouseBeyondDragThreshold();
20692274
2070 if (hovered_icon && drag_icon_ != hovered_icon)2275 if (hovered_icon && drag_icon_ != hovered_icon)
@@ -2088,7 +2293,8 @@
2088 if (!icon->IsVisibleOnMonitor(monitor))2293 if (!icon->IsVisibleOnMonitor(monitor))
2089 continue;2294 continue;
20902295
2091 if (y >= icon->GetCenter(monitor).y)2296 if ((launcher_position_ == LauncherPosition::LEFT && y >= icon->GetCenter(monitor).y) ||
2297 (launcher_position_ == LauncherPosition::BOTTOM && x >= icon->GetCenter(monitor).x))
2092 {2298 {
2093 model_->ReorderAfter(drag_icon_, icon);2299 model_->ReorderAfter(drag_icon_, icon);
2094 break;2300 break;
@@ -2154,12 +2360,18 @@
2154 if (GetActionState() == ACTION_NONE)2360 if (GetActionState() == ACTION_NONE)
2155 {2361 {
2156#ifdef USE_X112362#ifdef USE_X11
2157 if (nux::Abs(dnd_delta_y_) >= nux::Abs(dnd_delta_x_))2363 if (nux::Abs(dnd_delta_y_) >= nux::Abs(dnd_delta_x_) && launcher_position_ == LauncherPosition::LEFT)
2158 {2364 {
2159 launcher_drag_delta_ += dnd_delta_y_;2365 launcher_drag_delta_ += dnd_delta_y_;
2160 SetActionState(ACTION_DRAG_LAUNCHER);2366 SetActionState(ACTION_DRAG_LAUNCHER);
2161 hide_machine_.SetQuirk(LauncherHideMachine::VERTICAL_SLIDE_ACTIVE, true);2367 hide_machine_.SetQuirk(LauncherHideMachine::VERTICAL_SLIDE_ACTIVE, true);
2162 }2368 }
2369 else if (nux::Abs(dnd_delta_x_) >= nux::Abs(dnd_delta_y_) && launcher_position_ == LauncherPosition::BOTTOM)
2370 {
2371 launcher_drag_delta_ += dnd_delta_x_;
2372 SetActionState(ACTION_DRAG_LAUNCHER);
2373 hide_machine_.SetQuirk(LauncherHideMachine::VERTICAL_SLIDE_ACTIVE, true);
2374 }
2163 else2375 else
2164 {2376 {
2165 // We we can safely start the icon drag, from the original mouse-down position2377 // We we can safely start the icon drag, from the original mouse-down position
@@ -2170,7 +2382,10 @@
2170 }2382 }
2171 else if (GetActionState() == ACTION_DRAG_LAUNCHER)2383 else if (GetActionState() == ACTION_DRAG_LAUNCHER)
2172 {2384 {
2173 launcher_drag_delta_ += dy;2385 if (launcher_position_ == LauncherPosition::LEFT)
2386 launcher_drag_delta_ += dy;
2387 else
2388 launcher_drag_delta_ += dx;
2174 }2389 }
2175 else if (GetActionState() == ACTION_DRAG_ICON)2390 else if (GetActionState() == ACTION_DRAG_ICON)
2176 {2391 {
@@ -2256,20 +2471,42 @@
2256 nux::Geometry const& abs_geo = GetAbsoluteGeometry();2471 nux::Geometry const& abs_geo = GetAbsoluteGeometry();
22572472
2258 bool apply_to_reveal = false;2473 bool apply_to_reveal = false;
2259 if (event->x >= abs_geo.x && event->x <= abs_geo.x + abs_geo.width)2474 if (launcher_position_ == LauncherPosition::LEFT)
2260 {2475 {
2261 if (!hidden_)2476 if (event->x >= abs_geo.x && event->x <= abs_geo.x + abs_geo.width)
2262 return ui::EdgeBarrierSubscriber::Result::ALREADY_HANDLED;2477 {
2478 if (!hidden_)
2479 return ui::EdgeBarrierSubscriber::Result::ALREADY_HANDLED;
22632480
2264 if (options()->reveal_trigger == RevealTrigger::EDGE)2481 if (options()->reveal_trigger == RevealTrigger::EDGE)
2265 {2482 {
2266 if (event->y >= abs_geo.y)2483 if (event->y >= abs_geo.y)
2267 apply_to_reveal = true;2484 apply_to_reveal = true;
2485 }
2486 else if (options()->reveal_trigger == RevealTrigger::CORNER)
2487 {
2488 if (event->y < abs_geo.y)
2489 apply_to_reveal = true;
2490 }
2268 }2491 }
2269 else if (options()->reveal_trigger == RevealTrigger::CORNER)2492 }
2493 else
2494 {
2495 if (event->y >= abs_geo.y && event->y <= abs_geo.y + abs_geo.height)
2270 {2496 {
2271 if (event->y < abs_geo.y)2497 if (!hidden_)
2272 apply_to_reveal = true;2498 return ui::EdgeBarrierSubscriber::Result::ALREADY_HANDLED;
2499
2500 if (options()->reveal_trigger == RevealTrigger::EDGE)
2501 {
2502 if (event->x >= abs_geo.x + panel::Style::Instance().PanelHeight(monitor()))
2503 apply_to_reveal = true;
2504 }
2505 else if (options()->reveal_trigger == RevealTrigger::CORNER)
2506 {
2507 if (event->x < abs_geo.x + panel::Style::Instance().PanelHeight(monitor()))
2508 apply_to_reveal = true;
2509 }
2273 }2510 }
2274 }2511 }
22752512
@@ -2455,6 +2692,7 @@
2455 arg.render_center = nux::Point3(roundf(texture->GetWidth() / 2.0f), roundf(texture->GetHeight() / 2.0f), 0.0f);2692 arg.render_center = nux::Point3(roundf(texture->GetWidth() / 2.0f), roundf(texture->GetHeight() / 2.0f), 0.0f);
2456 arg.logical_center = arg.render_center;2693 arg.logical_center = arg.render_center;
2457 arg.rotation.x = 0.0f;2694 arg.rotation.x = 0.0f;
2695 arg.rotation.y = 0.0f;
2458 arg.running_arrow = false;2696 arg.running_arrow = false;
2459 arg.active_arrow = false;2697 arg.active_arrow = false;
2460 arg.skip = false;2698 arg.skip = false;
@@ -2616,8 +2854,11 @@
26162854
2617 if (options()->hide_mode != LAUNCHER_HIDE_NEVER)2855 if (options()->hide_mode != LAUNCHER_HIDE_NEVER)
2618 {2856 {
2619 if (monitor() == 0 && !IsOverlayOpen() && mouse_position_.x == 0 && !drag_edge_touching_ &&2857 if ((monitor() == 0 && !IsOverlayOpen() && mouse_position_.x == 0 && !drag_edge_touching_) &&
2620 mouse_position_.y <= (parent_->GetGeometry().height - icon_size_.CP(cv_) - 2 * SPACE_BETWEEN_ICONS.CP(cv_)))2858 ((launcher_position_ == LauncherPosition::LEFT &&
2859 mouse_position_.y <= (parent_->GetGeometry().height - icon_size_.CP(cv_) - 2 * SPACE_BETWEEN_ICONS.CP(cv_))) ||
2860 (launcher_position_ == LauncherPosition::BOTTOM &&
2861 mouse_position_.x <= (parent_->GetGeometry().width - icon_size_.CP(cv_) - 2 * SPACE_BETWEEN_ICONS.CP(cv_)))))
2621 {2862 {
2622 if (dnd_hovered_icon_)2863 if (dnd_hovered_icon_)
2623 {2864 {
@@ -2628,7 +2869,9 @@
2628 animation::StartOrReverse(dnd_hide_animation_, animation::Direction::FORWARD);2869 animation::StartOrReverse(dnd_hide_animation_, animation::Direction::FORWARD);
2629 drag_edge_touching_ = true;2870 drag_edge_touching_ = true;
2630 }2871 }
2631 else if (mouse_position_.x != 0 && drag_edge_touching_)2872 else if (drag_edge_touching_ &&
2873 ((launcher_position_ == LauncherPosition::LEFT && mouse_position_.x != 0) ||
2874 (launcher_position_ == LauncherPosition::BOTTOM && mouse_position_.y != 0)))
2632 {2875 {
2633 animation::StartOrReverse(dnd_hide_animation_, animation::Direction::BACKWARD);2876 animation::StartOrReverse(dnd_hide_animation_, animation::Direction::BACKWARD);
2634 drag_edge_touching_ = false;2877 drag_edge_touching_ = false;
26352878
=== modified file 'launcher/Launcher.h'
--- launcher/Launcher.h 2015-05-21 16:30:26 +0000
+++ launcher/Launcher.h 2016-03-18 01:19:20 +0000
@@ -43,6 +43,7 @@
43#include "LauncherHoverMachine.h"43#include "LauncherHoverMachine.h"
44#include "unity-shared/MockableBaseWindow.h"44#include "unity-shared/MockableBaseWindow.h"
45#include "unity-shared/UBusWrapper.h"45#include "unity-shared/UBusWrapper.h"
46#include "unity-shared/UnitySettings.h"
46#include "SoftwareCenterLauncherIcon.h"47#include "SoftwareCenterLauncherIcon.h"
47#include "TooltipManager.h"48#include "TooltipManager.h"
4849
@@ -345,6 +346,7 @@
345 int launcher_drag_delta_;346 int launcher_drag_delta_;
346 int launcher_drag_delta_max_;347 int launcher_drag_delta_max_;
347 int launcher_drag_delta_min_;348 int launcher_drag_delta_min_;
349 int enter_x_;
348 int enter_y_;350 int enter_y_;
349 int last_button_press_;351 int last_button_press_;
350 int drag_icon_position_;352 int drag_icon_position_;
@@ -367,6 +369,9 @@
367 BaseTexturePtr launcher_pressure_effect_;369 BaseTexturePtr launcher_pressure_effect_;
368 BackgroundEffectHelper bg_effect_helper_;370 BackgroundEffectHelper bg_effect_helper_;
369371
372 LauncherPosition launcher_position_;
373 connection::Wrapper launcher_position_changed_;
374
370 nux::animation::AnimateValue<float> auto_hide_animation_;375 nux::animation::AnimateValue<float> auto_hide_animation_;
371 nux::animation::AnimateValue<float> hover_animation_;376 nux::animation::AnimateValue<float> hover_animation_;
372 nux::animation::AnimateValue<float> drag_over_animation_;377 nux::animation::AnimateValue<float> drag_over_animation_;
373378
=== modified file 'launcher/LauncherController.cpp'
--- launcher/LauncherController.cpp 2016-03-07 18:38:06 +0000
+++ launcher/LauncherController.cpp 2016-03-18 01:19:20 +0000
@@ -34,13 +34,11 @@
34#include "VolumeLauncherIcon.h"34#include "VolumeLauncherIcon.h"
35#include "FavoriteStore.h"35#include "FavoriteStore.h"
36#include "FileManagerLauncherIcon.h"36#include "FileManagerLauncherIcon.h"
37#include "HudLauncherIcon.h"
38#include "LauncherController.h"37#include "LauncherController.h"
39#include "LauncherControllerPrivate.h"38#include "LauncherControllerPrivate.h"
40#include "SoftwareCenterLauncherIcon.h"39#include "SoftwareCenterLauncherIcon.h"
41#include "ExpoLauncherIcon.h"40#include "ExpoLauncherIcon.h"
42#include "TrashLauncherIcon.h"41#include "TrashLauncherIcon.h"
43#include "BFBLauncherIcon.h"
44#include "unity-shared/AppStreamApplication.h"42#include "unity-shared/AppStreamApplication.h"
45#include "unity-shared/IconRenderer.h"43#include "unity-shared/IconRenderer.h"
46#include "unity-shared/UScreen.h"44#include "unity-shared/UScreen.h"
@@ -107,6 +105,8 @@
107 , model_(std::make_shared<LauncherModel>())105 , model_(std::make_shared<LauncherModel>())
108 , xdnd_manager_(xdnd_manager)106 , xdnd_manager_(xdnd_manager)
109 , device_section_(std::make_shared<DeviceLauncherSection>())107 , device_section_(std::make_shared<DeviceLauncherSection>())
108 , bfb_icon_(new BFBLauncherIcon())
109 , hud_icon_(new HudLauncherIcon())
110 , expo_icon_(new ExpoLauncherIcon())110 , expo_icon_(new ExpoLauncherIcon())
111 , desktop_icon_(new DesktopLauncherIcon())111 , desktop_icon_(new DesktopLauncherIcon())
112 , edge_barriers_(edge_barriers)112 , edge_barriers_(edge_barriers)
@@ -130,20 +130,28 @@
130 remote_model_.entry_added.connect(sigc::mem_fun(this, &Impl::OnLauncherEntryRemoteAdded));130 remote_model_.entry_added.connect(sigc::mem_fun(this, &Impl::OnLauncherEntryRemoteAdded));
131 remote_model_.entry_removed.connect(sigc::mem_fun(this, &Impl::OnLauncherEntryRemoteRemoved));131 remote_model_.entry_removed.connect(sigc::mem_fun(this, &Impl::OnLauncherEntryRemoteRemoved));
132132
133 LauncherHideMode hide_mode = parent_->options()->hide_mode;133 auto hide_mode = parent_->options()->hide_mode();
134 BFBLauncherIcon* bfb = new BFBLauncherIcon(hide_mode);134 bfb_icon_->SetHideMode(hide_mode);
135 RegisterIcon(AbstractLauncherIcon::Ptr(bfb));135 RegisterIcon(AbstractLauncherIcon::Ptr(bfb_icon_));
136136
137 HudLauncherIcon* hud = new HudLauncherIcon(hide_mode);137 hud_icon_->SetHideMode(hide_mode);
138 RegisterIcon(AbstractLauncherIcon::Ptr(hud));138 RegisterIcon(AbstractLauncherIcon::Ptr(hud_icon_));
139 hud_icon_ = hud;
140139
141 TrashLauncherIcon* trash = new TrashLauncherIcon();140 TrashLauncherIcon* trash = new TrashLauncherIcon();
142 RegisterIcon(AbstractLauncherIcon::Ptr(trash));141 RegisterIcon(AbstractLauncherIcon::Ptr(trash));
143142
144 parent_->options()->hide_mode.changed.connect([bfb, hud](LauncherHideMode mode) {143 parent_->options()->hide_mode.changed.connect([this] (LauncherHideMode mode) {
145 bfb->SetHideMode(mode);144 bfb_icon_->SetHideMode(mode);
146 hud->SetHideMode(mode);145 hud_icon_->SetHideMode(mode);
146 });
147
148 parent_->multiple_launchers.changed.connect([this] (bool value) {
149 UScreen* uscreen = UScreen::GetDefault();
150 auto monitors = uscreen->GetMonitors();
151 int primary = uscreen->GetPrimaryMonitor();
152 EnsureLaunchers(primary, monitors);
153 parent_->options()->show_for_all = !value;
154 hud_icon_->SetSingleLauncher(!value, primary);
147 });155 });
148156
149 WindowManager& wm = WindowManager::Default();157 WindowManager& wm = WindowManager::Default();
@@ -1049,16 +1057,7 @@
1049 : options(std::make_shared<Options>())1057 : options(std::make_shared<Options>())
1050 , multiple_launchers(true)1058 , multiple_launchers(true)
1051 , pimpl(new Impl(this, xdnd_manager, edge_barriers))1059 , pimpl(new Impl(this, xdnd_manager, edge_barriers))
1052{1060{}
1053 multiple_launchers.changed.connect([this] (bool value) {
1054 UScreen* uscreen = UScreen::GetDefault();
1055 auto monitors = uscreen->GetMonitors();
1056 int primary = uscreen->GetPrimaryMonitor();
1057 pimpl->EnsureLaunchers(primary, monitors);
1058 options()->show_for_all = !value;
1059 pimpl->hud_icon_->SetSingleLauncher(!value, primary);
1060 });
1061}
10621061
1063Controller::~Controller()1062Controller::~Controller()
1064{}1063{}
@@ -1446,35 +1445,60 @@
14461445
1447 switch (keysym)1446 switch (keysym)
1448 {1447 {
1449 // up (move selection up or go to global-menu if at top-most icon)1448 // up
1450 case NUX_VK_UP:1449 case NUX_VK_UP:
1451 case NUX_KP_UP:1450 case NUX_KP_UP:
1452 parent_->KeyNavPrevious();1451 if (Settings::Instance().launcher_position() == LauncherPosition::LEFT)
1452 // move selection up or go to global-menu if at top-most icon
1453 parent_->KeyNavPrevious();
1454 else
1455 OpenQuicklist();
1453 break;1456 break;
14541457
1455 // down (move selection down and unfold launcher if needed)1458 // down
1456 case NUX_VK_DOWN:1459 case NUX_VK_DOWN:
1457 case NUX_KP_DOWN:1460 case NUX_KP_DOWN:
1458 parent_->KeyNavNext();1461 if (Settings::Instance().launcher_position() == LauncherPosition::LEFT)
1459 break;1462 // move selection down and unfold launcher if needed
14601463 parent_->KeyNavNext();
1461 // super/control/esc/left (close quicklist or exit laucher key-focus)1464 else
1465 // exit launcher key-focus
1466 parent_->KeyNavTerminate(false);
1467 break;
1468
1469 // left
1470 case NUX_VK_LEFT:
1471 case NUX_KP_LEFT:
1472 if (Settings::Instance().launcher_position() == LauncherPosition::LEFT)
1473 parent_->KeyNavTerminate(false);
1474 else
1475 // move selection left or go to global-menu if at top-most icon or close quicklist
1476 parent_->KeyNavPrevious();
1477 break;
1478
1479 // right
1480 case NUX_VK_RIGHT:
1481 case NUX_KP_RIGHT:
1482 if (Settings::Instance().launcher_position() == LauncherPosition::LEFT)
1483 OpenQuicklist();
1484 else
1485 // move selection right and unfold launcher if needed
1486 parent_->KeyNavNext();
1487 break;
1488
1489 // super/control/esc (close quicklist or exit laucher key-focus)
1462 case NUX_VK_LWIN:1490 case NUX_VK_LWIN:
1463 case NUX_VK_RWIN:1491 case NUX_VK_RWIN:
1464 case NUX_VK_CONTROL:1492 case NUX_VK_CONTROL:
1465 case NUX_VK_LEFT:
1466 case NUX_KP_LEFT:
1467 case NUX_VK_ESCAPE:1493 case NUX_VK_ESCAPE:
1468 // hide again1494 // hide again
1469 parent_->KeyNavTerminate(false);1495 parent_->KeyNavTerminate(false);
1470 break;1496 break;
14711497
1472 // right/shift-f10 (open quicklist of currently selected icon)1498 // shift-f10 (open quicklist of currently selected icon)
1473 case XK_F10:1499 case XK_F10:
1474 if (!(state & nux::NUX_STATE_SHIFT))1500 if (!(state & nux::NUX_STATE_SHIFT))
1475 break;1501 break;
1476 case NUX_VK_RIGHT:
1477 case NUX_KP_RIGHT:
1478 case XK_Menu:1502 case XK_Menu:
1479 OpenQuicklist();1503 OpenQuicklist();
1480 break;1504 break;
14811505
=== modified file 'launcher/LauncherControllerPrivate.h'
--- launcher/LauncherControllerPrivate.h 2016-02-19 12:36:57 +0000
+++ launcher/LauncherControllerPrivate.h 2016-03-18 01:19:20 +0000
@@ -36,10 +36,11 @@
36#include "LauncherEntryRemote.h"36#include "LauncherEntryRemote.h"
37#include "LauncherEntryRemoteModel.h"37#include "LauncherEntryRemoteModel.h"
38#include "LauncherModel.h"38#include "LauncherModel.h"
39#include "BFBLauncherIcon.h"
40#include "HudLauncherIcon.h"
39#include "SoftwareCenterLauncherIcon.h"41#include "SoftwareCenterLauncherIcon.h"
40#include "unity-shared/UBusWrapper.h"42#include "unity-shared/UBusWrapper.h"
41#include "XdndManager.h"43#include "XdndManager.h"
42#include "HudLauncherIcon.h"
4344
44namespace unity45namespace unity
45{46{
@@ -124,9 +125,10 @@
124 XdndManager::Ptr xdnd_manager_;125 XdndManager::Ptr xdnd_manager_;
125 DeviceLauncherSection::Ptr device_section_;126 DeviceLauncherSection::Ptr device_section_;
126 LauncherEntryRemoteModel remote_model_;127 LauncherEntryRemoteModel remote_model_;
128 BFBLauncherIcon* bfb_icon_;
129 HudLauncherIcon* hud_icon_;
127 AbstractLauncherIcon::Ptr expo_icon_;130 AbstractLauncherIcon::Ptr expo_icon_;
128 AbstractLauncherIcon::Ptr desktop_icon_;131 AbstractLauncherIcon::Ptr desktop_icon_;
129 HudLauncherIcon* hud_icon_;
130132
131#ifdef USE_X11133#ifdef USE_X11
132 ui::EdgeBarrierController::Ptr edge_barriers_;134 ui::EdgeBarrierController::Ptr edge_barriers_;
@@ -148,7 +150,7 @@
148150
149 connection::Wrapper launcher_key_press_connection_;151 connection::Wrapper launcher_key_press_connection_;
150 connection::Wrapper launcher_event_outside_connection_;152 connection::Wrapper launcher_event_outside_connection_;
151 connection::Wrapper launcher_key_nav_terminate_; 153 connection::Wrapper launcher_key_nav_terminate_;
152 connection::Wrapper average_color_connection_;154 connection::Wrapper average_color_connection_;
153};155};
154156
155157
=== modified file 'launcher/LauncherIcon.cpp'
--- launcher/LauncherIcon.cpp 2016-02-25 15:59:41 +0000
+++ launcher/LauncherIcon.cpp 2016-03-18 01:19:20 +0000
@@ -465,7 +465,14 @@
465nux::Point LauncherIcon::GetTipPosition(int monitor) const465nux::Point LauncherIcon::GetTipPosition(int monitor) const
466{466{
467 auto const& converter = Settings::Instance().em(monitor);467 auto const& converter = Settings::Instance().em(monitor);
468 return nux::Point(_center[monitor].x + converter->CP(icon_size()) / 2 + 1, _center[monitor].y);468 if (Settings::Instance().launcher_position() == LauncherPosition::LEFT)
469 {
470 return nux::Point(_center[monitor].x + converter->CP(icon_size()) / 2 + 1, _center[monitor].y);
471 }
472 else
473 {
474 return nux::Point(_center[monitor].x, _center[monitor].y - converter->CP(icon_size()) / 2 - 1);
475 }
469}476}
470477
471void LauncherIcon::ShowTooltip()478void LauncherIcon::ShowTooltip()
472479
=== modified file 'launcher/QuicklistView.cpp'
--- launcher/QuicklistView.cpp 2015-05-20 15:31:09 +0000
+++ launcher/QuicklistView.cpp 2016-03-18 01:19:20 +0000
@@ -81,8 +81,16 @@
81{81{
82 SetGeometry(nux::Geometry(0, 0, 1, 1));82 SetGeometry(nux::Geometry(0, 0, 1, 1));
8383
84 _left_space = new nux::SpaceLayout(RawPixel(_padding + ANCHOR_WIDTH + CORNER_RADIUS + LEFT_PADDING_CORRECTION).CP(cv_),84 int width = 0;
85 RawPixel(_padding + ANCHOR_WIDTH + CORNER_RADIUS + LEFT_PADDING_CORRECTION).CP(cv_),85 int height = 0;
86 // when launcher is on the left, the anchor is on the left of the menuitem, and
87 // when launcher is on the bottom, the anchor is on the bottom of the menuitem.
88 if (Settings::Instance().launcher_position == LauncherPosition::LEFT)
89 width = ANCHOR_WIDTH;
90 else
91 height = ANCHOR_WIDTH;
92 _left_space = new nux::SpaceLayout(RawPixel(_padding + width + CORNER_RADIUS + LEFT_PADDING_CORRECTION).CP(cv_),
93 RawPixel(_padding + width + CORNER_RADIUS + LEFT_PADDING_CORRECTION).CP(cv_),
86 1, MAX_HEIGHT.CP(cv_));94 1, MAX_HEIGHT.CP(cv_));
8795
88 _right_space = new nux::SpaceLayout(_padding.CP(cv_) + CORNER_RADIUS.CP(cv_),96 _right_space = new nux::SpaceLayout(_padding.CP(cv_) + CORNER_RADIUS.CP(cv_),
@@ -94,8 +102,8 @@
94 _padding.CP(cv_) + CORNER_RADIUS.CP(cv_));102 _padding.CP(cv_) + CORNER_RADIUS.CP(cv_));
95103
96 _bottom_space = new nux::SpaceLayout(1, MAX_WIDTH.CP(cv_),104 _bottom_space = new nux::SpaceLayout(1, MAX_WIDTH.CP(cv_),
97 _padding.CP(cv_) + CORNER_RADIUS.CP(cv_),105 _padding.CP(cv_) + height + CORNER_RADIUS.CP(cv_),
98 _padding.CP(cv_) + CORNER_RADIUS.CP(cv_));106 _padding.CP(cv_) + height + CORNER_RADIUS.CP(cv_));
99107
100 _vlayout = new nux::VLayout(TEXT(""), NUX_TRACKER_LOCATION);108 _vlayout = new nux::VLayout(TEXT(""), NUX_TRACKER_LOCATION);
101 _vlayout->AddLayout(_top_space, 0);109 _vlayout->AddLayout(_top_space, 0);
@@ -129,12 +137,35 @@
129137
130int QuicklistView::CalculateX() const138int QuicklistView::CalculateX() const
131{139{
132 return _anchorX - _padding.CP(cv_);140 int x = 0;
141 if (Settings::Instance().launcher_position() == LauncherPosition::LEFT)
142 x = _anchorX - _padding.CP(cv_);
143 else
144 {
145 int size = 0;
146 int max = GetBaseWidth() - ANCHOR_HEIGHT.CP(cv_) - 2 * CORNER_RADIUS.CP(cv_) - 2 * _padding.CP(cv_);
147 if (_top_size.CP(cv_) > max)
148 {
149 size = max;
150 }
151 else if (_top_size.CP(cv_) > 0)
152 {
153 size = _top_size.CP(cv_);
154 }
155 x = _anchorX - (ANCHOR_HEIGHT.CP(cv_) / 2) - size - CORNER_RADIUS.CP(cv_) - _padding.CP(cv_);
156 }
157
158 return x;
133}159}
134160
135int QuicklistView::CalculateY() const161int QuicklistView::CalculateY() const
136{162{
137 return _anchorY - (ANCHOR_HEIGHT.CP(cv_) / 2) - _top_size.CP(cv_) - CORNER_RADIUS.CP(cv_) - _padding.CP(cv_);163 int y = 0;
164 if (Settings::Instance().launcher_position() == LauncherPosition::LEFT)
165 y = _anchorY - (ANCHOR_HEIGHT.CP(cv_) / 2) - _top_size.CP(cv_) - CORNER_RADIUS.CP(cv_) - _padding.CP(cv_);
166 else
167 y = _anchorY - GetBaseHeight() + _padding.CP(cv_);
168 return y;
138}169}
139170
140void171void
@@ -338,12 +369,29 @@
338 auto* us = UScreen::GetDefault();369 auto* us = UScreen::GetDefault();
339 int ql_monitor = us->GetMonitorAtPosition(_anchorX, _anchorY);370 int ql_monitor = us->GetMonitorAtPosition(_anchorX, _anchorY);
340 auto const& ql_monitor_geo = us->GetMonitorGeometry(ql_monitor);371 auto const& ql_monitor_geo = us->GetMonitorGeometry(ql_monitor);
341 int offscreen_size = GetBaseY() + GetBaseHeight() - (ql_monitor_geo.y + ql_monitor_geo.height);372 auto launcher_position = Settings::Instance().launcher_position();
342373
343 if (offscreen_size > 0)374 if (launcher_position == LauncherPosition::LEFT)
344 _top_size = offscreen_size + TOP_SIZE;375 {
376 int offscreen_size = GetBaseY() + GetBaseHeight() - (ql_monitor_geo.y + ql_monitor_geo.height);
377 if (offscreen_size > 0)
378 _top_size = offscreen_size + TOP_SIZE;
379 else
380 _top_size = TOP_SIZE;
381 }
345 else382 else
346 _top_size = TOP_SIZE;383 {
384 int offscreen_size_left = ql_monitor_geo.x - (_anchorX - GetBaseWidth() / 2);
385 int offscreen_size_right = _anchorX + GetBaseWidth()/2 - (ql_monitor_geo.x + ql_monitor_geo.width);
386 int half_size = (GetBaseWidth() / 2) - _padding.CP(cv_) - CORNER_RADIUS.CP(cv_) - (ANCHOR_HEIGHT.CP(cv_) / 2);
387
388 if (offscreen_size_left > 0)
389 _top_size = half_size - offscreen_size_left;
390 else if (offscreen_size_right > 0)
391 _top_size = half_size + offscreen_size_right;
392 else
393 _top_size = half_size;
394 }
347395
348 SetXY(CalculateX(), CalculateY());396 SetXY(CalculateX(), CalculateY());
349 }397 }
@@ -442,10 +490,14 @@
442 TotalItemHeight += text_extents.height;490 TotalItemHeight += text_extents.height;
443 }491 }
444492
493 int rotated_anchor_height = 0;
494 if (Settings::Instance().launcher_position() == LauncherPosition::BOTTOM)
495 rotated_anchor_height = ANCHOR_WIDTH;
496
445 if (TotalItemHeight < ANCHOR_HEIGHT.CP(cv_))497 if (TotalItemHeight < ANCHOR_HEIGHT.CP(cv_))
446 {498 {
447 int b = (ANCHOR_HEIGHT.CP(cv_) - TotalItemHeight) / 2 + _padding.CP(cv_) + CORNER_RADIUS.CP(cv_);499 int b = (ANCHOR_HEIGHT.CP(cv_) - TotalItemHeight) / 2 + _padding.CP(cv_) + CORNER_RADIUS.CP(cv_) + rotated_anchor_height;
448 int t = b + OFFSET_CORRECTION.CP(cv_);500 int t = b + OFFSET_CORRECTION.CP(cv_) - rotated_anchor_height;
449501
450 _top_space->SetMinimumHeight(t);502 _top_space->SetMinimumHeight(t);
451 _top_space->SetMaximumHeight(t);503 _top_space->SetMaximumHeight(t);
@@ -455,8 +507,8 @@
455 }507 }
456 else508 else
457 {509 {
458 int b = _padding.CP(cv_) + CORNER_RADIUS.CP(cv_);510 int b = _padding.CP(cv_) + CORNER_RADIUS.CP(cv_) + rotated_anchor_height;
459 int t = b + OFFSET_CORRECTION.CP(cv_);511 int t = b + OFFSET_CORRECTION.CP(cv_) - rotated_anchor_height;
460512
461 _top_space->SetMinimumHeight(t);513 _top_space->SetMinimumHeight(t);
462 _top_space->SetMaximumHeight(t);514 _top_space->SetMaximumHeight(t);
@@ -476,7 +528,10 @@
476528
477 UpdateTexture();529 UpdateTexture();
478530
479 int x = RawPixel(_padding + ANCHOR_WIDTH + CORNER_RADIUS + OFFSET_CORRECTION).CP(cv_);531 int width = 0;
532 if (Settings::Instance().launcher_position() == LauncherPosition::LEFT)
533 width = ANCHOR_WIDTH;
534 int x = RawPixel(_padding + width + CORNER_RADIUS + OFFSET_CORRECTION).CP(cv_);
480 int y = _top_space->GetMinimumHeight();535 int y = _top_space->GetMinimumHeight();
481536
482 for (auto const& item : _item_list)537 for (auto const& item : _item_list)
@@ -655,7 +710,9 @@
655710
656nux::Area* QuicklistView::FindAreaUnderMouse(const nux::Point& mouse_position, nux::NuxEventType event_type)711nux::Area* QuicklistView::FindAreaUnderMouse(const nux::Point& mouse_position, nux::NuxEventType event_type)
657{712{
658 if (mouse_position.x > _anchorX)713 auto launcher_position = Settings::Instance().launcher_position();
714 if ((launcher_position == LauncherPosition::LEFT && (mouse_position.x > _anchorX)) ||
715 (launcher_position == LauncherPosition::BOTTOM && (mouse_position.y < _anchorY)))
659 {716 {
660 return (CairoBaseWindow::FindAreaUnderMouse(mouse_position, event_type));717 return (CairoBaseWindow::FindAreaUnderMouse(mouse_position, event_type));
661 }718 }
@@ -864,109 +921,164 @@
864 gfloat radius,921 gfloat radius,
865 guint pad)922 guint pad)
866{923{
867 // 0 1 2 3924 // On the right of the icon: On the top of the icon:
868 // +--+--------+--+925 // 0 1 2 3 0 1 2 3
869 // | |926 // +--+--------+--+ +--+-----------+--+
870 // + 14 + 4927 // | | | |
871 // | |928 // + 14 + 4 14 + + 4
872 // | |929 // | | | |
873 // | |930 // | | | |
874 // + 13 |931 // | | | |
875 // / |932 // + 13 | | |
876 // / |933 // / | | |
877 // + 12 |934 // / | | |
878 // \ |935 // + 12 | | |
879 // \ |936 // \ | | |
880 // 11 + |937 // \ | | |
881 // | |938 // 11 + | | |
882 // | |939 // | | 13 + + 5
883 // | |940 // | | | 10 8 |
884 // 10 + + 5941 // | | 12 +--+--+ +--+--+ 6
885 // | |942 // 10 + + 5 11 \ / 7
886 // +--+--------+--+ 6943 // | | \ /
887 // 9 8 7944 // +--+--------+--+ 6 +
945 // 9 8 7 9
888946
889947
890 gfloat padding = pad;948 gfloat padding = pad;
891 int ZEROPOINT5 = 0.0f;949 int ZEROPOINT5 = 0.0f;
892950 auto launcher_position = Settings::Instance().launcher_position();
893 gfloat HeightToAnchor = ((gfloat) height - 2.0f * radius - anchor_height - 2 * padding) / 2.0f;
894 if (HeightToAnchor < 0.0f)
895 {
896 g_warning("Anchor-height and corner-radius a higher than whole texture!");
897 return;
898 }
899951
900 //gint dynamic_size = height - 2*radius - 2*padding - anchor_height;952 //gint dynamic_size = height - 2*radius - 2*padding - anchor_height;
901 //gint upper_dynamic_size = upper_size;953 //gint upper_dynamic_size = upper_size;
902 //gint lower_dynamic_size = dynamic_size - upper_dynamic_size;954 //gint lower_dynamic_size = dynamic_size - upper_dynamic_size;
903955
956 int size = 0;
957 if (launcher_position == LauncherPosition::LEFT)
958 size = height;
959 else
960 size = width;
961
962 gfloat HeightToAnchor = ((gfloat) size - 2.0f * radius - anchor_height - 2 * padding) / 2.0f;
963 if (HeightToAnchor < 0.0f)
964 {
965 g_warning("Anchor-height and corner-radius a higher than whole texture!");
966 return;
967 }
968
904 if (upper_size >= 0)969 if (upper_size >= 0)
905 {970 {
906 if (upper_size > height - 2.0f * radius - anchor_height - 2 * padding)971 if (upper_size > size - 2.0f * radius - anchor_height - 2 * padding)
907 {972 {
908 //g_warning ("[_compute_full_mask_path] incorrect upper_size value");973 //g_warning ("[_compute_full_mask_path] incorrect upper_size value");
909 HeightToAnchor = 0;974 HeightToAnchor = 0;
910 }975 }
911 else976 else
912 {977 {
913 HeightToAnchor = height - 2.0f * radius - anchor_height - 2 * padding - upper_size;978 HeightToAnchor = size - 2.0f * radius - anchor_height - 2 * padding - upper_size;
914 }979 }
915 }980 }
916 else981 else
917 {982 {
918 HeightToAnchor = (height - 2.0f * radius - anchor_height - 2 * padding) / 2.0f;983 if (launcher_position == LauncherPosition::LEFT)
984 HeightToAnchor = (size - 2.0f * radius - anchor_height - 2 * padding) / 2.0f;
985 else
986 HeightToAnchor = size - 2.0f * radius - anchor_height - 2 * padding;
919 }987 }
920988
921 cairo_translate(cr, -0.5f, -0.5f);989 cairo_translate(cr, -0.5f, -0.5f);
922990
923 // create path991 // create path
924 cairo_move_to(cr, padding + anchor_width + radius + ZEROPOINT5, padding + ZEROPOINT5); // Point 1992 if (launcher_position == LauncherPosition::LEFT)
925 cairo_line_to(cr, width - padding - radius, padding + ZEROPOINT5); // Point 2993 {
926 cairo_arc(cr,994 cairo_move_to(cr, padding + anchor_width + radius + ZEROPOINT5, padding + ZEROPOINT5); // Point 1
927 width - padding - radius + ZEROPOINT5,995 cairo_line_to(cr, width - padding - radius, padding + ZEROPOINT5); // Point 2
928 padding + radius + ZEROPOINT5,996 cairo_arc(cr,
929 radius,997 width - padding - radius + ZEROPOINT5,
930 -90.0f * G_PI / 180.0f,998 padding + radius + ZEROPOINT5,
931 0.0f * G_PI / 180.0f); // Point 4999 radius,
932 cairo_line_to(cr,1000 -90.0f * G_PI / 180.0f,
933 (gdouble) width - padding + ZEROPOINT5,1001 0.0f * G_PI / 180.0f); // Point 4
934 (gdouble) height - radius - padding + ZEROPOINT5); // Point 51002 cairo_line_to(cr,
935 cairo_arc(cr,1003 (gdouble) width - padding + ZEROPOINT5,
936 (gdouble) width - padding - radius + ZEROPOINT5,1004 (gdouble) height - radius - padding + ZEROPOINT5); // Point 5
937 (gdouble) height - padding - radius + ZEROPOINT5,1005 cairo_arc(cr,
938 radius,1006 (gdouble) width - padding - radius + ZEROPOINT5,
939 0.0f * G_PI / 180.0f,1007 (gdouble) height - padding - radius + ZEROPOINT5,
940 90.0f * G_PI / 180.0f); // Point 71008 radius,
941 cairo_line_to(cr,1009 0.0f * G_PI / 180.0f,
942 anchor_width + padding + radius + ZEROPOINT5,1010 90.0f * G_PI / 180.0f); // Point 7
943 (gdouble) height - padding + ZEROPOINT5); // Point 81011 cairo_line_to(cr,
9441012 anchor_width + padding + radius + ZEROPOINT5,
945 cairo_arc(cr,1013 (gdouble) height - padding + ZEROPOINT5); // Point 8
946 anchor_width + padding + radius + ZEROPOINT5,1014 cairo_arc(cr,
947 (gdouble) height - padding - radius,1015 anchor_width + padding + radius + ZEROPOINT5,
948 radius,1016 (gdouble) height - padding - radius,
949 90.0f * G_PI / 180.0f,1017 radius,
950 180.0f * G_PI / 180.0f); // Point 101018 90.0f * G_PI / 180.0f,
9511019 180.0f * G_PI / 180.0f); // Point 10
952 cairo_line_to(cr,1020 cairo_line_to(cr,
953 padding + anchor_width + ZEROPOINT5,1021 padding + anchor_width + ZEROPOINT5,
954 (gdouble) height - padding - radius - HeightToAnchor + ZEROPOINT5); // Point 111022 (gdouble) height - padding - radius - HeightToAnchor + ZEROPOINT5); // Point 11
955 cairo_line_to(cr,1023 cairo_line_to(cr,
956 padding + ZEROPOINT5,1024 padding + ZEROPOINT5,
957 (gdouble) height - padding - radius - HeightToAnchor - anchor_height / 2.0f + ZEROPOINT5); // Point 121025 (gdouble) height - padding - radius - HeightToAnchor - anchor_height / 2.0f + ZEROPOINT5); // Point 12
958 cairo_line_to(cr,1026 cairo_line_to(cr,
959 padding + anchor_width + ZEROPOINT5,1027 padding + anchor_width + ZEROPOINT5,
960 (gdouble) height - padding - radius - HeightToAnchor - anchor_height + ZEROPOINT5); // Point 131028 (gdouble) height - padding - radius - HeightToAnchor - anchor_height + ZEROPOINT5); // Point 13
9611029 cairo_line_to(cr, padding + anchor_width + ZEROPOINT5, padding + radius + ZEROPOINT5); // Point 14
962 cairo_line_to(cr, padding + anchor_width + ZEROPOINT5, padding + radius + ZEROPOINT5); // Point 141030 cairo_arc(cr,
963 cairo_arc(cr,1031 padding + anchor_width + radius + ZEROPOINT5,
964 padding + anchor_width + radius + ZEROPOINT5,1032 padding + radius + ZEROPOINT5,
965 padding + radius + ZEROPOINT5,1033 radius,
966 radius,1034 180.0f * G_PI / 180.0f,
967 180.0f * G_PI / 180.0f,1035 270.0f * G_PI / 180.0f);
968 270.0f * G_PI / 180.0f);1036 }
9691037 else
1038 {
1039 cairo_move_to(cr, padding + radius + ZEROPOINT5, padding + ZEROPOINT5); // Point 1
1040 cairo_line_to(cr, width - padding - radius, padding + ZEROPOINT5); // Point 2
1041 cairo_arc(cr,
1042 width - padding - radius + ZEROPOINT5,
1043 padding + radius + ZEROPOINT5,
1044 radius,
1045 -90.0f * G_PI / 180.0f,
1046 0.0f * G_PI / 180.0f); // Point 4
1047 cairo_line_to(cr,
1048 (gdouble) width - padding + ZEROPOINT5,
1049 (gdouble) height - radius - anchor_width - padding + ZEROPOINT5); // Point 5
1050 cairo_arc(cr,
1051 (gdouble) width - padding - radius + ZEROPOINT5,
1052 (gdouble) height - padding - anchor_width - radius + ZEROPOINT5,
1053 radius,
1054 0.0f * G_PI / 180.0f,
1055 90.0f * G_PI / 180.0f); // Point 7
1056 cairo_line_to(cr,
1057 (gdouble) width - padding - radius - HeightToAnchor + ZEROPOINT5,
1058 height - padding - anchor_width + ZEROPOINT5); // Point 8
1059 cairo_line_to(cr,
1060 (gdouble) width - padding - radius - HeightToAnchor - anchor_height / 2.0f + ZEROPOINT5,
1061 height - padding + ZEROPOINT5); // Point 9
1062 cairo_line_to(cr,
1063 (gdouble) width - padding - radius - HeightToAnchor - anchor_height + ZEROPOINT5,
1064 height - padding - anchor_width + ZEROPOINT5); // Point 10
1065 cairo_arc(cr,
1066 padding + radius + ZEROPOINT5,
1067 (gdouble) height - padding - anchor_width - radius,
1068 radius,
1069 90.0f * G_PI / 180.0f,
1070 180.0f * G_PI / 180.0f); // Point 11
1071 cairo_line_to(cr,
1072 padding + ZEROPOINT5,
1073 (gdouble) height - padding -anchor_width - radius + ZEROPOINT5); // Point 13
1074 cairo_line_to(cr, padding + ZEROPOINT5, padding + radius + ZEROPOINT5); // Point 14
1075 cairo_arc(cr,
1076 padding + radius + ZEROPOINT5,
1077 padding + radius + ZEROPOINT5,
1078 radius,
1079 180.0f * G_PI / 180.0f,
1080 270.0f * G_PI / 180.0f);
1081 }
970 cairo_close_path(cr);1082 cairo_close_path(cr);
971}1083}
9721084
9731085
=== modified file 'launcher/SoftwareCenterLauncherIcon.cpp'
--- launcher/SoftwareCenterLauncherIcon.cpp 2016-02-23 15:39:49 +0000
+++ launcher/SoftwareCenterLauncherIcon.cpp 2016-03-18 01:19:20 +0000
@@ -31,6 +31,7 @@
31#include "LauncherDragWindow.h"31#include "LauncherDragWindow.h"
32#include "LauncherModel.h"32#include "LauncherModel.h"
33#include "DesktopUtilities.h"33#include "DesktopUtilities.h"
34#include "unity-shared/UnitySettings.h"
3435
35namespace unity36namespace unity
36{37{
3738
=== modified file 'launcher/Tooltip.cpp'
--- launcher/Tooltip.cpp 2014-08-27 20:53:27 +0000
+++ launcher/Tooltip.cpp 2016-03-18 01:19:20 +0000
@@ -25,6 +25,7 @@
25#include <unity-shared/CairoTexture.h>25#include <unity-shared/CairoTexture.h>
26#include <unity-shared/RawPixel.h>26#include <unity-shared/RawPixel.h>
27#include <unity-shared/UnitySettings.h>27#include <unity-shared/UnitySettings.h>
28#include <unity-shared/UScreen.h>
28#include "unity-shared/DecorationStyle.h"29#include "unity-shared/DecorationStyle.h"
2930
30#include "Tooltip.h"31#include "Tooltip.h"
@@ -33,11 +34,14 @@
33{34{
34namespace35namespace
35{36{
36 const RawPixel ANCHOR_WIDTH = 14_em;37 const RawPixel ANCHOR_WIDTH = 14_em;
37 const RawPixel ANCHOR_HEIGHT = 18_em;38 const RawPixel ANCHOR_HEIGHT = 18_em;
38 const RawPixel CORNER_RADIUS = 4_em;39 const RawPixel ROTATED_ANCHOR_WIDTH = 18_em;
39 const RawPixel TEXT_PADDING = 8_em;40 const RawPixel ROTATED_ANCHOR_HEIGHT = 10_em;
40 const RawPixel MINIMUM_TEXT_WIDTH = 100_em;41 const RawPixel CORNER_RADIUS = 4_em;
42 const RawPixel LEFT_SIZE = 4_em;
43 const RawPixel TEXT_PADDING = 8_em;
44 const RawPixel MINIMUM_TEXT_WIDTH = 100_em;
41}45}
4246
43NUX_IMPLEMENT_OBJECT_TYPE(Tooltip);47NUX_IMPLEMENT_OBJECT_TYPE(Tooltip);
@@ -45,17 +49,30 @@
45 CairoBaseWindow(monitor),49 CairoBaseWindow(monitor),
46 _anchorX(0),50 _anchorX(0),
47 _anchorY(0),51 _anchorY(0),
52 _left_size(LEFT_SIZE),
48 _padding(decoration::Style::Get()->ActiveShadowRadius()),53 _padding(decoration::Style::Get()->ActiveShadowRadius()),
49 _cairo_text_has_changed(true)54 _cairo_text_has_changed(true)
50{55{
51 _hlayout = new nux::HLayout(TEXT(""), NUX_TRACKER_LOCATION);56 _hlayout = new nux::HLayout(TEXT(""), NUX_TRACKER_LOCATION);
52 _vlayout = new nux::VLayout(TEXT(""), NUX_TRACKER_LOCATION);57 _vlayout = new nux::VLayout(TEXT(""), NUX_TRACKER_LOCATION);
5358
54 _left_space = new nux::SpaceLayout(_padding.CP(cv_) + ANCHOR_WIDTH.CP(cv_), _padding.CP(cv_) + ANCHOR_WIDTH.CP(cv_), 1, 1000);59 int left_space_width = 0;
60 int bottom_space_height = 0;
61 if (Settings::Instance().launcher_position() == LauncherPosition::LEFT)
62 {
63 left_space_width = _padding.CP(cv_) + ANCHOR_WIDTH.CP(cv_);
64 bottom_space_height = _padding.CP(cv_);
65 }
66 else
67 {
68 left_space_width = _padding.CP(cv_);
69 bottom_space_height = _padding.CP(cv_) + ROTATED_ANCHOR_HEIGHT.CP(cv_);
70 }
71 _left_space = new nux::SpaceLayout(left_space_width, left_space_width, 1, 1000);
55 _right_space = new nux::SpaceLayout(_padding.CP(cv_) + CORNER_RADIUS.CP(cv_), _padding.CP(cv_) + CORNER_RADIUS.CP(cv_), 1, 1000);72 _right_space = new nux::SpaceLayout(_padding.CP(cv_) + CORNER_RADIUS.CP(cv_), _padding.CP(cv_) + CORNER_RADIUS.CP(cv_), 1, 1000);
5673
57 _top_space = new nux::SpaceLayout(1, 1000, _padding.CP(cv_), _padding.CP(cv_));74 _top_space = new nux::SpaceLayout(1, 1000, _padding.CP(cv_), _padding.CP(cv_));
58 _bottom_space = new nux::SpaceLayout(1, 1000, _padding.CP(cv_), _padding.CP(cv_));75 _bottom_space = new nux::SpaceLayout(1, 1000, bottom_space_height, bottom_space_height);
5976
60 _vlayout->AddLayout(_top_space, 0);77 _vlayout->AddLayout(_top_space, 0);
6178
@@ -96,6 +113,44 @@
96 SetLayout(_hlayout);113 SetLayout(_hlayout);
97}114}
98115
116int Tooltip::CalculateX() const
117{
118 int x = 0;
119 if (Settings::Instance().launcher_position() == LauncherPosition::LEFT)
120 {
121 x = _anchorX - _padding.CP(cv_);
122 }
123 else
124 {
125 int size = 0;
126 int max = GetBaseWidth() - ROTATED_ANCHOR_WIDTH.CP(cv_) - 2 * CORNER_RADIUS.CP(cv_) - 2 * _padding.CP(cv_);
127 if (_left_size.CP(cv_) > max)
128 {
129 size = max;
130 }
131 else if (_left_size.CP(cv_) > 0)
132 {
133 size = _left_size.CP(cv_);
134 }
135 x = _anchorX - (ROTATED_ANCHOR_WIDTH.CP(cv_) / 2) - size - CORNER_RADIUS.CP(cv_) - _padding.CP(cv_);
136 }
137 return x;
138}
139
140int Tooltip::CalculateY() const
141{
142 int y = 0;
143 if (Settings::Instance().launcher_position() == LauncherPosition::LEFT)
144 {
145 y = _anchorY - ANCHOR_HEIGHT.CP(cv_) / 2 - CORNER_RADIUS.CP(cv_) - _padding.CP(cv_);
146 }
147 else
148 {
149 y = _anchorY - GetBaseHeight() + _padding.CP(cv_);
150 }
151 return y;
152}
153
99nux::Area* Tooltip::FindAreaUnderMouse(const nux::Point& mouse_position, nux::NuxEventType event_type)154nux::Area* Tooltip::FindAreaUnderMouse(const nux::Point& mouse_position, nux::NuxEventType event_type)
100{155{
101 // No area under mouse to allow click through to entities below156 // No area under mouse to allow click through to entities below
@@ -107,10 +162,25 @@
107 _anchorX = tip_x;162 _anchorX = tip_x;
108 _anchorY = tip_y;163 _anchorY = tip_y;
109164
110 int x = _anchorX - _padding.CP(cv_);165 if (Settings::Instance().launcher_position() == LauncherPosition::BOTTOM)
111 int y = _anchorY - ANCHOR_HEIGHT.CP(cv_) / 2 - CORNER_RADIUS.CP(cv_) - _padding.CP(cv_);166 {
112167 auto* us = UScreen::GetDefault();
113 SetBaseXY(x, y);168 int monitor = us->GetMonitorAtPosition(_anchorX, _anchorY);
169 auto const& monitor_geo = us->GetMonitorGeometry(monitor);
170 int offscreen_size_right = _anchorX + GetBaseWidth()/2 - (monitor_geo.x + monitor_geo.width);
171 int offscreen_size_left = monitor_geo.x - (_anchorX - GetBaseWidth()/2);
172 int half_size = (GetBaseWidth() / 2) - _padding.CP(cv_) - CORNER_RADIUS.CP(cv_) - (ROTATED_ANCHOR_WIDTH.CP(cv_) / 2);
173
174 if (offscreen_size_left > 0)
175 _left_size = half_size - offscreen_size_left;
176 else if (offscreen_size_right > 0)
177 _left_size = half_size + offscreen_size_right;
178 else
179 _left_size = half_size;
180 _cairo_text_has_changed = true;
181 }
182
183 SetBaseXY(CalculateX(), CalculateY());
114}184}
115185
116void Tooltip::ShowTooltipWithTipAt(int x, int y)186void Tooltip::ShowTooltipWithTipAt(int x, int y)
@@ -149,7 +219,10 @@
149 space_height += (ANCHOR_HEIGHT.CP(cv_) - text_height) / 2;219 space_height += (ANCHOR_HEIGHT.CP(cv_) - text_height) / 2;
150220
151 _top_space->SetMinMaxSize(1, space_height);221 _top_space->SetMinMaxSize(1, space_height);
152 _bottom_space->SetMinMaxSize(1, space_height + 1);222 if (Settings::Instance().launcher_position() == LauncherPosition::LEFT)
223 _bottom_space->SetMinMaxSize(1, space_height + 1);
224 else
225 _bottom_space->SetMinMaxSize(1, space_height + ROTATED_ANCHOR_HEIGHT + 1);
153226
154 CairoBaseWindow::PreLayoutManagement();227 CairoBaseWindow::PreLayoutManagement();
155}228}
@@ -250,51 +323,120 @@
250 gfloat anchor_height,323 gfloat anchor_height,
251 gfloat width,324 gfloat width,
252 gfloat height,325 gfloat height,
253 gint upper_size,326 gint left_size,
254 gfloat radius,327 gfloat radius,
255 guint pad)328 guint pad)
256{329{
257330
258 // 0 1 2331 // On the right of the icon: On the top of the icon:
259 // +------------+-+332 // 0 1 2 0 1 2 3
260 // / + 3333 // +------------------+-+ +-+----------------+-+
261 // / |334 // / + 3 14 + + 4
262 // + 8 |335 // / | | |
263 // \ |336 // + 8 | | |
264 // \ + 4337 // \ | | |
265 // +------------+-+338 // \ + 4 13 + 10 8 + 5
266 // 7 6 5339 // +------------------+-+ +-+---+ +--------+-+
340 // 7 6 5 12 11 \ / 7 6
341 // + 9
267342
268 gfloat padding = pad;343 gfloat padding = pad;
269344
270 cairo_translate(cr, -0.5f, -0.5f);345 cairo_translate(cr, -0.5f, -0.5f);
271346
272 // create path347 // create path
273 cairo_move_to(cr, padding + anchor_width, padding); // Point 0348 if (Settings::Instance().launcher_position() == LauncherPosition::LEFT)
274 cairo_line_to(cr, width - padding - radius, padding); // Point 1349 {
275 cairo_arc(cr,350 cairo_move_to(cr, padding + anchor_width, padding); // Point 0
276 width - padding - radius,351 cairo_line_to(cr, width - padding - radius, padding); // Point 1
277 padding + radius,352 cairo_arc(cr,
278 radius,353 width - padding - radius,
279 -90.0f * G_PI / 180.0f,354 padding + radius,
280 0.0f * G_PI / 180.0f); // Point 3355 radius,
281 cairo_line_to(cr,356 -90.0f * G_PI / 180.0f,
282 (gdouble) width - padding,357 0.0f * G_PI / 180.0f); // Point 3
283 (gdouble) height - radius - padding); // Point 4358 cairo_line_to(cr,
284 cairo_arc(cr,359 (gdouble) width - padding,
285 (gdouble) width - padding - radius,360 (gdouble) height - radius - padding); // Point 4
286 (gdouble) height - padding - radius,361 cairo_arc(cr,
287 radius,362 (gdouble) width - padding - radius,
288 0.0f * G_PI / 180.0f,363 (gdouble) height - padding - radius,
289 90.0f * G_PI / 180.0f); // Point 6364 radius,
290 cairo_line_to(cr,365 0.0f * G_PI / 180.0f,
291 anchor_width + padding,366 90.0f * G_PI / 180.0f); // Point 6
292 (gdouble) height - padding); // Point 7367 cairo_line_to(cr,
293368 anchor_width + padding,
294 cairo_line_to(cr,369 (gdouble) height - padding); // Point 7
295 padding,370
296 (gdouble) height / 2.0f); // Point 8371 cairo_line_to(cr,
297372 padding,
373 (gdouble) height / 2.0f); // Point 8
374 }
375 else
376 {
377 gfloat WidthToAnchor = ((gfloat) width - 2.0f * radius - anchor_width - 2 * padding) / 2.0f;
378 if (WidthToAnchor < 0.0f)
379 {
380 g_warning("Anchor-width and corner-radius a wider than whole texture!");
381 return;
382 }
383
384 if (left_size > width - 2.0f * radius - anchor_width - 2 * padding)
385 {
386 WidthToAnchor = 0;
387 }
388 else if (left_size < 0)
389 {
390 WidthToAnchor = width - 2.0f * radius - anchor_width - 2 * padding;
391 }
392 else
393 {
394 WidthToAnchor = width - 2.0f * radius - anchor_width - 2 * padding - left_size;
395 }
396
397 cairo_move_to(cr, padding + radius, padding); // Point 1
398 cairo_line_to(cr, width - padding - radius, padding); // Point 2
399 cairo_arc(cr,
400 width - padding - radius,
401 padding + radius,
402 radius,
403 -90.0f * G_PI / 180.0f,
404 0.0f * G_PI / 180.0f); // Point 4
405 cairo_line_to(cr,
406 (gdouble) width - padding,
407 (gdouble) height - radius - anchor_height - padding); // Point 5
408 cairo_arc(cr,
409 (gdouble) width - padding - radius,
410 (gdouble) height - padding - anchor_height - radius,
411 radius,
412 0.0f * G_PI / 180.0f,
413 90.0f * G_PI / 180.0f); // Point 7
414 cairo_line_to(cr,
415 (gdouble) width - padding - radius - WidthToAnchor,
416 height - padding - anchor_height); // Point 8
417 cairo_line_to(cr,
418 (gdouble) width - padding - radius - WidthToAnchor - anchor_width / 2.0f,
419 height - padding); // Point 9
420 cairo_line_to(cr,
421 (gdouble) width - padding - radius - WidthToAnchor - anchor_width,
422 height - padding - anchor_height); // Point 10
423 cairo_arc(cr,
424 padding + radius,
425 (gdouble) height - padding - anchor_height - radius,
426 radius,
427 90.0f * G_PI / 180.0f,
428 180.0f * G_PI / 180.0f); // Point 11
429 cairo_line_to(cr,
430 padding,
431 (gdouble) height - padding -anchor_height - radius); // Point 13
432 cairo_line_to(cr, padding, padding + radius); // Point 14
433 cairo_arc(cr,
434 padding + radius,
435 padding + radius,
436 radius,
437 180.0f * G_PI / 180.0f,
438 270.0f * G_PI / 180.0f);
439 }
298 cairo_close_path(cr);440 cairo_close_path(cr);
299}441}
300442
@@ -388,7 +530,7 @@
388 gfloat height,530 gfloat height,
389 gfloat anchor_width,531 gfloat anchor_width,
390 gfloat anchor_height,532 gfloat anchor_height,
391 gint upper_size,533 gint left_size,
392 gfloat corner_radius,534 gfloat corner_radius,
393 guint blur_coeff,535 guint blur_coeff,
394 nux::Color const& shadow_color,536 nux::Color const& shadow_color,
@@ -402,7 +544,7 @@
402 anchor_height,544 anchor_height,
403 width,545 width,
404 height,546 height,
405 upper_size,547 left_size,
406 corner_radius,548 corner_radius,
407 padding_size);549 padding_size);
408550
@@ -421,7 +563,7 @@
421 gfloat radius,563 gfloat radius,
422 gfloat anchor_width,564 gfloat anchor_width,
423 gfloat anchor_height,565 gfloat anchor_height,
424 gint upper_size,566 gint left_size,
425 gboolean negative,567 gboolean negative,
426 gboolean outline,568 gboolean outline,
427 gfloat line_width,569 gfloat line_width,
@@ -434,7 +576,7 @@
434 anchor_height,576 anchor_height,
435 width,577 width,
436 height,578 height,
437 upper_size,579 left_size,
438 radius,580 radius,
439 padding_size);581 padding_size);
440 _finalize(&cr, outline, line_width, color, negative, outline);582 _finalize(&cr, outline, line_width, color, negative, outline);
@@ -445,12 +587,22 @@
445 if (_cairo_text_has_changed == false)587 if (_cairo_text_has_changed == false)
446 return;588 return;
447589
590 SetTooltipPosition(_anchorX, _anchorY);
591
448 int width = GetBaseWidth();592 int width = GetBaseWidth();
449 int height = GetBaseHeight();593 int height = GetBaseHeight();
450594 int anchor_width = 0;
451 int x = _anchorX - _padding.CP(cv_);595 int anchor_height = 0;
452 int y = _anchorY - height / 2;596 if (Settings::Instance().launcher_position == LauncherPosition::LEFT)
453 SetXY(x, y);597 {
598 anchor_width = ANCHOR_WIDTH;
599 anchor_height = ANCHOR_HEIGHT;
600 }
601 else
602 {
603 anchor_width = ROTATED_ANCHOR_WIDTH;
604 anchor_height = ROTATED_ANCHOR_HEIGHT;
605 }
454606
455 auto const& deco_style = decoration::Style::Get();607 auto const& deco_style = decoration::Style::Get();
456 float dpi_scale = cv_->DPIScale();608 float dpi_scale = cv_->DPIScale();
@@ -499,9 +651,9 @@
499 cairo_outline.GetSurface(),651 cairo_outline.GetSurface(),
500 width / dpi_scale,652 width / dpi_scale,
501 height / dpi_scale,653 height / dpi_scale,
502 ANCHOR_WIDTH,654 anchor_width,
503 ANCHOR_HEIGHT,655 anchor_height,
504 -1,656 _left_size,
505 CORNER_RADIUS,657 CORNER_RADIUS,
506 blur_coef,658 blur_coef,
507 shadow_color,659 shadow_color,
@@ -515,9 +667,9 @@
515 width / dpi_scale,667 width / dpi_scale,
516 height / dpi_scale,668 height / dpi_scale,
517 CORNER_RADIUS, // radius,669 CORNER_RADIUS, // radius,
518 ANCHOR_WIDTH, // anchor_width,670 anchor_width, // anchor_width,
519 ANCHOR_HEIGHT, // anchor_height,671 anchor_height, // anchor_height,
520 -1, // upper_size,672 _left_size, // left_size,
521 true, // negative,673 true, // negative,
522 false, // outline,674 false, // outline,
523 1.0, // line_width,675 1.0, // line_width,
524676
=== modified file 'launcher/Tooltip.h'
--- launcher/Tooltip.h 2014-03-24 23:44:58 +0000
+++ launcher/Tooltip.h 2016-03-18 01:19:20 +0000
@@ -73,8 +73,12 @@
73 void NotifyConfigurationChange(int width,73 void NotifyConfigurationChange(int width,
74 int height);74 int height);
7575
76 int CalculateX() const;
77 int CalculateY() const;
78
76 int _anchorX;79 int _anchorX;
77 int _anchorY;80 int _anchorY;
81 RawPixel _left_size; // size of the segment from point 10 to 11, used when launcher at bottom.
78 RawPixel _padding;82 RawPixel _padding;
7983
80 nux::HLayout* _hlayout;84 nux::HLayout* _hlayout;
8185
=== modified file 'panel/PanelView.cpp'
--- panel/PanelView.cpp 2016-03-07 18:37:24 +0000
+++ panel/PanelView.cpp 2016-03-18 01:19:20 +0000
@@ -368,7 +368,8 @@
368368
369 int refine_x_pos = geo.x + (stored_dash_width_ - refine_gradient_midpoint);369 int refine_x_pos = geo.x + (stored_dash_width_ - refine_gradient_midpoint);
370370
371 refine_x_pos += unity::Settings::Instance().LauncherWidth(monitor_);371 if (Settings::Instance().launcher_position() == LauncherPosition::LEFT)
372 refine_x_pos += unity::Settings::Instance().LauncherSize(monitor_);
372 GfxContext.QRP_1Tex(refine_x_pos, geo.y,373 GfxContext.QRP_1Tex(refine_x_pos, geo.y,
373 bg_refine_tex_->GetWidth(),374 bg_refine_tex_->GetWidth(),
374 bg_refine_tex_->GetHeight(),375 bg_refine_tex_->GetHeight(),
@@ -465,7 +466,8 @@
465 nux::Geometry refine_geo = geo;466 nux::Geometry refine_geo = geo;
466467
467 int refine_x_pos = geo.x + (stored_dash_width_ - refine_gradient_midpoint);468 int refine_x_pos = geo.x + (stored_dash_width_ - refine_gradient_midpoint);
468 refine_x_pos += unity::Settings::Instance().LauncherWidth(monitor_);469 if (Settings::Instance().launcher_position() == LauncherPosition::LEFT)
470 refine_x_pos += unity::Settings::Instance().LauncherSize(monitor_);
469471
470 refine_geo.x = refine_x_pos;472 refine_geo.x = refine_x_pos;
471 refine_geo.width = bg_refine_tex_->GetWidth();473 refine_geo.width = bg_refine_tex_->GetWidth();
472474
=== modified file 'plugins/unityshell/src/unityshell.cpp'
--- plugins/unityshell/src/unityshell.cpp 2016-03-09 17:30:50 +0000
+++ plugins/unityshell/src/unityshell.cpp 2016-03-18 01:19:20 +0000
@@ -77,6 +77,7 @@
77#include "UScreen.h"77#include "UScreen.h"
7878
79#include "config.h"79#include "config.h"
80#include "unity-shared/UnitySettings.h"
8081
81/* FIXME: once we get a better method to add the toplevel windows to82/* FIXME: once we get a better method to add the toplevel windows to
82 the accessible root object, this include would not be required */83 the accessible root object, this include would not be required */
@@ -3826,9 +3827,9 @@
3826 }3827 }
38273828
3828 auto max_bounds = NuxGeometryFromCompRect(output.workArea());3829 auto max_bounds = NuxGeometryFromCompRect(output.workArea());
3829 if (launcher_controller_->options()->hide_mode != LAUNCHER_HIDE_NEVER)3830 if (launcher_controller_->options()->hide_mode != LAUNCHER_HIDE_NEVER && Settings::Instance().launcher_position() == LauncherPosition::LEFT)
3830 {3831 {
3831 int monitor_width = unity_settings_.LauncherWidth(monitor);3832 int monitor_width = unity_settings_.LauncherSize(monitor);
3832 max_bounds.x += monitor_width;3833 max_bounds.x += monitor_width;
3833 max_bounds.width -= monitor_width;3834 max_bounds.width -= monitor_width;
3834 }3835 }
@@ -4071,22 +4072,35 @@
4071 manager->PromptLockScreen();4072 manager->PromptLockScreen();
40724073
4073 auto on_launcher_size_changed = [this] (nux::Area* area, int w, int h) {4074 auto on_launcher_size_changed = [this] (nux::Area* area, int w, int h) {
4074 /* The launcher geometry includes 1px used to draw the right margin4075 /* The launcher geometry includes 1px used to draw the right/top margin
4075 * that must not be considered when drawing an overlay */4076 * that must not be considered when drawing an overlay */
40764077
4077 auto* launcher = static_cast<Launcher*>(area);4078 auto* launcher = static_cast<Launcher*>(area);
4078 int launcher_width = w - (1_em).CP(unity_settings_.em(launcher->monitor)->DPIScale());4079 auto launcher_position = Settings::Instance().launcher_position();
40794080
4080 unity::Settings::Instance().SetLauncherWidth(launcher_width, launcher->monitor);4081 int size = 0;
4081 shortcut_controller_->SetAdjustment(launcher_width, panel_style_.PanelHeight(launcher->monitor));4082 if (launcher_position == LauncherPosition::LEFT)
40824083 size = w;
4083 CompOption::Value v(launcher_width);4084 else
4084 screen->setOptionForPlugin("expo", "x_offset", v);4085 size = h;
40854086 int launcher_size = size - (1_em).CP(unity_settings_.em(launcher->monitor)->DPIScale());
4086 if (launcher_controller_->options()->hide_mode == LAUNCHER_HIDE_NEVER)4087
4087 v.set(0);4088 unity::Settings::Instance().SetLauncherSize(launcher_size, launcher->monitor);
40884089 int adjustment_x = 0;
4089 screen->setOptionForPlugin("scale", "x_offset", v);4090 if (launcher_position == LauncherPosition::LEFT)
4091 adjustment_x = launcher_size;
4092 shortcut_controller_->SetAdjustment(adjustment_x, panel_style_.PanelHeight(launcher->monitor));
4093
4094 if (launcher_position == LauncherPosition::LEFT)
4095 {
4096 CompOption::Value v(launcher_size);
4097 screen->setOptionForPlugin("expo", "x_offset", v);
4098
4099 if (launcher_controller_->options()->hide_mode == LAUNCHER_HIDE_NEVER)
4100 v.set(0);
4101
4102 screen->setOptionForPlugin("scale", "x_offset", v);
4103 }
4090 };4104 };
40914105
4092 auto check_launchers_size = [this, on_launcher_size_changed] {4106 auto check_launchers_size = [this, on_launcher_size_changed] {
40934107
=== added file 'resources/launcher_arrow_btt_19.svg'
--- resources/launcher_arrow_btt_19.svg 1970-01-01 00:00:00 +0000
+++ resources/launcher_arrow_btt_19.svg 2016-03-18 01:19:20 +0000
@@ -0,0 +1,18 @@
1<?xml version="1.0" encoding="utf-8"?>
2<!-- Generator: Adobe Illustrator 15.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
3<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
4<svg version="1.1"
5 id="svg2" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:cc="http://creativecommons.org/ns#" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:svg="http://www.w3.org/2000/svg" xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" inkscape:version="0.48+devel r" sodipodi:docname="launcher_arrow_ltr.svg" inkscape:export-ydpi="90" inkscape:export-xdpi="90" inkscape:export-filename="test.png"
6 xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" width="18.992px"
7 height="10.006px" viewBox="0 0 18.992 10.006" enable-background="new 0 0 18.992 10.006" xml:space="preserve">
8<sodipodi:namedview id="base" inkscape:cx="6.1247407" showgrid="true" borderopacity="1.0" bordercolor="#666666" inkscape:cy="9.1968087" pagecolor="#5c48bb" inkscape:bbox-nodes="true" inkscape:bbox-paths="true" inkscape:snap-bbox="true" inkscape:snap-text-baseline="false" inkscape:snap-object-midpoints="true" inkscape:snap-smooth-nodes="true" inkscape:snap-intersection-paths="true" inkscape:snap-bbox-midpoints="true" inkscape:snap-bbox-edge-midpoints="true" inkscape:window-maximized="1" inkscape:zoom="59.292307" inkscape:window-y="24" inkscape:window-x="65" inkscape:window-height="1056" inkscape:window-width="1855" inkscape:current-layer="layer1" inkscape:document-units="px" inkscape:pageshadow="2" inkscape:pageopacity="0" inkscape:snap-page="true" inkscape:snap-center="true" inkscape:snap-midpoints="true" inkscape:object-nodes="true" inkscape:object-paths="true">
9 <inkscape:grid type="xygrid" enabled="true" visible="true" id="grid4740" snapvisiblegridlinesonly="true" empspacing="8">
10 </inkscape:grid>
11</sodipodi:namedview>
12<g id="layer1" transform="translate(0,-1033.3622)" inkscape:label="Layer 1" inkscape:groupmode="layer">
13 <path id="path5726" inkscape:connector-curvature="0" sodipodi:nodetypes="cccc" opacity="0.14" enable-background="new " d="
14 M4.696,1043.368l4.8-6.316l4.8,6.316H4.696z"/>
15 <path id="path4097" inkscape:connector-curvature="0" sodipodi:nodetypes="cccc" fill="#FFFFFF" d="M5.696,1043.368l3.8-5.001
16 l3.802,5.001H5.696z"/>
17</g>
18</svg>
019
=== added file 'resources/launcher_arrow_btt_37.svg'
--- resources/launcher_arrow_btt_37.svg 1970-01-01 00:00:00 +0000
+++ resources/launcher_arrow_btt_37.svg 2016-03-18 01:19:20 +0000
@@ -0,0 +1,21 @@
1<?xml version="1.0" encoding="utf-8"?>
2<!-- Generator: Adobe Illustrator 15.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
3<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
4<svg version="1.1"
5 id="svg2" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:cc="http://creativecommons.org/ns#" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:svg="http://www.w3.org/2000/svg" xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" inkscape:version="0.48+devel r" sodipodi:docname="launcher_arrow_large_ltr.svg" inkscape:export-ydpi="90" inkscape:export-xdpi="90" inkscape:export-filename="test.png"
6 xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" width="36.992px"
7 height="20.012px" viewBox="0 0 36.992 20.012" enable-background="new 0 0 36.992 20.012" xml:space="preserve">
8<sodipodi:namedview id="base" inkscape:cx="-5.367523" showgrid="true" borderopacity="1.0" bordercolor="#666666" inkscape:cy="31.963893" pagecolor="#5c48bb" inkscape:bbox-nodes="true" inkscape:bbox-paths="true" inkscape:snap-bbox="true" inkscape:snap-object-midpoints="true" inkscape:snap-smooth-nodes="true" inkscape:snap-intersection-paths="true" inkscape:snap-bbox-midpoints="true" inkscape:snap-bbox-edge-midpoints="true" inkscape:window-maximized="1" showguides="false" inkscape:zoom="9.3132256" inkscape:snap-grids="false" inkscape:guide-bbox="true" inkscape:window-y="24" inkscape:window-x="65" inkscape:window-height="1056" inkscape:window-width="1855" inkscape:current-layer="layer1" inkscape:document-units="px" inkscape:pageshadow="2" inkscape:pageopacity="0" inkscape:snap-page="true" inkscape:snap-center="true" inkscape:snap-midpoints="true" inkscape:object-nodes="true" inkscape:object-paths="true">
9 <inkscape:grid type="xygrid" enabled="true" visible="true" id="grid4740" snapvisiblegridlinesonly="true" empspacing="8">
10 </inkscape:grid>
11 <sodipodi:guide id="guide3004" position="8,19" orientation="0,1"></sodipodi:guide>
12</sodipodi:namedview>
13<g id="layer1" transform="translate(0,-1015.3622)" inkscape:label="Layer 1" inkscape:groupmode="layer">
14
15 <path id="path5730" inkscape:connector-curvature="0" inkscape:transform-center-x="16.337474" sodipodi:nodetypes="cccc" opacity="0.14" enable-background="new " d="
16 M8.014,1035.374l9.944-12.785l9.945,12.785H8.014z"/>
17
18 <path id="path4079" inkscape:connector-curvature="0" inkscape:transform-center-x="14.694444" sodipodi:nodetypes="cccc" fill="#FFFFFF" d="
19 M9.014,1035.374l8.944-11.5l8.944,11.5H9.014z"/>
20</g>
21</svg>
022
=== added file 'resources/launcher_arrow_outline_btt_19.svg'
--- resources/launcher_arrow_outline_btt_19.svg 1970-01-01 00:00:00 +0000
+++ resources/launcher_arrow_outline_btt_19.svg 2016-03-18 01:19:20 +0000
@@ -0,0 +1,15 @@
1<?xml version="1.0" encoding="utf-8"?>
2<!-- Generator: Adobe Illustrator 15.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
3<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
4<svg version="1.1"
5 id="svg2" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:cc="http://creativecommons.org/ns#" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:svg="http://www.w3.org/2000/svg" xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" inkscape:version="0.48+devel r" sodipodi:docname="launcher_arrow_outline_ltr.svg" inkscape:export-ydpi="90" inkscape:export-xdpi="90" inkscape:export-filename="test.png"
6 xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" width="18.992px"
7 height="10.006px" viewBox="0 0 18.992 10.006" enable-background="new 0 0 18.992 10.006" xml:space="preserve">
8<sodipodi:namedview id="base" inkscape:cx="2.8593254" showgrid="true" borderopacity="1.0" bordercolor="#666666" inkscape:cy="8.2525377" pagecolor="#5c48bb" inkscape:bbox-nodes="true" inkscape:bbox-paths="true" inkscape:snap-bbox="true" inkscape:snap-text-baseline="false" inkscape:snap-object-midpoints="true" inkscape:snap-smooth-nodes="true" inkscape:snap-intersection-paths="true" inkscape:snap-bbox-midpoints="true" inkscape:snap-bbox-edge-midpoints="true" inkscape:window-maximized="1" inkscape:zoom="92.64423" inkscape:window-y="24" inkscape:window-x="65" inkscape:window-height="1056" inkscape:window-width="1855" inkscape:current-layer="layer1" inkscape:document-units="px" inkscape:pageshadow="2" inkscape:pageopacity="0" inkscape:snap-page="true" inkscape:snap-center="true" inkscape:snap-midpoints="true" inkscape:object-nodes="true" inkscape:object-paths="true">
9 <inkscape:grid type="xygrid" enabled="true" visible="true" id="grid4740" snapvisiblegridlinesonly="true" empspacing="8">
10 </inkscape:grid>
11</sodipodi:namedview>
12<path id="path5726" opacity="0.14" enable-background="new " d="M5.008,10.006h3.496L9.809,8.29l1.305,1.716h3.496L9.809,3.689
13 L5.008,10.006z"/>
14<path id="path4097" fill="#FFFFFF" d="M6.008,10.006h1.52l2.281-3l2.281,3h1.52l-3.801-5L6.008,10.006z"/>
15</svg>
016
=== added file 'resources/launcher_arrow_outline_btt_37.svg'
--- resources/launcher_arrow_outline_btt_37.svg 1970-01-01 00:00:00 +0000
+++ resources/launcher_arrow_outline_btt_37.svg 2016-03-18 01:19:20 +0000
@@ -0,0 +1,19 @@
1<?xml version="1.0" encoding="utf-8"?>
2<!-- Generator: Adobe Illustrator 15.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
3<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
4<svg version="1.1"
5 id="svg2" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:cc="http://creativecommons.org/ns#" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:svg="http://www.w3.org/2000/svg" xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" inkscape:version="0.48+devel r" sodipodi:docname="launcher_arrow_large_outline_ltr.svg" inkscape:export-ydpi="90" inkscape:export-xdpi="90" inkscape:export-filename="test.png"
6 xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" width="36.992px"
7 height="20.012px" viewBox="0 0 36.992 20.012" enable-background="new 0 0 36.992 20.012" xml:space="preserve">
8<sodipodi:namedview id="base" inkscape:cx="-2.301892" showgrid="true" borderopacity="1.0" bordercolor="#666666" inkscape:cy="19.020977" pagecolor="#5c48bb" inkscape:bbox-nodes="true" inkscape:bbox-paths="true" inkscape:snap-bbox="true" inkscape:snap-object-midpoints="true" inkscape:snap-smooth-nodes="true" inkscape:snap-intersection-paths="true" inkscape:snap-bbox-midpoints="true" inkscape:snap-bbox-edge-midpoints="true" inkscape:window-maximized="1" showguides="false" inkscape:zoom="22.737367" inkscape:snap-grids="false" inkscape:guide-bbox="true" inkscape:window-y="24" inkscape:window-x="65" inkscape:window-height="1056" inkscape:window-width="1855" inkscape:current-layer="layer1" inkscape:document-units="px" inkscape:pageshadow="2" inkscape:pageopacity="0" inkscape:snap-page="true" inkscape:snap-center="true" inkscape:snap-midpoints="true" inkscape:object-nodes="true" inkscape:object-paths="true">
9 <inkscape:grid type="xygrid" enabled="true" visible="true" id="grid4740" snapvisiblegridlinesonly="true" empspacing="8">
10 </inkscape:grid>
11 <sodipodi:guide id="guide3004" position="8,19" orientation="0,1"></sodipodi:guide>
12</sodipodi:namedview>
13<g id="layer1" transform="translate(0,-1015.3622)" inkscape:label="Layer 1" inkscape:groupmode="layer">
14 <path id="path5730" inkscape:connector-curvature="0" opacity="0.14" enable-background="new " d="M8.551,1035.374l9.945-12.785
15 l9.946,12.785h-4.899l-5.045-6.486l-5.045,6.486H8.551z"/>
16 <path id="path4079" inkscape:connector-curvature="0" fill="#FFFFFF" d="M9.551,1035.374h2.957l5.988-7.699l5.989,7.699h2.957
17 l-8.946-11.5L9.551,1035.374z"/>
18</g>
19</svg>
020
=== added file 'resources/launcher_arrow_ttb_19.svg'
--- resources/launcher_arrow_ttb_19.svg 1970-01-01 00:00:00 +0000
+++ resources/launcher_arrow_ttb_19.svg 2016-03-18 01:19:20 +0000
@@ -0,0 +1,16 @@
1<?xml version="1.0" encoding="utf-8"?>
2<!-- Generator: Adobe Illustrator 15.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
3<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
4<svg version="1.1"
5 id="svg2" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:svg="http://www.w3.org/2000/svg" xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:cc="http://creativecommons.org/ns#" inkscape:version="0.48+devel r" sodipodi:docname="launcher_arrow_ltr.svg" inkscape:export-xdpi="90" inkscape:export-ydpi="90" inkscape:export-filename="test.png"
6 xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" width="18.992px"
7 height="10.006px" viewBox="0 0 18.992 10.006" enable-background="new 0 0 18.992 10.006" xml:space="preserve">
8<sodipodi:namedview id="base" inkscape:cx="6.1247407" inkscape:window-maximized="1" inkscape:snap-bbox-edge-midpoints="true" inkscape:snap-bbox-midpoints="true" inkscape:snap-intersection-paths="true" inkscape:snap-smooth-nodes="true" inkscape:snap-object-midpoints="true" inkscape:snap-text-baseline="false" pagecolor="#5c48bb" inkscape:cy="9.1968087" bordercolor="#666666" borderopacity="1.0" showgrid="true" inkscape:zoom="59.292307" inkscape:snap-bbox="true" inkscape:bbox-paths="true" inkscape:bbox-nodes="true" inkscape:object-paths="true" inkscape:object-nodes="true" inkscape:snap-midpoints="true" inkscape:snap-center="true" inkscape:snap-page="true" inkscape:pageopacity="0" inkscape:pageshadow="2" inkscape:document-units="px" inkscape:current-layer="layer1" inkscape:window-width="1855" inkscape:window-height="1056" inkscape:window-x="65" inkscape:window-y="24">
9 <inkscape:grid type="xygrid" visible="true" enabled="true" id="grid4740" snapvisiblegridlinesonly="true" empspacing="8">
10 </inkscape:grid>
11</sodipodi:namedview>
12<path id="path5726" inkscape:connector-curvature="0" sodipodi:nodetypes="cccc" opacity="0.14" enable-background="new " d="
13 M14.296,0l-4.8,6.316L4.696,0H14.296z"/>
14<path id="path4097" inkscape:connector-curvature="0" sodipodi:nodetypes="cccc" fill="#FFFFFF" d="M13.296,0l-3.8,5L5.695,0H13.296
15 z"/>
16</svg>
017
=== added file 'resources/launcher_arrow_ttb_37.svg'
--- resources/launcher_arrow_ttb_37.svg 1970-01-01 00:00:00 +0000
+++ resources/launcher_arrow_ttb_37.svg 2016-03-18 01:19:20 +0000
@@ -0,0 +1,21 @@
1<?xml version="1.0" encoding="utf-8"?>
2<!-- Generator: Adobe Illustrator 15.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
3<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
4<svg version="1.1"
5 id="svg2" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:svg="http://www.w3.org/2000/svg" xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:cc="http://creativecommons.org/ns#" inkscape:version="0.48+devel r" sodipodi:docname="launcher_arrow_large_ltr.svg" inkscape:export-xdpi="90" inkscape:export-ydpi="90" inkscape:export-filename="test.png"
6 xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" width="36.992px"
7 height="20.012px" viewBox="0 0 36.992 20.012" enable-background="new 0 0 36.992 20.012" xml:space="preserve">
8<sodipodi:namedview id="base" inkscape:cx="-5.367523" inkscape:window-maximized="1" inkscape:snap-bbox-edge-midpoints="true" inkscape:snap-bbox-midpoints="true" inkscape:snap-intersection-paths="true" inkscape:snap-smooth-nodes="true" inkscape:snap-object-midpoints="true" showguides="false" pagecolor="#5c48bb" inkscape:cy="31.963893" bordercolor="#666666" borderopacity="1.0" showgrid="true" inkscape:zoom="9.3132256" inkscape:snap-bbox="true" inkscape:bbox-paths="true" inkscape:bbox-nodes="true" inkscape:object-paths="true" inkscape:object-nodes="true" inkscape:snap-midpoints="true" inkscape:snap-center="true" inkscape:snap-page="true" inkscape:pageopacity="0" inkscape:pageshadow="2" inkscape:document-units="px" inkscape:current-layer="layer1" inkscape:window-width="1855" inkscape:window-height="1056" inkscape:window-x="65" inkscape:window-y="24" inkscape:guide-bbox="true" inkscape:snap-grids="false">
9 <inkscape:grid type="xygrid" visible="true" enabled="true" id="grid4740" snapvisiblegridlinesonly="true" empspacing="8">
10 </inkscape:grid>
11 <sodipodi:guide id="guide3004" orientation="0,1" position="8,19"></sodipodi:guide>
12</sodipodi:namedview>
13<g id="layer1" transform="translate(0,-1015.3622)" inkscape:label="Layer 1" inkscape:groupmode="layer">
14
15 <path id="path5730" inkscape:connector-curvature="0" sodipodi:nodetypes="cccc" inkscape:transform-center-x="16.337474" opacity="0.14" enable-background="new " d="
16 M28.646,1015.362l-9.943,12.785l-9.945-12.785H28.646z"/>
17
18 <path id="path4079" inkscape:connector-curvature="0" sodipodi:nodetypes="cccc" inkscape:transform-center-x="14.694444" fill="#FFFFFF" d="
19 M27.647,1015.362l-8.944,11.5l-8.945-11.5H27.647z"/>
20</g>
21</svg>
022
=== added file 'resources/launcher_pip_btt_19.svg'
--- resources/launcher_pip_btt_19.svg 1970-01-01 00:00:00 +0000
+++ resources/launcher_pip_btt_19.svg 2016-03-18 01:19:20 +0000
@@ -0,0 +1,18 @@
1<?xml version="1.0" encoding="utf-8"?>
2<!-- Generator: Adobe Illustrator 15.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
3<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
4<svg version="1.1"
5 id="svg2" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:cc="http://creativecommons.org/ns#" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:svg="http://www.w3.org/2000/svg" xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" inkscape:version="0.48+devel r" sodipodi:docname="launcher_pip_ltr.svg" inkscape:export-ydpi="90" inkscape:export-xdpi="90" inkscape:export-filename="test.png"
6 xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" width="18.992px"
7 height="10.006px" viewBox="0 0 18.992 10.006" enable-background="new 0 0 18.992 10.006" xml:space="preserve">
8<sodipodi:namedview id="base" inkscape:cx="6.9043528" showgrid="true" borderopacity="1.0" bordercolor="#666666" inkscape:cy="9.653247" pagecolor="#5c48bb" inkscape:bbox-nodes="true" inkscape:bbox-paths="true" inkscape:snap-bbox="true" inkscape:snap-text-baseline="false" inkscape:snap-object-midpoints="true" inkscape:snap-smooth-nodes="true" inkscape:snap-intersection-paths="true" inkscape:snap-bbox-midpoints="true" inkscape:snap-bbox-edge-midpoints="true" inkscape:window-maximized="1" inkscape:zoom="30.357661" inkscape:window-y="24" inkscape:window-x="65" inkscape:window-height="1056" inkscape:window-width="1855" inkscape:current-layer="layer1" inkscape:document-units="px" inkscape:pageshadow="2" inkscape:pageopacity="0" inkscape:snap-page="true" inkscape:snap-center="true" inkscape:snap-midpoints="true" inkscape:object-nodes="true" inkscape:object-paths="true">
9 <inkscape:grid type="xygrid" enabled="true" visible="true" id="grid4740" snapvisiblegridlinesonly="true" empspacing="8">
10 </inkscape:grid>
11</sodipodi:namedview>
12<g id="layer1" transform="translate(0,-1033.3622)" inkscape:label="Layer 1" inkscape:groupmode="layer">
13 <path id="path5728" inkscape:connector-curvature="0" sodipodi:nodetypes="cccccc" opacity="0.14" enable-background="new " d="
14 M6.996,1043.368v-3.5l2.5-3l2.5,3v3.5H6.996z"/>
15 <path id="path4742" inkscape:connector-curvature="0" sodipodi:nodetypes="cccccc" fill="#FFFFFF" d="M7.996,1043.368v-3l1.5-2
16 l1.5,2v3H7.996z"/>
17</g>
18</svg>
019
=== added file 'resources/launcher_pip_btt_37.svg'
--- resources/launcher_pip_btt_37.svg 1970-01-01 00:00:00 +0000
+++ resources/launcher_pip_btt_37.svg 2016-03-18 01:19:20 +0000
@@ -0,0 +1,19 @@
1<?xml version="1.0" encoding="utf-8"?>
2<!-- Generator: Adobe Illustrator 18.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
3<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
4<svg version="1.1"
5 id="svg2" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:cc="http://creativecommons.org/ns#" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:svg="http://www.w3.org/2000/svg" xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" inkscape:export-xdpi="90" inkscape:export-ydpi="90" sodipodi:docname="launcher_pip_large_ltr.svg" inkscape:version="0.48+devel r" inkscape:export-filename="test.png"
6 xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" viewBox="0 0 37 20"
7 enable-background="new 0 0 37 20" xml:space="preserve">
8<sodipodi:namedview id="base" pagecolor="#5c48bb" inkscape:zoom="28.42171" showguides="false" inkscape:cy="12.499554" bordercolor="#666666" borderopacity="1.0" showgrid="true" inkscape:cx="3.9411358" inkscape:snap-global="true" inkscape:object-paths="true" inkscape:object-nodes="true" inkscape:snap-midpoints="true" inkscape:snap-center="true" inkscape:snap-page="true" inkscape:pageopacity="0" inkscape:pageshadow="2" inkscape:document-units="px" inkscape:current-layer="layer1" inkscape:window-width="1855" inkscape:window-height="1056" inkscape:window-x="65" inkscape:window-y="24" inkscape:guide-bbox="true" inkscape:snap-bbox="true" inkscape:bbox-paths="true" inkscape:bbox-nodes="true" inkscape:window-maximized="1" inkscape:snap-bbox-edge-midpoints="true" inkscape:snap-bbox-midpoints="true" inkscape:snap-intersection-paths="true" inkscape:snap-smooth-nodes="true" inkscape:snap-object-midpoints="true">
9 <inkscape:grid type="xygrid" enabled="true" id="grid4740" visible="true" empspacing="8" snapvisiblegridlinesonly="true">
10 </inkscape:grid>
11 <sodipodi:guide id="guide3004" orientation="0,1" position="8,19"></sodipodi:guide>
12</sodipodi:namedview>
13<g id="layer1" transform="translate(0,-1015.3622)" inkscape:label="Layer 1" inkscape:groupmode="layer">
14 <path id="path5745" sodipodi:nodetypes="cccccc" inkscape:connector-curvature="0" opacity="0.14" enable-background="new " d="
15 M14,1035.4v-7.5l4.5-5.5l4.5,5.5v7.5H14z"/>
16 <path id="path4742" sodipodi:nodetypes="cccccc" inkscape:connector-curvature="0" fill="#FFFFFF" d="M15,1035.4v-7l3.5-4.5
17 l3.5,4.5v7H15z"/>
18</g>
19</svg>
020
=== added file 'resources/launcher_pressure_effect_rotated.png'
1Binary files resources/launcher_pressure_effect_rotated.png 1970-01-01 00:00:00 +0000 and resources/launcher_pressure_effect_rotated.png 2016-03-18 01:19:20 +0000 differ21Binary files resources/launcher_pressure_effect_rotated.png 1970-01-01 00:00:00 +0000 and resources/launcher_pressure_effect_rotated.png 2016-03-18 01:19:20 +0000 differ
=== modified file 'tests/autopilot/unity/emulators/__init__.py'
--- tests/autopilot/unity/emulators/__init__.py 2015-08-19 13:54:05 +0000
+++ tests/autopilot/unity/emulators/__init__.py 2016-03-18 01:19:20 +0000
@@ -20,7 +20,14 @@
2020
21from dbus import DBusException21from dbus import DBusException
2222
2323keys = {
24 "Left/launcher/keynav/prev": "launcher/keynav/prev",
25 "Left/launcher/keynav/next": "launcher/keynav/next",
26 "Left/launcher/keynav/open-quicklist": "launcher/keynav/open-quicklist",
27 "Bottom/launcher/keynav/prev": "launcher/keynav/close-quicklist",
28 "Bottom/launcher/keynav/next": "launcher/keynav/open-quicklist",
29 "Bottom/launcher/keynav/open-quicklist": "launcher/keynav/prev",
30}
24class UnityIntrospectionObject(CustomEmulatorBase):31class UnityIntrospectionObject(CustomEmulatorBase):
2532
26 DBUS_SERVICE = "com.canonical.Unity"33 DBUS_SERVICE = "com.canonical.Unity"
2734
=== modified file 'tests/autopilot/unity/emulators/launcher.py'
--- tests/autopilot/unity/emulators/launcher.py 2015-09-10 13:23:47 +0000
+++ tests/autopilot/unity/emulators/launcher.py 2016-03-18 01:19:20 +0000
@@ -17,6 +17,7 @@
17from time import sleep17from time import sleep
1818
19from unity.emulators import UnityIntrospectionObject19from unity.emulators import UnityIntrospectionObject
20from unity.emulators import keys
20from unity.emulators.icons import (21from unity.emulators.icons import (
21 ApplicationLauncherIcon,22 ApplicationLauncherIcon,
22 BFBLauncherIcon,23 BFBLauncherIcon,
@@ -37,6 +38,10 @@
37 BEFORE = 338 BEFORE = 3
38 AFTER = 439 AFTER = 4
3940
41class LauncherPosition:
42 """Define launcher possible positions"""
43 LEFT = "Left"
44 BOTTOM = "Bottom"
4045
41class LauncherController(UnityIntrospectionObject):46class LauncherController(UnityIntrospectionObject):
42 """The LauncherController class."""47 """The LauncherController class."""
@@ -104,12 +109,16 @@
104 """Places the mouse on the screen of this launcher."""109 """Places the mouse on the screen of this launcher."""
105 move_mouse_to_screen(self.monitor)110 move_mouse_to_screen(self.monitor)
106111
107 def move_mouse_to_right_of_launcher(self):112 def move_mouse_beside_launcher(self):
108 """Places the mouse to the right of this launcher."""113 """Places the mouse to the right of this launcher."""
109 move_mouse_to_screen(self.monitor)114 move_mouse_to_screen(self.monitor)
110 (x, y, w, h) = self.geometry115 (x, y, w, h) = self.geometry
111 target_x = x + w + 10116 if h > w:
112 target_y = y + h / 2117 target_x = x + w + 10
118 target_y = y + h / 2
119 else:
120 target_x = x + w / 2
121 target_y = y - 10
113122
114 logger.debug("Moving mouse away from launcher.")123 logger.debug("Moving mouse away from launcher.")
115 self._mouse.move(target_x, target_y, False)124 self._mouse.move(target_x, target_y, False)
@@ -153,8 +162,13 @@
153 move_mouse_to_screen(self.monitor)162 move_mouse_to_screen(self.monitor)
154 (x, y, w, h) = self.geometry163 (x, y, w, h) = self.geometry
155164
156 target_x = x - 300 # this is the pressure we need to reveal the launcher.165 if h > w:
157 target_y = y + h / 2166 target_x = x - 300 # this is the pressure we need to reveal the launcher.
167 target_y = y + h / 2
168 else:
169 target_x = x + w / 2
170 target_y = y + h + 300
171
158 logger.debug("Revealing launcher on monitor %d with mouse.", self.monitor)172 logger.debug("Revealing launcher on monitor %d with mouse.", self.monitor)
159 self._mouse.move(target_x, target_y, True, 5, .002)173 self._mouse.move(target_x, target_y, True, 5, .002)
160174
@@ -177,7 +191,7 @@
177 if self.hidemode == 1:191 if self.hidemode == 1:
178 self.is_showing.wait_for(False)192 self.is_showing.wait_for(False)
179193
180 def keyboard_select_icon(self, **kwargs):194 def keyboard_select_icon(self, launcher_position = LauncherPosition.LEFT, **kwargs):
181 """Using either keynav mode or the switcher, select an icon in the launcher.195 """Using either keynav mode or the switcher, select an icon in the launcher.
182196
183 The desired mode (keynav or switcher) must be started already before197 The desired mode (keynav or switcher) must be started already before
@@ -218,7 +232,7 @@
218 if matches:232 if matches:
219 return233 return
220 if self.in_keynav_mode:234 if self.in_keynav_mode:
221 self.key_nav_next()235 self.key_nav_next(launcher_position)
222 elif self.in_switcher_mode:236 elif self.in_switcher_mode:
223 self.switcher_next()237 self.switcher_next()
224 raise ValueError("No icon found that matches: %r", kwargs)238 raise ValueError("No icon found that matches: %r", kwargs)
@@ -244,23 +258,23 @@
244 self._perform_key_nav_exit_binding("launcher/keynav/activate")258 self._perform_key_nav_exit_binding("launcher/keynav/activate")
245 self._get_controller().key_nav_is_active.wait_for(False)259 self._get_controller().key_nav_is_active.wait_for(False)
246260
247 def key_nav_next(self):261 def key_nav_next(self, launcher_position = LauncherPosition.LEFT):
248 """Moves the launcher keynav focus to the next launcher icon"""262 """Moves the launcher keynav focus to the next launcher icon"""
249 logger.debug("Selecting next item in keyboard navigation mode.")263 logger.debug("Selecting next item in keyboard navigation mode.")
250 old_selection = self._get_controller().key_nav_selection264 old_selection = self._get_controller().key_nav_selection
251 self._perform_key_nav_binding("launcher/keynav/next")265 self._perform_key_nav_binding(keys[launcher_position + "/launcher/keynav/next"])
252 self._get_controller().key_nav_selection.wait_for(NotEquals(old_selection))266 self._get_controller().key_nav_selection.wait_for(NotEquals(old_selection))
253267
254 def key_nav_prev(self):268 def key_nav_prev(self, launcher_position = LauncherPosition.LEFT):
255 """Moves the launcher keynav focus to the previous launcher icon"""269 """Moves the launcher keynav focus to the previous launcher icon"""
256 logger.debug("Selecting previous item in keyboard navigation mode.")270 logger.debug("Selecting previous item in keyboard navigation mode.")
257 old_selection = self._get_controller().key_nav_selection271 old_selection = self._get_controller().key_nav_selection
258 self._perform_key_nav_binding("launcher/keynav/prev")272 self._perform_key_nav_binding(keys[launcher_position + "/launcher/keynav/prev"])
259 self._get_controller().key_nav_selection.wait_for(NotEquals(old_selection))273 self._get_controller().key_nav_selection.wait_for(NotEquals(old_selection))
260274
261 def key_nav_enter_quicklist(self):275 def key_nav_enter_quicklist(self, launcher_position = LauncherPosition.LEFT):
262 logger.debug("Opening quicklist for currently selected icon.")276 logger.debug("Opening quicklist for currently selected icon.")
263 self._perform_key_nav_binding("launcher/keynav/open-quicklist")277 self._perform_key_nav_binding(keys[launcher_position + "/launcher/keynav/open-quicklist"])
264 self.quicklist_open.wait_for(True)278 self.quicklist_open.wait_for(True)
265279
266 def key_nav_exit_quicklist(self):280 def key_nav_exit_quicklist(self):
@@ -329,9 +343,9 @@
329 self._mouse.click(button)343 self._mouse.click(button)
330344
331 if (move_mouse_after):345 if (move_mouse_after):
332 self.move_mouse_to_right_of_launcher()346 self.move_mouse_beside_launcher()
333347
334 def drag_icon_to_position(self, icon, pos, target, drag_type=IconDragType.INSIDE):348 def drag_icon_to_position(self, icon, pos, target, drag_type=IconDragType.INSIDE, launcher_position=LauncherPosition.LEFT):
335 """Drag a launcher icon to a new position.349 """Drag a launcher icon to a new position.
336350
337 'icon' is the icon to move. It must be either a ApplicationLauncherIcon or an351 'icon' is the icon to move. It must be either a ApplicationLauncherIcon or an
@@ -345,9 +359,14 @@
345359
346 'drag_type' must be one of IconDragType.INSIDE or IconDragType.OUTSIDE.360 'drag_type' must be one of IconDragType.INSIDE or IconDragType.OUTSIDE.
347 This specifies whether the icon is gragged inside the launcher, or to the361 This specifies whether the icon is gragged inside the launcher, or to the
348 right of it. The default is to drag inside the launcher. If it is362 right/top of it. The default is to drag inside the launcher. If it is
349 specified, and not one of the allowed values, a ValueError will be raised.363 specified, and not one of the allowed values, a ValueError will be raised.
350364
365 'launcher_position' must be one of LauncherPosition.LEFT or LauncherPosition.BOTTOM.
366 This specifies the launcher position when dragging the icon. The default launcher
367 position is at left. If it is specified, and not one of the allowed values, a
368 ValueError will be raised.
369
351 For example:370 For example:
352371
353 >>> drag_icon_to_position(calc_icon, IconDragType.BEFORE, switcher_icon)372 >>> drag_icon_to_position(calc_icon, IconDragType.BEFORE, switcher_icon)
@@ -374,29 +393,41 @@
374 if drag_type not in (IconDragType.INSIDE, IconDragType.OUTSIDE):393 if drag_type not in (IconDragType.INSIDE, IconDragType.OUTSIDE):
375 raise ValueError("'drag_type' parameter must be one of IconDragType.INSIDE, IconDragType.OUTSIDE")394 raise ValueError("'drag_type' parameter must be one of IconDragType.INSIDE, IconDragType.OUTSIDE")
376395
377 icon_height = get_compiz_option("unityshell", "icon_size")396 icon_size = get_compiz_option("unityshell", "icon_size")
378397
379 self.move_mouse_to_icon(icon)398 self.move_mouse_to_icon(icon)
380 self._mouse.press()399 self._mouse.press()
381 sleep(1)400 sleep(1)
382401
383 if drag_type == IconDragType.OUTSIDE:402 if drag_type == IconDragType.OUTSIDE:
384 shift_over = self._mouse.x + (icon_height * 2)403 if launcher_position == LauncherPosition.LEFT:
385 self._mouse.move(shift_over, self._mouse.y, rate=20, time_between_events=0.005)404 shift_over = self._mouse.x + (icon_size * 3)
405 self._mouse.move(shift_over, self._mouse.y, rate=20, time_between_events=0.005)
406 else:
407 shift_over = self._mouse.y - (icon_size * 3)
408 self._mouse.move(self._mouse.x, shift_over, rate=20, time_between_events=0.005)
386 sleep(0.5)409 sleep(0.5)
387410
388 self.move_mouse_to_icon(target)411 self.move_mouse_to_icon(target)
389412
390 target_y = target.center.y413 if launcher_position == LauncherPosition.LEFT:
391 if target_y < icon.center.y:414 target_y = target.center.y
392 target_y += icon_height 415 if target_y < icon.center.y:
393 if pos == IconDragType.BEFORE:416 target_y += icon_size
394 target_y -= icon_height + (icon_height / 2)417 if pos == IconDragType.BEFORE:
418 target_y -= icon_size + (icon_size / 2)
419 self._mouse.move(self._mouse.x, target_y, rate=20, time_between_events=0.005)
420 else:
421 target_x = target.center.x
422 if target_x < icon.center.x:
423 target_x += icon_size
424 if pos == IconDragType.BEFORE:
425 target_x -= icon_size + (icon_size / 2)
426 self._mouse.move(target_x, self._mouse.y, rate=20, time_between_events=0.005)
395427
396 self._mouse.move(self._mouse.x, target_y, rate=20, time_between_events=0.005)
397 sleep(1)428 sleep(1)
398 self._mouse.release()429 self._mouse.release()
399 self.move_mouse_to_right_of_launcher()430 self.move_mouse_beside_launcher()
400431
401 def lock_to_launcher(self, icon):432 def lock_to_launcher(self, icon):
402 """lock 'icon' to the launcher, if it's not already.433 """lock 'icon' to the launcher, if it's not already.
403434
=== modified file 'tests/autopilot/unity/tests/launcher/__init__.py'
--- tests/autopilot/unity/tests/launcher/__init__.py 2014-01-23 15:51:46 +0000
+++ tests/autopilot/unity/tests/launcher/__init__.py 2016-03-18 01:19:20 +0000
@@ -13,6 +13,7 @@
1313
14from unity.tests import UnityTestCase14from unity.tests import UnityTestCase
15from unity.emulators.X11 import set_primary_monitor15from unity.emulators.X11 import set_primary_monitor
16from unity.emulators.launcher import LauncherPosition
1617
1718
18def _make_scenarios():19def _make_scenarios():
@@ -35,7 +36,11 @@
35 """A base class for all launcher tests that uses scenarios to run on36 """A base class for all launcher tests that uses scenarios to run on
36 each launcher (for multi-monitor setups).37 each launcher (for multi-monitor setups).
37 """38 """
38 scenarios = _make_scenarios()39 scenarios = multiply_scenarios(_make_scenarios(),
40 [
41 ('left', {'launcher_position': LauncherPosition.LEFT}),
42 ('bottom', {'launcher_position': LauncherPosition.BOTTOM}),
43 ])
3944
40 def setUp(self):45 def setUp(self):
41 super(LauncherTestCase, self).setUp()46 super(LauncherTestCase, self).setUp()
@@ -45,6 +50,10 @@
45 self.set_unity_option('num_launchers', int(self.only_primary))50 self.set_unity_option('num_launchers', int(self.only_primary))
46 self.launcher_instance = self.get_launcher()51 self.launcher_instance = self.get_launcher()
4752
53 old_pos = self.call_gsettings_cmd('get', 'com.canonical.Unity.Launcher', 'launcher-position')
54 self.call_gsettings_cmd('set', 'com.canonical.Unity.Launcher', 'launcher-position', '"%s"' % self.launcher_position)
55 self.addCleanup(self.call_gsettings_cmd, 'set', 'com.canonical.Unity.Launcher', 'launcher-position', old_pos)
56
48 if not self.launcher_instance:57 if not self.launcher_instance:
49 self.skipTest("Cannot run test with no Launcher on monitor %d." % self.launcher_monitor)58 self.skipTest("Cannot run test with no Launcher on monitor %d." % self.launcher_monitor)
5059
5160
=== modified file 'tests/autopilot/unity/tests/launcher/test_icon_behavior.py'
--- tests/autopilot/unity/tests/launcher/test_icon_behavior.py 2015-09-10 13:23:47 +0000
+++ tests/autopilot/unity/tests/launcher/test_icon_behavior.py 2016-03-18 01:19:20 +0000
@@ -17,6 +17,7 @@
1717
18from unity.emulators.icons import ApplicationLauncherIcon, ExpoLauncherIcon18from unity.emulators.icons import ApplicationLauncherIcon, ExpoLauncherIcon
19from unity.emulators.launcher import IconDragType19from unity.emulators.launcher import IconDragType
20from unity.emulators.launcher import LauncherPosition
20from unity.tests.launcher import LauncherTestCase, _make_scenarios21from unity.tests.launcher import LauncherTestCase, _make_scenarios
2122
22from Xlib import Xutil23from Xlib import Xutil
@@ -196,7 +197,8 @@
196 self.launcher_instance.drag_icon_to_position(197 self.launcher_instance.drag_icon_to_position(
197 calc_icon,198 calc_icon,
198 IconDragType.AFTER,199 IconDragType.AFTER,
199 bfb_icon)200 bfb_icon,
201 launcher_position = self.launcher_position)
200202
201 self.launcher_instance.keyboard_reveal_launcher()203 self.launcher_instance.keyboard_reveal_launcher()
202 self.addCleanup(self.launcher_instance.keyboard_unreveal_launcher)204 self.addCleanup(self.launcher_instance.keyboard_unreveal_launcher)
@@ -354,6 +356,10 @@
354 [356 [
355 ('inside', {'drag_type': IconDragType.INSIDE}),357 ('inside', {'drag_type': IconDragType.INSIDE}),
356 ('outside', {'drag_type': IconDragType.OUTSIDE}),358 ('outside', {'drag_type': IconDragType.OUTSIDE}),
359 ],
360 [
361 ('left', {'launcher_position': LauncherPosition.LEFT}),
362 ('bottom', {'launcher_position': LauncherPosition.BOTTOM}),
357 ])363 ])
358364
359 def setUp(self):365 def setUp(self):
@@ -386,7 +392,8 @@
386 calc_icon,392 calc_icon,
387 IconDragType.AFTER,393 IconDragType.AFTER,
388 bfb_icon,394 bfb_icon,
389 self.drag_type)395 self.drag_type,
396 self.launcher_position)
390 moved_icon = self.unity.launcher.model.\397 moved_icon = self.unity.launcher.model.\
391 get_launcher_icons_for_monitor(self.launcher_monitor)[1]398 get_launcher_icons_for_monitor(self.launcher_monitor)[1]
392 self.assertThat(moved_icon, Equals(calc_icon))399 self.assertThat(moved_icon, Equals(calc_icon))
@@ -406,14 +413,16 @@
406 calc_icon,413 calc_icon,
407 IconDragType.AFTER,414 IconDragType.AFTER,
408 bfb_icon,415 bfb_icon,
409 self.drag_type)416 self.drag_type,
417 self.launcher_position)
410418
411 sleep(1)419 sleep(1)
412 self.launcher_instance.drag_icon_to_position(420 self.launcher_instance.drag_icon_to_position(
413 calc_icon,421 calc_icon,
414 IconDragType.BEFORE,422 IconDragType.BEFORE,
415 trash_icon,423 trash_icon,
416 self.drag_type)424 self.drag_type,
425 self.launcher_position)
417426
418 # Must be the last bamf icon - not necessarily the third-from-end icon.427 # Must be the last bamf icon - not necessarily the third-from-end icon.
419 expected_pos = -2 if self.workspace.num_workspaces < 2 else -1428 expected_pos = -2 if self.workspace.num_workspaces < 2 else -1
420429
=== modified file 'tests/autopilot/unity/tests/launcher/test_keynav.py'
--- tests/autopilot/unity/tests/launcher/test_keynav.py 2015-03-26 12:58:00 +0000
+++ tests/autopilot/unity/tests/launcher/test_keynav.py 2016-03-18 01:19:20 +0000
@@ -68,7 +68,7 @@
68 def test_launcher_keynav_forward(self):68 def test_launcher_keynav_forward(self):
69 """Must be able to move forwards while in keynav mode."""69 """Must be able to move forwards while in keynav mode."""
70 self.start_keynav_with_cleanup_cancel()70 self.start_keynav_with_cleanup_cancel()
71 self.launcher_instance.key_nav_next()71 self.launcher_instance.key_nav_next(self.launcher_position)
72 # The launcher model has hidden items, so the keynav indexes do not72 # The launcher model has hidden items, so the keynav indexes do not
73 # increase by 1 each time. This test was failing because the 2nd icon73 # increase by 1 each time. This test was failing because the 2nd icon
74 # had an index of 2, not 1 as expected. The best we can do here is to74 # had an index of 2, not 1 as expected. The best we can do here is to
@@ -80,9 +80,9 @@
80 def test_launcher_keynav_prev_works(self):80 def test_launcher_keynav_prev_works(self):
81 """Must be able to move backwards while in keynav mode."""81 """Must be able to move backwards while in keynav mode."""
82 self.start_keynav_with_cleanup_cancel()82 self.start_keynav_with_cleanup_cancel()
83 self.launcher_instance.key_nav_next()83 self.launcher_instance.key_nav_next(self.launcher_position)
84 self.assertThat(self.unity.launcher.key_nav_selection, Eventually(GreaterThan(0)))84 self.assertThat(self.unity.launcher.key_nav_selection, Eventually(GreaterThan(0)))
85 self.launcher_instance.key_nav_prev()85 self.launcher_instance.key_nav_prev(self.launcher_position)
86 self.assertThat(self.unity.launcher.key_nav_selection, Eventually(Equals(0)))86 self.assertThat(self.unity.launcher.key_nav_selection, Eventually(Equals(0)))
8787
88 def test_launcher_keynav_cycling_forward(self):88 def test_launcher_keynav_cycling_forward(self):
@@ -90,29 +90,29 @@
90 self.start_keynav_with_cleanup_cancel()90 self.start_keynav_with_cleanup_cancel()
91 prev_icon = 091 prev_icon = 0
92 for icon in range(1, self.unity.launcher.model.num_launcher_icons()):92 for icon in range(1, self.unity.launcher.model.num_launcher_icons()):
93 self.launcher_instance.key_nav_next()93 self.launcher_instance.key_nav_next(self.launcher_position)
94 # FIXME We can't directly check for selection/icon number equalty94 # FIXME We can't directly check for selection/icon number equalty
95 # since the launcher model also contains "hidden" icons that aren't95 # since the launcher model also contains "hidden" icons that aren't
96 # shown, so the selection index can increment by more than 1.96 # shown, so the selection index can increment by more than 1.
97 self.assertThat(self.unity.launcher.key_nav_selection, Eventually(GreaterThan(prev_icon)))97 self.assertThat(self.unity.launcher.key_nav_selection, Eventually(GreaterThan(prev_icon)))
98 prev_icon = self.unity.launcher.key_nav_selection98 prev_icon = self.unity.launcher.key_nav_selection
9999
100 self.launcher_instance.key_nav_next()100 self.launcher_instance.key_nav_next(self.launcher_position)
101 self.assertThat(self.unity.launcher.key_nav_selection, Eventually(Equals(0)))101 self.assertThat(self.unity.launcher.key_nav_selection, Eventually(Equals(0)))
102102
103 def test_launcher_keynav_cycling_backward(self):103 def test_launcher_keynav_cycling_backward(self):
104 """Launcher keynav must loop through icons when cycling backwards"""104 """Launcher keynav must loop through icons when cycling backwards"""
105 self.start_keynav_with_cleanup_cancel()105 self.start_keynav_with_cleanup_cancel()
106 self.launcher_instance.key_nav_prev()106 self.launcher_instance.key_nav_prev(self.launcher_position)
107 # FIXME We can't directly check for self.unity.launcher.num_launcher_icons - 1107 # FIXME We can't directly check for self.unity.launcher.num_launcher_icons - 1
108 self.assertThat(self.unity.launcher.key_nav_selection, Eventually(GreaterThan(1)))108 self.assertThat(self.unity.launcher.key_nav_selection, Eventually(GreaterThan(1)))
109109
110 def test_launcher_keynav_can_open_and_close_quicklist(self):110 def test_launcher_keynav_can_open_and_close_quicklist(self):
111 """Tests that we can open and close a quicklist from keynav mode."""111 """Tests that we can open and close a quicklist from keynav mode."""
112 self.start_keynav_with_cleanup_cancel()112 self.start_keynav_with_cleanup_cancel()
113 self.launcher_instance.key_nav_next()113 self.launcher_instance.key_nav_next(self.launcher_position)
114 self.addCleanup(self.keyboard.press_and_release, "Escape")114 self.addCleanup(self.keyboard.press_and_release, "Escape")
115 self.launcher_instance.key_nav_enter_quicklist()115 self.launcher_instance.key_nav_enter_quicklist(self.launcher_position)
116 self.assertThat(self.launcher_instance.quicklist_open, Eventually(Equals(True)))116 self.assertThat(self.launcher_instance.quicklist_open, Eventually(Equals(True)))
117 self.launcher_instance.key_nav_exit_quicklist()117 self.launcher_instance.key_nav_exit_quicklist()
118 self.assertThat(self.launcher_instance.quicklist_open, Eventually(Equals(False)))118 self.assertThat(self.launcher_instance.quicklist_open, Eventually(Equals(False)))
@@ -135,7 +135,7 @@
135135
136 self.start_keynav_with_cleanup_cancel()136 self.start_keynav_with_cleanup_cancel()
137137
138 self.launcher_instance.keyboard_select_icon(tooltip_text=calc.name)138 self.launcher_instance.keyboard_select_icon(self.launcher_position, tooltip_text=calc.name)
139 self.launcher_instance.key_nav_activate()139 self.launcher_instance.key_nav_activate()
140140
141 self.assertTrue(calc.is_active)141 self.assertTrue(calc.is_active)
@@ -148,7 +148,7 @@
148148
149 self.start_keynav_with_cleanup_cancel()149 self.start_keynav_with_cleanup_cancel()
150150
151 self.launcher_instance.keyboard_select_icon(tooltip_text="Workspace Switcher")151 self.launcher_instance.keyboard_select_icon(self.launcher_position, tooltip_text="Workspace Switcher")
152 self.launcher_instance.key_nav_activate()152 self.launcher_instance.key_nav_activate()
153 self.addCleanup(self.keybinding, "expo/cancel")153 self.addCleanup(self.keybinding, "expo/cancel")
154154
@@ -160,7 +160,7 @@
160 self.skipTest("This test requires enabled more than one workspace.")160 self.skipTest("This test requires enabled more than one workspace.")
161 self.start_keynav_with_cleanup_cancel()161 self.start_keynav_with_cleanup_cancel()
162162
163 self.launcher_instance.keyboard_select_icon(tooltip_text="Workspace Switcher")163 self.launcher_instance.keyboard_select_icon(self.launcher_position, tooltip_text="Workspace Switcher")
164 self.launcher_instance.key_nav_activate()164 self.launcher_instance.key_nav_activate()
165165
166 self.keyboard.press_and_release("Escape")166 self.keyboard.press_and_release("Escape")
@@ -209,7 +209,7 @@
209 """A single click outside of launcher must cancel keynav."""209 """A single click outside of launcher must cancel keynav."""
210 self.start_keynav_with_cleanup_cancel()210 self.start_keynav_with_cleanup_cancel()
211211
212 self.launcher_instance.move_mouse_to_right_of_launcher()212 self.launcher_instance.move_mouse_beside_launcher()
213 self.mouse.click()213 self.mouse.click()
214214
215 self.assertThat(self.unity.launcher.key_nav_is_active, Eventually(Equals(False)))215 self.assertThat(self.unity.launcher.key_nav_is_active, Eventually(Equals(False)))
@@ -229,7 +229,7 @@
229 def test_launcher_keynav_cancel_on_quicklist_activate(self):229 def test_launcher_keynav_cancel_on_quicklist_activate(self):
230 """A single click on a quicklist item must cancel keynav."""230 """A single click on a quicklist item must cancel keynav."""
231 self.start_keynav_with_cleanup_cancel()231 self.start_keynav_with_cleanup_cancel()
232 self.launcher_instance.key_nav_enter_quicklist()232 self.launcher_instance.key_nav_enter_quicklist(self.launcher_position)
233233
234 bfb_icon = self.unity.launcher.model.get_bfb_icon()234 bfb_icon = self.unity.launcher.model.get_bfb_icon()
235 bfb_ql = bfb_icon.get_quicklist()235 bfb_ql = bfb_icon.get_quicklist()
236236
=== modified file 'tests/autopilot/unity/tests/launcher/test_reveal.py'
--- tests/autopilot/unity/tests/launcher/test_reveal.py 2014-01-23 15:51:46 +0000
+++ tests/autopilot/unity/tests/launcher/test_reveal.py 2016-03-18 01:19:20 +0000
@@ -39,7 +39,7 @@
3939
40 def test_reveal_on_mouse_to_edge(self):40 def test_reveal_on_mouse_to_edge(self):
41 """Tests reveal of launchers by mouse pressure."""41 """Tests reveal of launchers by mouse pressure."""
42 self.launcher_instance.move_mouse_to_right_of_launcher()42 self.launcher_instance.move_mouse_beside_launcher()
43 self.launcher_instance.mouse_reveal_launcher()43 self.launcher_instance.mouse_reveal_launcher()
44 self.assertThat(self.launcher_instance.is_showing, Eventually(Equals(True)))44 self.assertThat(self.launcher_instance.is_showing, Eventually(Equals(True)))
4545
@@ -58,7 +58,7 @@
58 """Tests reveal of launchers by mouse pressure to ensure it doesn't58 """Tests reveal of launchers by mouse pressure to ensure it doesn't
59 automatically hide again.59 automatically hide again.
60 """60 """
61 self.launcher_instance.move_mouse_to_right_of_launcher()61 self.launcher_instance.move_mouse_beside_launcher()
62 self.launcher_instance.mouse_reveal_launcher()62 self.launcher_instance.mouse_reveal_launcher()
63 self.assertThat(self.launcher_instance.is_showing, Eventually(Equals(True)))63 self.assertThat(self.launcher_instance.is_showing, Eventually(Equals(True)))
6464
6565
=== modified file 'tests/autopilot/unity/tests/launcher/test_scroll.py'
--- tests/autopilot/unity/tests/launcher/test_scroll.py 2014-12-15 15:17:36 +0000
+++ tests/autopilot/unity/tests/launcher/test_scroll.py 2016-03-18 01:19:20 +0000
@@ -88,8 +88,9 @@
88 launcher_instance.move_mouse_to_icon(last_icon)88 launcher_instance.move_mouse_to_icon(last_icon)
8989
90 # Make sure the first icon is off the screen or else there is no90 # Make sure the first icon is off the screen or else there is no
91 # scrolling.91 # scrolling when launcher at left
92 self.assertThat(first_icon.center.y, LessThan(y))92 if w < h:
93 self.assertThat(first_icon.center.y, LessThan(y))
93 94
94 # Autoscroll to the first icon95 # Autoscroll to the first icon
95 launcher_instance.move_mouse_to_icon(first_icon, autoscroll_offset)96 launcher_instance.move_mouse_to_icon(first_icon, autoscroll_offset)
9697
=== modified file 'tests/autopilot/unity/tests/launcher/test_switcher.py'
--- tests/autopilot/unity/tests/launcher/test_switcher.py 2014-01-23 15:51:46 +0000
+++ tests/autopilot/unity/tests/launcher/test_switcher.py 2016-03-18 01:19:20 +0000
@@ -152,7 +152,7 @@
152152
153 self.start_switcher_with_cleanup_cancel()153 self.start_switcher_with_cleanup_cancel()
154154
155 self.launcher_instance.keyboard_select_icon(tooltip_text=calc.name)155 self.launcher_instance.keyboard_select_icon(self.launcher_position, tooltip_text=calc.name)
156 self.launcher_instance.switcher_activate()156 self.launcher_instance.switcher_activate()
157157
158 self.assertThat(lambda: calc.is_active, Eventually(Equals(True)))158 self.assertThat(lambda: calc.is_active, Eventually(Equals(True)))
159159
=== modified file 'tests/autopilot/unity/tests/launcher/test_tooltips.py'
--- tests/autopilot/unity/tests/launcher/test_tooltips.py 2014-03-04 22:50:22 +0000
+++ tests/autopilot/unity/tests/launcher/test_tooltips.py 2016-03-18 01:19:20 +0000
@@ -18,7 +18,7 @@
18 def setUp(self):18 def setUp(self):
19 super(LauncherTooltipTests, self).setUp()19 super(LauncherTooltipTests, self).setUp()
20 self.set_unity_option('launcher_hide_mode', 0)20 self.set_unity_option('launcher_hide_mode', 0)
21 self.launcher_instance.move_mouse_to_right_of_launcher()21 self.launcher_instance.move_mouse_beside_launcher()
22 self.icons = self.unity.launcher.model.get_launcher_icons(visible_only=True)22 self.icons = self.unity.launcher.model.get_launcher_icons(visible_only=True)
2323
24 def test_launcher_tooltip_show(self):24 def test_launcher_tooltip_show(self):
@@ -49,7 +49,7 @@
49 b -= 149 b -= 1
5050
51 # leaving launcher clears tooltips, and instant reveal51 # leaving launcher clears tooltips, and instant reveal
52 self.launcher_instance.move_mouse_to_right_of_launcher()52 self.launcher_instance.move_mouse_beside_launcher()
53 self.assertEqual(self.get_reveal_behavior(self.icons[b]), self.DELAYED)53 self.assertEqual(self.get_reveal_behavior(self.icons[b]), self.DELAYED)
5454
55 def test_launcher_tooltip_disabling(self):55 def test_launcher_tooltip_disabling(self):
5656
=== modified file 'tests/autopilot/unity/tests/test_dash.py'
--- tests/autopilot/unity/tests/test_dash.py 2016-02-17 18:40:53 +0000
+++ tests/autopilot/unity/tests/test_dash.py 2016-03-18 01:19:20 +0000
@@ -148,10 +148,10 @@
148148
149 self.unity.dash.ensure_visible()149 self.unity.dash.ensure_visible()
150150
151 # Click bottom right of the screen, but take into account the non-maximized window -151 # Click right of the screen, but take into account the non-maximized window -
152 # we do not want to click on it as it focuses the wrong window152 # we do not want to click on it as it focuses the wrong window
153 w = self.display.get_screen_width() - 1153 w = self.display.get_screen_width() - 1
154 h = self.display.get_screen_height() - 1154 h = self.display.get_screen_height() / 2
155155
156 # If the mouse is over the non-maximized window, move it away from it.156 # If the mouse is over the non-maximized window, move it away from it.
157 (calc_x, calc_y, calc_w, calc_h) = calc_win.get_windows()[0].geometry157 (calc_x, calc_y, calc_w, calc_h) = calc_win.get_windows()[0].geometry
@@ -689,8 +689,10 @@
689689
690 self.unity.dash.ensure_visible()690 self.unity.dash.ensure_visible()
691691
692 self.assertThat(self.unity.dash.view.x, Eventually(Equals(launcher.geometry.x + launcher.geometry.width - 1)))692 if launcher.geometry.width < launcher.geometry.height:
693693 self.assertThat(self.unity.dash.view.x, Eventually(Equals(launcher.geometry.x + launcher.geometry.width - 1)))
694 else:
695 self.assertThat(self.unity.dash.view.x, Eventually(Equals(0)))
694696
695 def test_see_more_result_alignment(self):697 def test_see_more_result_alignment(self):
696 """The see more results label should be baseline aligned698 """The see more results label should be baseline aligned
697699
=== modified file 'tests/autopilot/unity/tests/test_hud.py'
--- tests/autopilot/unity/tests/test_hud.py 2015-02-19 19:23:39 +0000
+++ tests/autopilot/unity/tests/test_hud.py 2016-03-18 01:19:20 +0000
@@ -27,6 +27,8 @@
27from time import sleep27from time import sleep
2828
29from unity.emulators.icons import HudLauncherIcon29from unity.emulators.icons import HudLauncherIcon
30from unity.emulators.icons import BFBLauncherIcon
31from unity.emulators.launcher import LauncherPosition
30from unity.tests import UnityTestCase32from unity.tests import UnityTestCase
3133
3234
@@ -471,10 +473,10 @@
471473
472 self.unity.hud.ensure_visible()474 self.unity.hud.ensure_visible()
473475
474 # Click bottom right of the screen, but take into account the non-maximized window -476 # Click right of the screen, but take into account the non-maximized window -
475 # we do not want to click on it as it focuses the wrong window477 # we do not want to click on it as it focuses the wrong window
476 w = self.display.get_screen_width() - 1478 w = self.display.get_screen_width() - 1
477 h = self.display.get_screen_height() - 1479 h = (self.display.get_screen_height() - 1) / 2
478480
479 # If the mouse is over the non-maximized window, move it away from it.481 # If the mouse is over the non-maximized window, move it away from it.
480 (calc_x, calc_y, calc_w, calc_h) = calc_win.get_windows()[0].geometry482 (calc_x, calc_y, calc_w, calc_h) = calc_win.get_windows()[0].geometry
@@ -585,7 +587,10 @@
585587
586class HudLockedLauncherInteractionsTests(HudTestsBase):588class HudLockedLauncherInteractionsTests(HudTestsBase):
587589
588 scenarios = _make_monitor_scenarios()590 launcher_position = [('Launcher on the left', {'launcher_position': LauncherPosition.LEFT}),
591 ('Launcher on the bottom', {'launcher_position': LauncherPosition.BOTTOM})]
592
593 scenarios = multiply_scenarios(_make_monitor_scenarios(), launcher_position)
589594
590 def setUp(self):595 def setUp(self):
591 super(HudLockedLauncherInteractionsTests, self).setUp()596 super(HudLockedLauncherInteractionsTests, self).setUp()
@@ -593,6 +598,10 @@
593 self.set_unity_option('num_launchers', 0)598 self.set_unity_option('num_launchers', 0)
594 self.set_unity_option('launcher_hide_mode', 0)599 self.set_unity_option('launcher_hide_mode', 0)
595600
601 old_pos = self.call_gsettings_cmd('get', 'com.canonical.Unity.Launcher', 'launcher-position')
602 self.call_gsettings_cmd('set', 'com.canonical.Unity.Launcher', 'launcher-position', '"%s"' % self.launcher_position)
603 self.addCleanup(self.call_gsettings_cmd, 'set', 'com.canonical.Unity.Launcher', 'launcher-position', old_pos)
604
596 move_mouse_to_screen(self.hud_monitor)605 move_mouse_to_screen(self.hud_monitor)
597 sleep(0.5)606 sleep(0.5)
598607
@@ -608,8 +617,9 @@
608617
609 self.unity.hud.ensure_visible()618 self.unity.hud.ensure_visible()
610619
611 self.assertTrue(hud_icon.monitors_visibility[self.hud_monitor])620 if self.launcher_position == LauncherPosition.LEFT:
612 self.assertTrue(hud_icon.is_on_monitor(self.hud_monitor))621 self.assertTrue(hud_icon.monitors_visibility[self.hud_monitor])
622 self.assertTrue(hud_icon.is_on_monitor(self.hud_monitor))
613 # For some reason the BFB icon is always visible :-/623 # For some reason the BFB icon is always visible :-/
614 #bfb_icon.visible, Eventually(Equals(False)624 #bfb_icon.visible, Eventually(Equals(False)
615625
@@ -622,6 +632,8 @@
622 if isinstance(icon, HudLauncherIcon):632 if isinstance(icon, HudLauncherIcon):
623 self.assertFalse(icon.monitors_desaturated[self.hud_monitor])633 self.assertFalse(icon.monitors_desaturated[self.hud_monitor])
624 else:634 else:
635 if isinstance(icon, BFBLauncherIcon) and self.launcher_position == LauncherPosition.BOTTOM:
636 continue
625 self.assertTrue(icon.monitors_desaturated[self.hud_monitor])637 self.assertTrue(icon.monitors_desaturated[self.hud_monitor])
626638
627 def test_hud_launcher_icon_click_hides_hud(self):639 def test_hud_launcher_icon_click_hides_hud(self):
@@ -645,15 +657,24 @@
645 launcher_screen = [('Launcher on all monitors', {'launcher_primary_only': False}),657 launcher_screen = [('Launcher on all monitors', {'launcher_primary_only': False}),
646 ('Launcher on primary monitor', {'launcher_primary_only': True})]658 ('Launcher on primary monitor', {'launcher_primary_only': True})]
647659
648 scenarios = multiply_scenarios(_make_monitor_scenarios(), launcher_modes, launcher_screen)660 launcher_position = [('Launcher on the left', {'launcher_position': LauncherPosition.LEFT}),
661 ('Launcher on the bottom', {'launcher_position': LauncherPosition.BOTTOM})]
662
663 scenarios = multiply_scenarios(_make_monitor_scenarios(), launcher_modes, launcher_screen, launcher_position)
649664
650 def setUp(self):665 def setUp(self):
651 super(HudVisualTests, self).setUp()666 super(HudVisualTests, self).setUp()
652 move_mouse_to_screen(self.hud_monitor)667 move_mouse_to_screen(self.hud_monitor)
653 self.set_unity_option('launcher_hide_mode', int(self.launcher_autohide))668 self.set_unity_option('launcher_hide_mode', int(self.launcher_autohide))
654 self.set_unity_option('num_launchers', int(self.launcher_primary_only))669 self.set_unity_option('num_launchers', int(self.launcher_primary_only))
670
671 old_pos = self.call_gsettings_cmd('get', 'com.canonical.Unity.Launcher', 'launcher-position')
672 self.call_gsettings_cmd('set', 'com.canonical.Unity.Launcher', 'launcher-position', '"%s"' % self.launcher_position)
673 self.addCleanup(self.call_gsettings_cmd, 'set', 'com.canonical.Unity.Launcher', 'launcher-position', old_pos)
674
655 self.hud_monitor_is_primary = (self.display.get_primary_screen() == self.hud_monitor)675 self.hud_monitor_is_primary = (self.display.get_primary_screen() == self.hud_monitor)
656 self.hud_locked = (not self.launcher_autohide and (not self.launcher_primary_only or self.hud_monitor_is_primary))676 self.hud_locked = (not self.launcher_autohide and (not self.launcher_primary_only or self.hud_monitor_is_primary)
677 and self.launcher_position != LauncherPosition.BOTTOM)
657 sleep(0.5)678 sleep(0.5)
658679
659 def test_initially_hidden(self):680 def test_initially_hidden(self):
@@ -671,10 +692,11 @@
671 monitor_geo = self.display.get_screen_geometry(self.hud_monitor)692 monitor_geo = self.display.get_screen_geometry(self.hud_monitor)
672 monitor_x = monitor_geo[0]693 monitor_x = monitor_geo[0]
673 monitor_w = monitor_geo[2]694 monitor_w = monitor_geo[2]
695 launcher = self.unity.launcher.get_launcher_for_monitor(self.hud_monitor)
674 hud_x = self.unity.hud.geometry[0]696 hud_x = self.unity.hud.geometry[0]
675 hud_w = self.unity.hud.geometry[2]697 hud_w = self.unity.hud.geometry[2]
676698
677 if self.hud_locked:699 if self.hud_locked and launcher.geometry.w < launcher.geometry.h:
678 self.assertThat(hud_x, GreaterThan(monitor_x))700 self.assertThat(hud_x, GreaterThan(monitor_x))
679 self.assertThat(hud_x, LessThan(monitor_x + monitor_w))701 self.assertThat(hud_x, LessThan(monitor_x + monitor_w))
680 self.assertThat(hud_w, Equals(monitor_x + monitor_w - hud_x))702 self.assertThat(hud_w, Equals(monitor_x + monitor_w - hud_x))
681703
=== modified file 'tests/autopilot/unity/tests/test_quicklist.py'
--- tests/autopilot/unity/tests/test_quicklist.py 2015-08-18 10:08:57 +0000
+++ tests/autopilot/unity/tests/test_quicklist.py 2016-03-18 01:19:20 +0000
@@ -17,7 +17,9 @@
17from time import sleep17from time import sleep
18from xdg.DesktopEntry import DesktopEntry18from xdg.DesktopEntry import DesktopEntry
1919
20from unity.emulators import keys
20from unity.emulators.quicklist import QuicklistMenuItemLabel21from unity.emulators.quicklist import QuicklistMenuItemLabel
22from unity.emulators.launcher import LauncherPosition
21from unity.tests import UnityTestCase23from unity.tests import UnityTestCase
2224
2325
@@ -193,12 +195,12 @@
193195
194 icons = self.unity.launcher.model.get_launcher_icons()196 icons = self.unity.launcher.model.get_launcher_icons()
195197
198 icon1_ql = self.open_quicklist_for_icon(icons[1])
199 self.assertThat(icon1_ql.active, Eventually(Equals(True)))
200
196 icon0_ql = self.open_quicklist_for_icon(icons[0])201 icon0_ql = self.open_quicklist_for_icon(icons[0])
197 self.assertThat(icon0_ql.active, Eventually(Equals(True)))202 self.assertThat(icon0_ql.active, Eventually(Equals(True)))
198203 self.assertThat(icon1_ql.wait_until_destroyed, Not(Raises()))
199 icon1_ql = self.open_quicklist_for_icon(icons[1])
200 self.assertThat(icon1_ql.active, Eventually(Equals(True)))
201 self.assertThat(icon0_ql.wait_until_destroyed, Not(Raises()))
202204
203 def test_right_clicking_same_icon_doesnt_reopen_ql(self):205 def test_right_clicking_same_icon_doesnt_reopen_ql(self):
204 """A right click to the same icon in the launcher must206 """A right click to the same icon in the launcher must
@@ -224,6 +226,10 @@
224226
225class QuicklistKeyNavigationTests(UnityTestCase):227class QuicklistKeyNavigationTests(UnityTestCase):
226 """Tests for the quicklist key navigation."""228 """Tests for the quicklist key navigation."""
229 scenarios = [
230 ('left', {'launcher_position': LauncherPosition.LEFT}),
231 ('bottom', {'launcher_position': LauncherPosition.BOTTOM}),
232 ]
227233
228 def setUp(self):234 def setUp(self):
229 super(QuicklistKeyNavigationTests, self).setUp()235 super(QuicklistKeyNavigationTests, self).setUp()
@@ -239,6 +245,10 @@
239245
240 self.ql_launcher = self.unity.launcher.get_launcher_for_monitor(0)246 self.ql_launcher = self.unity.launcher.get_launcher_for_monitor(0)
241247
248 old_pos = self.call_gsettings_cmd('get', 'com.canonical.Unity.Launcher', 'launcher-position')
249 self.call_gsettings_cmd('set', 'com.canonical.Unity.Launcher', 'launcher-position', '"%s"' % self.launcher_position)
250 self.addCleanup(self.call_gsettings_cmd, 'set', 'com.canonical.Unity.Launcher', 'launcher-position', old_pos)
251
242 def open_quicklist_with_mouse(self):252 def open_quicklist_with_mouse(self):
243 """Opens a quicklist with the mouse."""253 """Opens a quicklist with the mouse."""
244 self.ql_launcher.click_launcher_icon(self.ql_launcher_icon, button=3)254 self.ql_launcher.click_launcher_icon(self.ql_launcher_icon, button=3)
@@ -256,8 +266,8 @@
256 self.ql_launcher.key_nav_start()266 self.ql_launcher.key_nav_start()
257 self.addCleanup(self.ql_launcher.key_nav_cancel)267 self.addCleanup(self.ql_launcher.key_nav_cancel)
258268
259 self.ql_launcher.keyboard_select_icon(tooltip_text=self.ql_app.name)269 self.ql_launcher.keyboard_select_icon(self.launcher_position, tooltip_text=self.ql_app.name)
260 self.keybinding("launcher/keynav/open-quicklist")270 self.keybinding(keys[self.launcher_position + "/launcher/keynav/open-quicklist"])
261 self.addCleanup(self.keybinding, "launcher/keynav/close-quicklist")271 self.addCleanup(self.keybinding, "launcher/keynav/close-quicklist")
262272
263 self.assertThat(self.ql_launcher_icon.get_quicklist,273 self.assertThat(self.ql_launcher_icon.get_quicklist,
264274
=== modified file 'tests/autopilot/unity/tests/test_spread.py'
--- tests/autopilot/unity/tests/test_spread.py 2015-08-19 09:14:22 +0000
+++ tests/autopilot/unity/tests/test_spread.py 2016-03-18 01:19:20 +0000
@@ -150,7 +150,7 @@
150 """Test that the screen spread desaturates the launcher icons"""150 """Test that the screen spread desaturates the launcher icons"""
151 self.start_test_application_windows("Calculator", 1)151 self.start_test_application_windows("Calculator", 1)
152 self.initiate_spread_for_screen()152 self.initiate_spread_for_screen()
153 self.launcher.move_mouse_to_right_of_launcher()153 self.launcher.move_mouse_beside_launcher()
154 self.assertLauncherIconsDesaturated()154 self.assertLauncherIconsDesaturated()
155155
156 def test_spread_saturate_launcher_icons_on_mouse_over(self):156 def test_spread_saturate_launcher_icons_on_mouse_over(self):
157157
=== modified file 'tests/autopilot/unity/tests/test_wm_keybindings.py'
--- tests/autopilot/unity/tests/test_wm_keybindings.py 2015-04-10 21:27:19 +0000
+++ tests/autopilot/unity/tests/test_wm_keybindings.py 2016-03-18 01:19:20 +0000
@@ -99,10 +99,16 @@
99 monitor = self.bamf_win.monitor99 monitor = self.bamf_win.monitor
100 monitor_geo = self.display.get_screen_geometry(monitor)100 monitor_geo = self.display.get_screen_geometry(monitor)
101 launcher = self.unity.launcher.get_launcher_for_monitor(monitor)101 launcher = self.unity.launcher.get_launcher_for_monitor(monitor)
102 launcher_w = 0 if launcher.hidemode else launcher.geometry[2]102 # When launcher at left, do not use launcher_h, otherwise, do not use launcher_w
103 if launcher.geometry[2] < launcher.geometry[3]:
104 launcher_h = 0
105 launcher_w = 0 if launcher.hidemode else launcher.geometry[2]
106 else:
107 launcher_h = 0 if launcher.hidemode else launcher.geometry[3]
108 launcher_w = 0
103 panel_h = self.unity.panels.get_panel_for_monitor(monitor).geometry[3]109 panel_h = self.unity.panels.get_panel_for_monitor(monitor).geometry[3]
104 return (monitor_geo[0] + launcher_w, monitor_geo[1] + panel_h,110 return (monitor_geo[0] + launcher_w, monitor_geo[1] + panel_h,
105 monitor_geo[2] - launcher_w, monitor_geo[3] - panel_h)111 monitor_geo[2] - launcher_w, monitor_geo[3] - panel_h - launcher_h)
106112
107 def test_maximize_window(self):113 def test_maximize_window(self):
108 if self.start_restored:114 if self.start_restored:
109115
=== modified file 'tests/test_bfb_launcher_icon.cpp'
--- tests/test_bfb_launcher_icon.cpp 2014-03-21 04:40:12 +0000
+++ tests/test_bfb_launcher_icon.cpp 2016-03-18 01:19:20 +0000
@@ -31,7 +31,7 @@
31{31{
32public:32public:
33 MockBFBLauncherIcon()33 MockBFBLauncherIcon()
34 : BFBLauncherIcon(LauncherHideMode::LAUNCHER_HIDE_NEVER)34 : BFBLauncherIcon()
35 {}35 {}
36};36};
3737
3838
=== modified file 'tests/test_hud_launcher_icon.cpp'
--- tests/test_hud_launcher_icon.cpp 2014-03-21 04:40:12 +0000
+++ tests/test_hud_launcher_icon.cpp 2016-03-18 01:19:20 +0000
@@ -32,7 +32,7 @@
32{32{
33public:33public:
34 MockHudLauncherIcon()34 MockHudLauncherIcon()
35 : HudLauncherIcon(LauncherHideMode::LAUNCHER_HIDE_NEVER)35 : HudLauncherIcon()
36 {}36 {}
37};37};
3838
3939
=== modified file 'tests/test_launcher.cpp'
--- tests/test_launcher.cpp 2015-10-14 10:34:03 +0000
+++ tests/test_launcher.cpp 2016-03-18 01:19:20 +0000
@@ -31,6 +31,7 @@
31#include "unity-shared/PanelStyle.h"31#include "unity-shared/PanelStyle.h"
32#include "unity-shared/IconRenderer.h"32#include "unity-shared/IconRenderer.h"
33#include "unity-shared/UBusMessages.h"33#include "unity-shared/UBusMessages.h"
34#include "unity-shared/UnitySettings.h"
34#include "test_standalone_wm.h"35#include "test_standalone_wm.h"
35#include "test_utils.h"36#include "test_utils.h"
3637
@@ -537,11 +538,13 @@
537538
538TEST_F(TestLauncher, EdgeBarriersHandlesEvent)539TEST_F(TestLauncher, EdgeBarriersHandlesEvent)
539{540{
540 auto const& launcher_geo = launcher_->GetAbsoluteGeometry();541 glib::Object<GSettings> gsettings(g_settings_new("com.canonical.Unity.Launcher"));
542 auto launcher_geo = launcher_->GetAbsoluteGeometry();
541 auto barrier = std::make_shared<ui::PointerBarrierWrapper>();543 auto barrier = std::make_shared<ui::PointerBarrierWrapper>();
542 auto event = std::make_shared<ui::BarrierEvent>(0, 0, 0, 100);544 auto event = std::make_shared<ui::BarrierEvent>(0, 0, 0, 100);
543 launcher_->SetHidden(true);545 launcher_->SetHidden(true);
544546
547 g_settings_set_enum(gsettings, "launcher-position", static_cast<int>(LauncherPosition::LEFT));
545 options_->reveal_trigger = RevealTrigger::EDGE;548 options_->reveal_trigger = RevealTrigger::EDGE;
546549
547 for (int x = launcher_geo.x; x < launcher_geo.x+launcher_geo.width; ++x)550 for (int x = launcher_geo.x; x < launcher_geo.x+launcher_geo.width; ++x)
@@ -567,6 +570,37 @@
567 ui::EdgeBarrierSubscriber::Result::HANDLED);570 ui::EdgeBarrierSubscriber::Result::HANDLED);
568 }571 }
569 }572 }
573
574 g_settings_set_enum(gsettings, "launcher-position", static_cast<int>(LauncherPosition::BOTTOM));
575 launcher_geo = launcher_->GetAbsoluteGeometry();
576 options_->reveal_trigger = RevealTrigger::EDGE;
577 int panel_height = panel::Style::Instance().PanelHeight(launcher_->monitor());
578
579 for (int y = launcher_geo.y; y < launcher_geo.y+launcher_geo.height; ++y)
580 {
581 for (int x = launcher_geo.x + panel_height; x < launcher_geo.x+launcher_geo.width; ++x)
582 {
583 event->x = x;
584 event->y = y;
585 ASSERT_EQ(launcher_->HandleBarrierEvent(barrier, event),
586 ui::EdgeBarrierSubscriber::Result::HANDLED);
587 }
588 }
589
590 options_->reveal_trigger = RevealTrigger::CORNER;
591
592 for (int y = launcher_geo.y; y < launcher_geo.y+launcher_geo.height; ++y)
593 {
594 for (int x = launcher_geo.x; x < launcher_geo.x + panel_height; ++x)
595 {
596 event->x = x;
597 event->y = y;
598 ASSERT_EQ(launcher_->HandleBarrierEvent(barrier, event),
599 ui::EdgeBarrierSubscriber::Result::HANDLED);
600 }
601 }
602
603 g_settings_reset(gsettings, "launcher-position");
570}604}
571605
572TEST_F(TestLauncher, DndIsSpecialRequest)606TEST_F(TestLauncher, DndIsSpecialRequest)
573607
=== modified file 'tests/test_launcher_controller.cpp'
--- tests/test_launcher_controller.cpp 2016-03-08 01:05:08 +0000
+++ tests/test_launcher_controller.cpp 2016-03-18 01:19:20 +0000
@@ -42,6 +42,7 @@
42#include "mock-application.h"42#include "mock-application.h"
43#include "BamfApplicationManager.h"43#include "BamfApplicationManager.h"
44#include "bamf-mock-application.h"44#include "bamf-mock-application.h"
45#include "unity-shared/UnitySettings.h"
4546
46using namespace testmocks;47using namespace testmocks;
47using namespace unity::launcher;48using namespace unity::launcher;
@@ -490,6 +491,25 @@
490 ASSERT_EQ(launcher_geo.height, monitor_geo.height - panel_style.PanelHeight());491 ASSERT_EQ(launcher_geo.height, monitor_geo.height - panel_style.PanelHeight());
491}492}
492493
494TEST_F(TestLauncherController, LauncherPositionResetsOnGsettingsUpdated)
495{
496 glib::Object<GSettings> gsettings(g_settings_new("com.canonical.Unity.Launcher"));
497 g_settings_set_enum(gsettings, "launcher-position", static_cast<int>(LauncherPosition::LEFT));
498 nux::Geometry const& monitor_geo = uscreen.GetMonitorGeometry(0);
499 nux::Geometry launcher_geo = lc.launcher().GetAbsoluteGeometry();
500 ASSERT_EQ(launcher_geo.x, monitor_geo.x);
501 ASSERT_EQ(launcher_geo.y, monitor_geo.y + panel_style.PanelHeight(0));
502 ASSERT_EQ(launcher_geo.height, monitor_geo.height - panel_style.PanelHeight(0));
503
504 g_settings_set_enum(gsettings, "launcher-position", static_cast<int>(LauncherPosition::BOTTOM));
505 launcher_geo = lc.launcher().GetAbsoluteGeometry();
506 ASSERT_EQ(launcher_geo.x, monitor_geo.x);
507 ASSERT_EQ(launcher_geo.y, monitor_geo.y + monitor_geo.height - launcher_geo.height + 1);
508 ASSERT_EQ(launcher_geo.width, monitor_geo.width);
509
510 g_settings_reset(gsettings, "launcher-position");
511}
512
493TEST_F(TestLauncherController, IconCentersResetsOnMonitorsUpdated)513TEST_F(TestLauncherController, IconCentersResetsOnMonitorsUpdated)
494{514{
495 uscreen.SetupFakeMultiMonitor();515 uscreen.SetupFakeMultiMonitor();
496516
=== modified file 'unity-shared/IconRenderer.cpp'
--- unity-shared/IconRenderer.cpp 2016-02-09 18:16:51 +0000
+++ unity-shared/IconRenderer.cpp 2016-03-18 01:19:20 +0000
@@ -285,8 +285,12 @@
285 {&icon_shine, "launcher_icon_shine_"+tile_sufix, icon_size},285 {&icon_shine, "launcher_icon_shine_"+tile_sufix, icon_size},
286 {&arrow_ltr, "launcher_arrow_ltr_"+marker_sufix, marker_size},286 {&arrow_ltr, "launcher_arrow_ltr_"+marker_sufix, marker_size},
287 {&arrow_rtl, "launcher_arrow_rtl_"+marker_sufix, marker_size},287 {&arrow_rtl, "launcher_arrow_rtl_"+marker_sufix, marker_size},
288 {&arrow_btt, "launcher_arrow_btt_"+marker_sufix, marker_size},
289 {&arrow_ttb, "launcher_arrow_ttb_"+marker_sufix, marker_size},
288 {&arrow_empty_ltr, "launcher_arrow_outline_ltr_"+marker_sufix, marker_size},290 {&arrow_empty_ltr, "launcher_arrow_outline_ltr_"+marker_sufix, marker_size},
291 {&arrow_empty_btt, "launcher_arrow_outline_btt_"+marker_sufix, marker_size},
289 {&pip_ltr, "launcher_pip_ltr_"+marker_sufix, marker_size},292 {&pip_ltr, "launcher_pip_ltr_"+marker_sufix, marker_size},
293 {&pip_btt, "launcher_pip_btt_"+marker_sufix, marker_size},
290 {&progress_bar_trough, "progress_bar_trough", icon_size},294 {&progress_bar_trough, "progress_bar_trough", icon_size},
291 {&progress_bar_fill, "progress_bar_fill", image_size - (icon_size - image_size)},295 {&progress_bar_fill, "progress_bar_fill", image_size - (icon_size - image_size)},
292 };296 };
@@ -327,8 +331,12 @@
327 BaseTexturePtr icon_shine;331 BaseTexturePtr icon_shine;
328 BaseTexturePtr arrow_ltr;332 BaseTexturePtr arrow_ltr;
329 BaseTexturePtr arrow_rtl;333 BaseTexturePtr arrow_rtl;
334 BaseTexturePtr arrow_btt;
335 BaseTexturePtr arrow_ttb;
330 BaseTexturePtr arrow_empty_ltr;336 BaseTexturePtr arrow_empty_ltr;
337 BaseTexturePtr arrow_empty_btt;
331 BaseTexturePtr pip_ltr;338 BaseTexturePtr pip_ltr;
339 BaseTexturePtr pip_btt;
332 BaseTexturePtr progress_bar_trough;340 BaseTexturePtr progress_bar_trough;
333 BaseTexturePtr progress_bar_fill;341 BaseTexturePtr progress_bar_fill;
334342
@@ -439,10 +447,20 @@
439447
440 UpdateIconTransform(launcher_icon, ViewProjectionMatrix, geo, x, y, w, h, z, ui::IconTextureSource::TRANSFORM_GLOW);448 UpdateIconTransform(launcher_icon, ViewProjectionMatrix, geo, x, y, w, h, z, ui::IconTextureSource::TRANSFORM_GLOW);
441449
442 w = geo.width + 2;450 if (Settings::Instance().launcher_position() == LauncherPosition::LEFT)
443 h = icon_size + spacing;451 {
444 if (i == (int) args.size() - 1)452 w = geo.width + 2;
445 h += 4;453 h = icon_size + spacing;
454 if (i == (int) args.size() - 1)
455 h += 4;
456 }
457 else
458 {
459 h = geo.height + 2;
460 w = icon_size + spacing;
461 if (i == (int) args.size() - 1)
462 w += 4;
463 }
446 x = it->logical_center.x - w / 2.0f;464 x = it->logical_center.x - w / 2.0f;
447 y = it->logical_center.y - h / 2.0f;465 y = it->logical_center.y - h / 2.0f;
448 z = it->logical_center.z;466 z = it->logical_center.z;
@@ -1023,23 +1041,38 @@
1023 float alpha,1041 float alpha,
1024 nux::Geometry const& geo)1042 nux::Geometry const& geo)
1025{1043{
1026 int markerCenter = (int) arg.render_center.y;1044 int markerCenter = 0;
1027 markerCenter -= (int)(arg.rotation.x / (2 * M_PI) * icon_size);1045 bool switcher_mode = (pip_style != OUTSIDE_TILE);
1046 bool left_markers = (switcher_mode || Settings::Instance().launcher_position() == LauncherPosition::LEFT);
1047
1048 if (left_markers)
1049 {
1050 markerCenter = (int) arg.render_center.y;
1051 markerCenter -= (int)(arg.rotation.x / (2 * M_PI) * icon_size);
1052 }
1053 else
1054 {
1055 markerCenter = (int) arg.render_center.x;
1056
1057 if (pip_style == OUTSIDE_TILE)
1058 markerCenter += (int)(arg.rotation.y / (2 * M_PI) * icon_size);
1059 }
10281060
1029 if (running > 0)1061 if (running > 0)
1030 {1062 {
1031 int markerX;1063 int markerX = 0;
10321064 if (left_markers)
1033 if (pip_style == OUTSIDE_TILE)1065 {
1034 {1066 if (pip_style == OUTSIDE_TILE)
1035 markerX = geo.x;1067 {
1036 }1068 markerX = geo.x;
1037 else1069 }
1038 {1070 else
1039 auto const& bounds = arg.icon->GetTransform(ui::IconTextureSource::TRANSFORM_TILE, monitor);1071 {
1040 markerX = bounds[0].x + 1;1072 auto const& bounds = arg.icon->GetTransform(ui::IconTextureSource::TRANSFORM_TILE, monitor);
1041 }1073 markerX = bounds[0].x + 1;
10421074 }
1075 }
1043 nux::TexCoordXForm texxform;1076 nux::TexCoordXForm texxform;
1044 nux::Color color = nux::color::LightGrey;1077 nux::Color color = nux::color::LightGrey;
10451078
@@ -1059,41 +1092,87 @@
1059 if (!arg.running_on_viewport)1092 if (!arg.running_on_viewport)
1060 {1093 {
1061 markers[0] = markerCenter;1094 markers[0] = markerCenter;
1062 texture = local_textures_->arrow_empty_ltr;1095 if (left_markers)
1096 texture = local_textures_->arrow_empty_ltr;
1097 else
1098 texture = local_textures_->arrow_empty_btt;
1063 }1099 }
1064 else if (running == 1)1100 else if (running == 1)
1065 {1101 {
1066 markers[0] = markerCenter;1102 markers[0] = markerCenter;
1067 texture = local_textures_->arrow_ltr;1103 if (left_markers)
1104 texture = local_textures_->arrow_ltr;
1105 else
1106 texture = local_textures_->arrow_btt;
1068 }1107 }
1069 else if (running == 2)1108 else if (running == 2)
1070 {1109 {
1071 texture = local_textures_->pip_ltr;1110 int texture_size = 0;
1111 if (left_markers)
1112 {
1113 texture = local_textures_->pip_ltr;
1114 texture_size = texture->GetHeight();
1115 }
1116 else
1117 {
1118 texture = local_textures_->pip_btt;
1119 texture_size = texture->GetWidth();
1120 }
10721121
1073 double default_tex_height = local::MARKER_SIZES[local::IconSize::SMALL];1122 double default_tex_size = local::MARKER_SIZES[local::IconSize::SMALL];
1074 int offset = std::max(1.0, std::round(2.0 * texture->GetHeight() / default_tex_height));1123 int offset = std::max(1.0, std::round(2.0 * texture_size / default_tex_size));
1075 markers[0] = markerCenter - offset;1124 markers[0] = markerCenter - offset;
1076 markers[1] = markerCenter + offset;1125 markers[1] = markerCenter + offset;
1077 }1126 }
1078 else1127 else
1079 {1128 {
1080 texture = local_textures_->pip_ltr;1129 int texture_size = 0;
1130 if (left_markers)
1131 {
1132 texture = local_textures_->pip_ltr;
1133 texture_size = texture->GetHeight();
1134 }
1135 else
1136 {
1137 texture = local_textures_->pip_btt;
1138 texture_size = texture->GetWidth();
1139 }
10811140
1082 double default_tex_height = local::MARKER_SIZES[local::IconSize::SMALL];1141 double default_tex_size = local::MARKER_SIZES[local::IconSize::SMALL];
1083 int offset = std::max(1.0, std::round(4.0 * texture->GetHeight() / default_tex_height));1142 int offset = std::max(1.0, std::round(4.0 * texture_size / default_tex_size));
1084 markers[0] = markerCenter - offset;1143 markers[0] = markerCenter - offset;
1085 markers[1] = markerCenter;1144 markers[1] = markerCenter;
1086 markers[2] = markerCenter + offset;1145 markers[2] = markerCenter + offset;
1087 }1146 }
10881147
1148 int markerY = 0;
1149 if (!left_markers)
1150 {
1151 if (pip_style == OUTSIDE_TILE)
1152 {
1153 markerY = (geo.y + geo.height) - texture->GetHeight();
1154 }
1155 else
1156 {
1157 auto const& bounds = arg.icon->GetTransform(ui::IconTextureSource::TRANSFORM_TILE, monitor);
1158
1159 markerY = (bounds[2].y - (texture->GetHeight()*scale));
1160 }
1161 }
1162
1089 for (int i = 0; i < 3; i++)1163 for (int i = 0; i < 3; i++)
1090 {1164 {
1091 int center = markers[i];1165 int center = markers[i];
1092 if (center == -100)1166 if (center == -100)
1093 break;1167 break;
10941168
1169 if (left_markers)
1170 markerY = center - std::round(texture->GetHeight() / 2.0f);
1171 else
1172 markerX = center - std::round(texture->GetWidth() / 2.0f);
1173
1095 GfxContext.QRP_1Tex(markerX,1174 GfxContext.QRP_1Tex(markerX,
1096 center - std::round(texture->GetHeight() / 2.0f),1175 markerY,
1097 texture->GetWidth(),1176 texture->GetWidth(),
1098 texture->GetHeight(),1177 texture->GetHeight(),
1099 texture->GetDeviceTexture(),1178 texture->GetDeviceTexture(),
@@ -1106,15 +1185,29 @@
1106 {1185 {
1107 nux::TexCoordXForm texxform;1186 nux::TexCoordXForm texxform;
11081187
1109 auto const& arrow_rtl = local_textures_->arrow_rtl;
1110 nux::Color color = nux::color::LightGrey * alpha;1188 nux::Color color = nux::color::LightGrey * alpha;
1111 GfxContext.QRP_1Tex((geo.x + geo.width) - arrow_rtl->GetWidth(),1189 if (left_markers)
1112 markerCenter - std::round(arrow_rtl->GetHeight() / 2.0f),1190 {
1113 arrow_rtl->GetWidth(),1191 auto const& arrow_rtl = local_textures_->arrow_rtl;
1114 arrow_rtl->GetHeight(),1192 GfxContext.QRP_1Tex((geo.x + geo.width) - arrow_rtl->GetWidth(),
1115 arrow_rtl->GetDeviceTexture(),1193 markerCenter - std::round(arrow_rtl->GetHeight() / 2.0f),
1116 texxform,1194 arrow_rtl->GetWidth(),
1117 color);1195 arrow_rtl->GetHeight(),
1196 arrow_rtl->GetDeviceTexture(),
1197 texxform,
1198 color);
1199 }
1200 else
1201 {
1202 auto const& arrow_ttb = local_textures_->arrow_ttb;
1203 GfxContext.QRP_1Tex(markerCenter - std::round(arrow_ttb->GetWidth() / 2.0f),
1204 geo.y,
1205 arrow_ttb->GetWidth(),
1206 arrow_ttb->GetHeight(),
1207 arrow_ttb->GetDeviceTexture(),
1208 texxform,
1209 color);
1210 }
1118 }1211 }
1119}1212}
11201213
@@ -1267,8 +1360,12 @@
1267 float y_cs = -CameraToScreenDistance * tanf(0.5f * Fovy/* *M_PI/180.0f*/);1360 float y_cs = -CameraToScreenDistance * tanf(0.5f * Fovy/* *M_PI/180.0f*/);
1268 float x_cs = y_cs * AspectRatio;1361 float x_cs = y_cs * AspectRatio;
12691362
1270 ViewMatrix = nux::Matrix4::TRANSLATE(-x_cs, y_cs, CameraToScreenDistance) *1363 if (Settings::Instance().launcher_position() == LauncherPosition::LEFT)
1271 nux::Matrix4::SCALE(2.0f * x_cs / ViewportWidth, -2.0f * y_cs / ViewportHeight, -2.0f * 3 * y_cs / ViewportHeight /* or -2.0f * x_cs/ViewportWidth*/);1364 ViewMatrix = nux::Matrix4::TRANSLATE(-x_cs, y_cs, CameraToScreenDistance) *
1365 nux::Matrix4::SCALE(2.0f * x_cs / ViewportWidth, -2.0f * y_cs / ViewportHeight, -2.0f * 3 * y_cs / ViewportHeight /* or -2.0f * x_cs/ViewportWidth*/);
1366 else
1367 ViewMatrix = nux::Matrix4::TRANSLATE(-x_cs, y_cs, CameraToScreenDistance) *
1368 nux::Matrix4::SCALE(2.0f * x_cs / ViewportWidth, -2.0f * y_cs / ViewportHeight, -2.0f * x_cs / ViewportWidth);
12721369
1273 PerspectiveMatrix.Perspective(Fovy, AspectRatio, NearClipPlane, FarClipPlane);1370 PerspectiveMatrix.Perspective(Fovy, AspectRatio, NearClipPlane, FarClipPlane);
1274}1371}
12751372
=== modified file 'unity-shared/SpreadFilter.cpp'
--- unity-shared/SpreadFilter.cpp 2015-11-18 15:43:33 +0000
+++ unity-shared/SpreadFilter.cpp 2016-03-18 01:19:20 +0000
@@ -55,7 +55,7 @@
55 auto& settings = Settings::Instance();55 auto& settings = Settings::Instance();
56 auto const& work_area = wm.GetWorkAreaGeometry(0);56 auto const& work_area = wm.GetWorkAreaGeometry(0);
57 int monitor = wm.MonitorGeometryIn(work_area);57 int monitor = wm.MonitorGeometryIn(work_area);
58 int launcher_width = settings.LauncherWidth(monitor);58 int launcher_width = settings.LauncherSize(monitor);
59 auto const& cv = settings.em(monitor);59 auto const& cv = settings.em(monitor);
6060
61 search_bar_ = SearchBar::Ptr(new SearchBar());61 search_bar_ = SearchBar::Ptr(new SearchBar());
@@ -81,7 +81,10 @@
81 view_window_->SetOpacity(0.0f);81 view_window_->SetOpacity(0.0f);
82 view_window_->SetEnterFocusInputArea(search_bar_.GetPointer());82 view_window_->SetEnterFocusInputArea(search_bar_.GetPointer());
83 view_window_->SetInputFocus();83 view_window_->SetInputFocus();
84 view_window_->SetXY(OFFSET_X.CP(cv) + std::max(work_area.x, launcher_width), OFFSET_Y.CP(cv) + work_area.y);84 if (Settings::Instance().launcher_position() == LauncherPosition::LEFT)
85 view_window_->SetXY(OFFSET_X.CP(cv) + std::max(work_area.x, launcher_width), OFFSET_Y.CP(cv) + work_area.y);
86 else
87 view_window_->SetXY(OFFSET_X.CP(cv) + work_area.x, OFFSET_Y.CP(cv) + work_area.y);
85 fade_animator_.updated.connect([this] (double opacity) { view_window_->SetOpacity(opacity); });88 fade_animator_.updated.connect([this] (double opacity) { view_window_->SetOpacity(opacity); });
8689
87 nux::GetWindowCompositor().SetKeyFocusArea(search_bar_->text_entry());90 nux::GetWindowCompositor().SetKeyFocusArea(search_bar_->text_entry());
8891
=== modified file 'unity-shared/UnitySettings.cpp'
--- unity-shared/UnitySettings.cpp 2015-12-03 05:57:00 +0000
+++ unity-shared/UnitySettings.cpp 2016-03-18 01:19:20 +0000
@@ -40,6 +40,9 @@
40const std::string DOUBLE_CLICK_ACTIVATE = "double-click-activate";40const std::string DOUBLE_CLICK_ACTIVATE = "double-click-activate";
41const std::string DESKTOP_TYPE = "desktop-type";41const std::string DESKTOP_TYPE = "desktop-type";
4242
43const std::string LAUNCHER_SETTINGS = "com.canonical.Unity.Launcher";
44const std::string LAUNCHER_POSITION = "launcher-position";
45
43const std::string LIM_SETTINGS = "com.canonical.Unity.IntegratedMenus";46const std::string LIM_SETTINGS = "com.canonical.Unity.IntegratedMenus";
44const std::string CLICK_MOVEMENT_THRESHOLD = "click-movement-threshold";47const std::string CLICK_MOVEMENT_THRESHOLD = "click-movement-threshold";
45const std::string DOUBLE_CLICK_WAIT = "double-click-wait";48const std::string DOUBLE_CLICK_WAIT = "double-click-wait";
@@ -63,7 +66,7 @@
63const std::string REMOTE_CONTENT_SETTINGS = "com.canonical.Unity.Lenses";66const std::string REMOTE_CONTENT_SETTINGS = "com.canonical.Unity.Lenses";
64const std::string REMOTE_CONTENT_KEY = "remote-content-search";67const std::string REMOTE_CONTENT_KEY = "remote-content-search";
6568
66const int DEFAULT_LAUNCHER_WIDTH = 64;69const int DEFAULT_LAUNCHER_SIZE = 64;
67const int MINIMUM_DESKTOP_HEIGHT = 800;70const int MINIMUM_DESKTOP_HEIGHT = 800;
68const int GNOME_SETTINGS_CHANGED_WAIT_SECONDS = 1;71const int GNOME_SETTINGS_CHANGED_WAIT_SECONDS = 1;
69const double DEFAULT_DPI = 96.0f;72const double DEFAULT_DPI = 96.0f;
@@ -78,12 +81,14 @@
78 Impl(Settings* owner)81 Impl(Settings* owner)
79 : parent_(owner)82 : parent_(owner)
80 , usettings_(g_settings_new(SETTINGS_NAME.c_str()))83 , usettings_(g_settings_new(SETTINGS_NAME.c_str()))
84 , launcher_settings_(g_settings_new(LAUNCHER_SETTINGS.c_str()))
81 , lim_settings_(g_settings_new(LIM_SETTINGS.c_str()))85 , lim_settings_(g_settings_new(LIM_SETTINGS.c_str()))
82 , ui_settings_(g_settings_new(UI_SETTINGS.c_str()))86 , ui_settings_(g_settings_new(UI_SETTINGS.c_str()))
83 , ubuntu_ui_settings_(g_settings_new(UBUNTU_UI_SETTINGS.c_str()))87 , ubuntu_ui_settings_(g_settings_new(UBUNTU_UI_SETTINGS.c_str()))
84 , gnome_ui_settings_(g_settings_new(GNOME_UI_SETTINGS.c_str()))88 , gnome_ui_settings_(g_settings_new(GNOME_UI_SETTINGS.c_str()))
85 , remote_content_settings_(g_settings_new(REMOTE_CONTENT_SETTINGS.c_str()))89 , remote_content_settings_(g_settings_new(REMOTE_CONTENT_SETTINGS.c_str()))
86 , launcher_widths_(monitors::MAX, DEFAULT_LAUNCHER_WIDTH)90 , launcher_sizes_(monitors::MAX, DEFAULT_LAUNCHER_SIZE)
91 , cached_launcher_position_(LauncherPosition::LEFT)
87 , cached_form_factor_(FormFactor::DESKTOP)92 , cached_form_factor_(FormFactor::DESKTOP)
88 , cursor_scale_(1.0)93 , cursor_scale_(1.0)
89 , cached_double_click_activate_(true)94 , cached_double_click_activate_(true)
@@ -95,6 +100,8 @@
95 parent_->form_factor.SetSetterFunction(sigc::mem_fun(this, &Impl::SetFormFactor));100 parent_->form_factor.SetSetterFunction(sigc::mem_fun(this, &Impl::SetFormFactor));
96 parent_->double_click_activate.SetGetterFunction(sigc::mem_fun(this, &Impl::GetDoubleClickActivate));101 parent_->double_click_activate.SetGetterFunction(sigc::mem_fun(this, &Impl::GetDoubleClickActivate));
97 parent_->remote_content.SetGetterFunction(sigc::mem_fun(this, &Impl::GetRemoteContentEnabled));102 parent_->remote_content.SetGetterFunction(sigc::mem_fun(this, &Impl::GetRemoteContentEnabled));
103 parent_->launcher_position.SetGetterFunction(sigc::mem_fun(this, &Impl::GetLauncherPosition));
104 parent_->launcher_position.SetSetterFunction(sigc::mem_fun(this, &Impl::SetLauncherPosition));
98 parent_->desktop_type.SetGetterFunction(sigc::mem_fun(this, &Impl::GetDesktopType));105 parent_->desktop_type.SetGetterFunction(sigc::mem_fun(this, &Impl::GetDesktopType));
99106
100 for (unsigned i = 0; i < monitors::MAX; ++i)107 for (unsigned i = 0; i < monitors::MAX; ++i)
@@ -109,6 +116,11 @@
109 parent_->double_click_activate.changed.emit(cached_double_click_activate_);116 parent_->double_click_activate.changed.emit(cached_double_click_activate_);
110 });117 });
111118
119 signals_.Add<void, GSettings*, const gchar*>(launcher_settings_, "changed::" + LAUNCHER_POSITION, [this] (GSettings*, const gchar*) {
120 CacheLauncherPosition();
121 parent_->launcher_position.changed.emit(cached_launcher_position_);
122 });
123
112 signals_.Add<void, GSettings*, const gchar*>(ubuntu_ui_settings_, "changed::" + SCALE_FACTOR, [this] (GSettings*, const gchar* t) {124 signals_.Add<void, GSettings*, const gchar*>(ubuntu_ui_settings_, "changed::" + SCALE_FACTOR, [this] (GSettings*, const gchar* t) {
113 UpdateDPI();125 UpdateDPI();
114 });126 });
@@ -164,6 +176,7 @@
164 CacheFormFactor();176 CacheFormFactor();
165 CacheDoubleClickActivate();177 CacheDoubleClickActivate();
166 UpdateRemoteContentSearch();178 UpdateRemoteContentSearch();
179 CacheLauncherPosition();
167 }180 }
168181
169 void CacheFormFactor()182 void CacheFormFactor()
@@ -197,6 +210,11 @@
197 cached_double_click_activate_ = g_settings_get_boolean(usettings_, DOUBLE_CLICK_ACTIVATE.c_str());210 cached_double_click_activate_ = g_settings_get_boolean(usettings_, DOUBLE_CLICK_ACTIVATE.c_str());
198 }211 }
199212
213 void CacheLauncherPosition()
214 {
215 cached_launcher_position_ = static_cast<LauncherPosition>(g_settings_get_enum(launcher_settings_, LAUNCHER_POSITION.c_str()));
216 }
217
200 void UpdateLimSetting()218 void UpdateLimSetting()
201 {219 {
202 parent_->lim_movement_thresold = g_settings_get_uint(lim_settings_, CLICK_MOVEMENT_THRESHOLD.c_str());220 parent_->lim_movement_thresold = g_settings_get_uint(lim_settings_, CLICK_MOVEMENT_THRESHOLD.c_str());
@@ -220,6 +238,17 @@
220 return cached_double_click_activate_;238 return cached_double_click_activate_;
221 }239 }
222240
241 LauncherPosition GetLauncherPosition() const
242 {
243 return cached_launcher_position_;
244 }
245
246 bool SetLauncherPosition(LauncherPosition launcherPosition)
247 {
248 g_settings_set_enum(launcher_settings_, LAUNCHER_POSITION.c_str(), static_cast<int>(launcherPosition));
249 return false;
250 }
251
223 DesktopType GetDesktopType() const252 DesktopType GetDesktopType() const
224 {253 {
225 return static_cast<DesktopType>(g_settings_get_enum(usettings_, DESKTOP_TYPE.c_str()));254 return static_cast<DesktopType>(g_settings_get_enum(usettings_, DESKTOP_TYPE.c_str()));
@@ -353,6 +382,7 @@
353382
354 Settings* parent_;383 Settings* parent_;
355 glib::Object<GSettings> usettings_;384 glib::Object<GSettings> usettings_;
385 glib::Object<GSettings> launcher_settings_;
356 glib::Object<GSettings> lim_settings_;386 glib::Object<GSettings> lim_settings_;
357 glib::Object<GSettings> ui_settings_;387 glib::Object<GSettings> ui_settings_;
358 glib::Object<GSettings> ubuntu_ui_settings_;388 glib::Object<GSettings> ubuntu_ui_settings_;
@@ -361,7 +391,8 @@
361 glib::Source::UniquePtr changing_gnome_settings_timeout_;391 glib::Source::UniquePtr changing_gnome_settings_timeout_;
362 glib::SignalManager signals_;392 glib::SignalManager signals_;
363 std::vector<EMConverter::Ptr> em_converters_;393 std::vector<EMConverter::Ptr> em_converters_;
364 std::vector<int> launcher_widths_;394 std::vector<int> launcher_sizes_;
395 LauncherPosition cached_launcher_position_;
365 FormFactor cached_form_factor_;396 FormFactor cached_form_factor_;
366 double cursor_scale_;397 double cursor_scale_;
367 bool cached_double_click_activate_;398 bool cached_double_click_activate_;
@@ -423,19 +454,19 @@
423 return pimpl->em(monitor);454 return pimpl->em(monitor);
424}455}
425456
426void Settings::SetLauncherWidth(int launcher_width, int monitor)457void Settings::SetLauncherSize(int launcher_size, int monitor)
427{458{
428 if (monitor < 0 || monitor >= (int)monitors::MAX)459 if (monitor < 0 || monitor >= (int)monitors::MAX)
429 {460 {
430 LOG_ERROR(logger) << "Invalid monitor index: " << monitor << ". Not updating laucher width.";461 LOG_ERROR(logger) << "Invalid monitor index: " << monitor << ". Not updating launcher size.";
431 }462 }
432 else463 else
433 {464 {
434 pimpl->launcher_widths_[monitor] = launcher_width;465 pimpl->launcher_sizes_[monitor] = launcher_size;
435 }466 }
436}467}
437468
438int Settings::LauncherWidth(int monitor) const469int Settings::LauncherSize(int monitor) const
439{470{
440 if (monitor < 0 || monitor >= (int)monitors::MAX)471 if (monitor < 0 || monitor >= (int)monitors::MAX)
441 {472 {
@@ -443,7 +474,7 @@
443 return 0;474 return 0;
444 }475 }
445476
446 return pimpl->launcher_widths_[monitor];477 return pimpl->launcher_sizes_[monitor];
447}478}
448479
449} // namespace unity480} // namespace unity
450481
=== modified file 'unity-shared/UnitySettings.h'
--- unity-shared/UnitySettings.h 2015-11-23 09:24:10 +0000
+++ unity-shared/UnitySettings.h 2016-03-18 01:19:20 +0000
@@ -35,10 +35,16 @@
35 TV35 TV
36};36};
3737
38enum class LauncherPosition
39{
40 LEFT = 0,
41 BOTTOM
42};
43
38enum class DesktopType44enum class DesktopType
39{45{
40 UBUNTU,46 UBUNTU,
41 UBUNTUKYLIN47 UBUNTUKYLIN
42};48};
4349
44class Settings50class Settings
@@ -52,8 +58,8 @@
52 void SetLowGfxMode(const bool low_gfx);58 void SetLowGfxMode(const bool low_gfx);
53 EMConverter::Ptr const& em(int monitor = 0) const;59 EMConverter::Ptr const& em(int monitor = 0) const;
5460
55 void SetLauncherWidth(int launcher_width, int monitor);61 void SetLauncherSize(int launcher_size, int monitor);
56 int LauncherWidth(int monitor) const;62 int LauncherSize(int mointor) const;
5763
58 nux::RWProperty<FormFactor> form_factor;64 nux::RWProperty<FormFactor> form_factor;
59 nux::Property<bool> is_standalone;65 nux::Property<bool> is_standalone;
@@ -64,6 +70,7 @@
64 nux::Property<bool> lim_unfocused_popup;70 nux::Property<bool> lim_unfocused_popup;
65 nux::Property<double> font_scaling;71 nux::Property<double> font_scaling;
66 nux::ROProperty<bool> remote_content;72 nux::ROProperty<bool> remote_content;
73 nux::RWProperty<LauncherPosition> launcher_position;
6774
68 sigc::signal<void> dpi_changed;75 sigc::signal<void> dpi_changed;
69 sigc::signal<void> low_gfx_changed;76 sigc::signal<void> low_gfx_changed;