Merge lp:~feng-kylin/unity/unityshell-rotated-kylin into lp:unity
- unityshell-rotated-kylin
- Merge into trunk
Status: | Merged | ||||
---|---|---|---|---|---|
Approved by: | Marco Trevisan (Treviño) | ||||
Approved revision: | no longer in the source branch. | ||||
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 | ||||
Related bugs: |
|
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Marco Trevisan (Treviño) | Approve | ||
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.
Marco Trevisan (Treviño) (3v1n0) wrote : | # |
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://
>
> In general, when you call multiple times in the same function
> Settings:
> 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.
Marco Trevisan (Treviño) (3v1n0) : | # |
Marco Trevisan (Treviño) (3v1n0) wrote : | # |
Looks good, there's just a slight change I'd like you to include: http://
Thanks a lot for this huge contribution
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.
Preview Diff
1 | === modified file 'com.canonical.Unity.gschema.xml' | |||
2 | --- com.canonical.Unity.gschema.xml 2016-02-19 21:53:41 +0000 | |||
3 | +++ com.canonical.Unity.gschema.xml 2016-03-18 01:19:20 +0000 | |||
4 | @@ -9,6 +9,10 @@ | |||
5 | 9 | <value nick="Not Expanded" value="0" /> | 9 | <value nick="Not Expanded" value="0" /> |
6 | 10 | <value nick="Expanded" value="1" /> | 10 | <value nick="Expanded" value="1" /> |
7 | 11 | </enum> | 11 | </enum> |
8 | 12 | <enum id="launcher-position-enum"> | ||
9 | 13 | <value nick="Left" value="0" /> | ||
10 | 14 | <value nick="Bottom" value="1" /> | ||
11 | 15 | </enum> | ||
12 | 12 | <enum id="desktop-type-enum"> | 16 | <enum id="desktop-type-enum"> |
13 | 13 | <value nick="Ubuntu" value="0" /> | 17 | <value nick="Ubuntu" value="0" /> |
14 | 14 | <value nick="UbuntuKylin" value="1" /> | 18 | <value nick="UbuntuKylin" value="1" /> |
15 | @@ -145,6 +149,11 @@ | |||
16 | 145 | <summary>Version of last migration done</summary> | 149 | <summary>Version of last migration done</summary> |
17 | 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> |
18 | 147 | </key> | 151 | </key> |
19 | 152 | <key enum="launcher-position-enum" name="launcher-position"> | ||
20 | 153 | <default>"Left"</default> | ||
21 | 154 | <summary>The position of launcher.</summary> | ||
22 | 155 | <description>The position of launcher.</description> | ||
23 | 156 | </key> | ||
24 | 148 | </schema> | 157 | </schema> |
25 | 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"> |
26 | 150 | <key type="as" name="blacklist"> | 159 | <key type="as" name="blacklist"> |
27 | 151 | 160 | ||
28 | === modified file 'dash/DashController.cpp' | |||
29 | --- dash/DashController.cpp 2016-02-17 18:47:09 +0000 | |||
30 | +++ dash/DashController.cpp 2016-03-18 01:19:20 +0000 | |||
31 | @@ -230,15 +230,22 @@ | |||
32 | 230 | nux::Geometry Controller::GetIdealWindowGeometry() | 230 | nux::Geometry Controller::GetIdealWindowGeometry() |
33 | 231 | { | 231 | { |
34 | 232 | UScreen *uscreen = UScreen::GetDefault(); | 232 | UScreen *uscreen = UScreen::GetDefault(); |
37 | 233 | auto monitor_geo = uscreen->GetMonitorGeometry(GetIdealMonitor()); | 233 | auto ideal_geo = uscreen->GetMonitorGeometry(GetIdealMonitor()); |
38 | 234 | int launcher_width = unity::Settings::Instance().LauncherWidth(monitor_); | 234 | int launcher_size = unity::Settings::Instance().LauncherSize(monitor_); |
39 | 235 | 235 | ||
40 | 236 | // We want to cover as much of the screen as possible to grab any mouse events outside | 236 | // We want to cover as much of the screen as possible to grab any mouse events outside |
41 | 237 | // of our window | 237 | // of our window |
46 | 238 | return nux::Geometry (monitor_geo.x + launcher_width, | 238 | if (Settings::Instance().launcher_position() == LauncherPosition::LEFT) |
47 | 239 | monitor_geo.y, | 239 | { |
48 | 240 | monitor_geo.width - launcher_width, | 240 | ideal_geo.x += launcher_size; |
49 | 241 | monitor_geo.height); | 241 | ideal_geo.width -= launcher_size; |
50 | 242 | } | ||
51 | 243 | else | ||
52 | 244 | { | ||
53 | 245 | ideal_geo.height -= launcher_size; | ||
54 | 246 | } | ||
55 | 247 | |||
56 | 248 | return ideal_geo; | ||
57 | 242 | } | 249 | } |
58 | 243 | 250 | ||
59 | 244 | void Controller::OnMonitorChanged(int primary, std::vector<nux::Geometry> const& monitors) | 251 | void Controller::OnMonitorChanged(int primary, std::vector<nux::Geometry> const& monitors) |
60 | @@ -262,8 +269,16 @@ | |||
61 | 262 | 269 | ||
62 | 263 | void Controller::UpdateDashPosition() | 270 | void Controller::UpdateDashPosition() |
63 | 264 | { | 271 | { |
64 | 272 | auto launcher_position = Settings::Instance().launcher_position(); | ||
65 | 273 | int left_offset = 0; | ||
66 | 265 | int top_offset = panel::Style::Instance().PanelHeight(monitor_); | 274 | int top_offset = panel::Style::Instance().PanelHeight(monitor_); |
68 | 266 | int left_offset = unity::Settings::Instance().LauncherWidth(monitor_); | 275 | int launcher_size = unity::Settings::Instance().LauncherSize(monitor_); |
69 | 276 | |||
70 | 277 | if (launcher_position == LauncherPosition::LEFT) | ||
71 | 278 | { | ||
72 | 279 | left_offset = launcher_size; | ||
73 | 280 | } | ||
74 | 281 | |||
75 | 267 | view_->SetMonitorOffset(left_offset, top_offset); | 282 | view_->SetMonitorOffset(left_offset, top_offset); |
76 | 268 | } | 283 | } |
77 | 269 | 284 | ||
78 | 270 | 285 | ||
79 | === modified file 'hud/HudController.cpp' | |||
80 | --- hud/HudController.cpp 2015-04-17 20:32:59 +0000 | |||
81 | +++ hud/HudController.cpp 2016-03-18 01:19:20 +0000 | |||
82 | @@ -174,7 +174,7 @@ | |||
83 | 174 | 174 | ||
84 | 175 | bool Controller::IsLockedToLauncher(int monitor) | 175 | bool Controller::IsLockedToLauncher(int monitor) |
85 | 176 | { | 176 | { |
87 | 177 | if (launcher_locked_out) | 177 | if (launcher_locked_out && Settings::Instance().launcher_position() == LauncherPosition::LEFT) |
88 | 178 | { | 178 | { |
89 | 179 | int primary_monitor = UScreen::GetDefault()->GetPrimaryMonitor(); | 179 | int primary_monitor = UScreen::GetDefault()->GetPrimaryMonitor(); |
90 | 180 | 180 | ||
91 | @@ -206,13 +206,13 @@ | |||
92 | 206 | void Controller::SetIcon(std::string const& icon_name) | 206 | void Controller::SetIcon(std::string const& icon_name) |
93 | 207 | { | 207 | { |
94 | 208 | LOG_DEBUG(logger) << "setting icon to - " << icon_name; | 208 | LOG_DEBUG(logger) << "setting icon to - " << icon_name; |
96 | 209 | int launcher_width = unity::Settings::Instance().LauncherWidth(monitor_index_); | 209 | int launcher_size = unity::Settings::Instance().LauncherSize(monitor_index_); |
97 | 210 | 210 | ||
98 | 211 | if (view_) | 211 | if (view_) |
99 | 212 | { | 212 | { |
100 | 213 | double scale = view_->scale(); | 213 | double scale = view_->scale(); |
101 | 214 | int tsize = tile_size().CP(scale); | 214 | int tsize = tile_size().CP(scale); |
103 | 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); |
104 | 216 | } | 216 | } |
105 | 217 | 217 | ||
106 | 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())); |
107 | @@ -253,7 +253,7 @@ | |||
108 | 253 | 253 | ||
109 | 254 | if (IsLockedToLauncher(ideal_monitor)) | 254 | if (IsLockedToLauncher(ideal_monitor)) |
110 | 255 | { | 255 | { |
112 | 256 | int launcher_width = unity::Settings::Instance().LauncherWidth(ideal_monitor); | 256 | int launcher_width = unity::Settings::Instance().LauncherSize(ideal_monitor); |
113 | 257 | geo.x += launcher_width; | 257 | geo.x += launcher_width; |
114 | 258 | geo.width -= launcher_width; | 258 | geo.width -= launcher_width; |
115 | 259 | } | 259 | } |
116 | @@ -269,12 +269,17 @@ | |||
117 | 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)); |
118 | 270 | 270 | ||
119 | 271 | nux::Geometry const& geo = GetIdealWindowGeometry(); | 271 | nux::Geometry const& geo = GetIdealWindowGeometry(); |
120 | 272 | int launcher_width = unity::Settings::Instance().LauncherWidth(monitor_index_); | ||
121 | 273 | 272 | ||
122 | 274 | view_->QueueDraw(); | 273 | view_->QueueDraw(); |
123 | 275 | window_->SetGeometry(geo); | 274 | window_->SetGeometry(geo); |
124 | 276 | panel::Style &panel_style = panel::Style::Instance(); | 275 | panel::Style &panel_style = panel::Style::Instance(); |
126 | 277 | view_->SetMonitorOffset(launcher_width, panel_style.PanelHeight(monitor_index_)); | 276 | |
127 | 277 | int horizontal_offset = 0; | ||
128 | 278 | |||
129 | 279 | if (Settings::Instance().launcher_position() == LauncherPosition::LEFT) | ||
130 | 280 | horizontal_offset = unity::Settings::Instance().LauncherSize(monitor_index_); | ||
131 | 281 | |||
132 | 282 | view_->SetMonitorOffset(horizontal_offset, panel_style.PanelHeight(monitor_index_)); | ||
133 | 278 | } | 283 | } |
134 | 279 | 284 | ||
135 | 280 | void Controller::OnMouseDownOutsideWindow(int x, int y, | 285 | void Controller::OnMouseDownOutsideWindow(int x, int y, |
136 | 281 | 286 | ||
137 | === modified file 'launcher/BFBLauncherIcon.cpp' | |||
138 | --- launcher/BFBLauncherIcon.cpp 2016-02-10 18:03:01 +0000 | |||
139 | +++ launcher/BFBLauncherIcon.cpp 2016-03-18 01:19:20 +0000 | |||
140 | @@ -31,10 +31,10 @@ | |||
141 | 31 | namespace launcher | 31 | namespace launcher |
142 | 32 | { | 32 | { |
143 | 33 | 33 | ||
145 | 34 | BFBLauncherIcon::BFBLauncherIcon(LauncherHideMode hide_mode) | 34 | BFBLauncherIcon::BFBLauncherIcon() |
146 | 35 | : SimpleLauncherIcon(IconType::HOME) | 35 | : SimpleLauncherIcon(IconType::HOME) |
147 | 36 | , reader_(dash::GSettingsScopesReader::GetDefault()) | 36 | , reader_(dash::GSettingsScopesReader::GetDefault()) |
149 | 37 | , launcher_hide_mode_(hide_mode) | 37 | , launcher_hide_mode_(LAUNCHER_HIDE_NEVER) |
150 | 38 | { | 38 | { |
151 | 39 | position = Position::BEGIN; | 39 | position = Position::BEGIN; |
152 | 40 | SetQuirk(Quirk::VISIBLE, true); | 40 | SetQuirk(Quirk::VISIBLE, true); |
153 | @@ -79,7 +79,8 @@ | |||
154 | 79 | // If the hud is open, we hide the BFB if we have a locked launcher | 79 | // If the hud is open, we hide the BFB if we have a locked launcher |
155 | 80 | else if (overlay_identity.Str() == "hud") | 80 | else if (overlay_identity.Str() == "hud") |
156 | 81 | { | 81 | { |
158 | 82 | if (launcher_hide_mode_ == LAUNCHER_HIDE_NEVER) | 82 | if (launcher_hide_mode_ == LAUNCHER_HIDE_NEVER && |
159 | 83 | Settings::Instance().launcher_position() == LauncherPosition::LEFT) | ||
160 | 83 | { | 84 | { |
161 | 84 | SetVisibleOnMonitor(overlay_monitor, !visible); | 85 | SetVisibleOnMonitor(overlay_monitor, !visible); |
162 | 85 | SkipQuirkAnimation(Quirk::VISIBLE, overlay_monitor); | 86 | SkipQuirkAnimation(Quirk::VISIBLE, overlay_monitor); |
163 | 86 | 87 | ||
164 | === modified file 'launcher/BFBLauncherIcon.h' | |||
165 | --- launcher/BFBLauncherIcon.h 2016-02-10 18:03:01 +0000 | |||
166 | +++ launcher/BFBLauncherIcon.h 2016-03-18 01:19:20 +0000 | |||
167 | @@ -37,7 +37,7 @@ | |||
168 | 37 | { | 37 | { |
169 | 38 | 38 | ||
170 | 39 | public: | 39 | public: |
172 | 40 | BFBLauncherIcon(LauncherHideMode hide_mode); | 40 | BFBLauncherIcon(); |
173 | 41 | 41 | ||
174 | 42 | virtual nux::Color BackgroundColor() const; | 42 | virtual nux::Color BackgroundColor() const; |
175 | 43 | virtual nux::Color GlowColor(); | 43 | virtual nux::Color GlowColor(); |
176 | 44 | 44 | ||
177 | === modified file 'launcher/EdgeBarrierController.cpp' | |||
178 | --- launcher/EdgeBarrierController.cpp 2015-05-28 00:45:21 +0000 | |||
179 | +++ launcher/EdgeBarrierController.cpp 2016-03-18 01:19:20 +0000 | |||
180 | @@ -23,6 +23,7 @@ | |||
181 | 23 | #include "EdgeBarrierControllerPrivate.h" | 23 | #include "EdgeBarrierControllerPrivate.h" |
182 | 24 | #include "Decaymulator.h" | 24 | #include "Decaymulator.h" |
183 | 25 | #include <NuxCore/Logger.h> | 25 | #include <NuxCore/Logger.h> |
184 | 26 | #include "unity-shared/UnitySettings.h" | ||
185 | 26 | #include "unity-shared/UScreen.h" | 27 | #include "unity-shared/UScreen.h" |
186 | 27 | #include "UnityCore/GLibSource.h" | 28 | #include "UnityCore/GLibSource.h" |
187 | 28 | 29 | ||
188 | @@ -93,6 +94,7 @@ | |||
189 | 93 | }));*/ | 94 | }));*/ |
190 | 94 | 95 | ||
191 | 95 | uscreen->changed.connect(sigc::mem_fun(this, &EdgeBarrierController::Impl::OnUScreenChanged)); | 96 | uscreen->changed.connect(sigc::mem_fun(this, &EdgeBarrierController::Impl::OnUScreenChanged)); |
192 | 97 | Settings::Instance().launcher_position.changed.connect(sigc::hide(sigc::mem_fun(this, &EdgeBarrierController::Impl::OnOptionsChanged))); | ||
193 | 96 | 98 | ||
194 | 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)); |
195 | 98 | 100 | ||
196 | @@ -218,6 +220,7 @@ | |||
197 | 218 | return; | 220 | return; |
198 | 219 | 221 | ||
199 | 220 | bool edge_resist = parent_->sticky_edges(); | 222 | bool edge_resist = parent_->sticky_edges(); |
200 | 223 | auto launcher_position = Settings::Instance().launcher_position(); | ||
201 | 221 | 224 | ||
202 | 222 | for (unsigned i = 0; i < layout.size(); i++) | 225 | for (unsigned i = 0; i < layout.size(); i++) |
203 | 223 | { | 226 | { |
204 | @@ -246,10 +249,22 @@ | |||
205 | 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) |
206 | 247 | continue; | 250 | continue; |
207 | 248 | 251 | ||
212 | 249 | vertical_barrier->x1 = monitor.x; | 252 | if (launcher_position == LauncherPosition::LEFT) |
213 | 250 | vertical_barrier->x2 = monitor.x; | 253 | { |
214 | 251 | vertical_barrier->y1 = monitor.y; | 254 | vertical_barrier->x1 = monitor.x; |
215 | 252 | vertical_barrier->y2 = monitor.y + monitor.height; | 255 | vertical_barrier->x2 = monitor.x; |
216 | 256 | vertical_barrier->y1 = monitor.y; | ||
217 | 257 | vertical_barrier->y2 = monitor.y + monitor.height; | ||
218 | 258 | } | ||
219 | 259 | else | ||
220 | 260 | { | ||
221 | 261 | vertical_barrier->x1 = monitor.x; | ||
222 | 262 | vertical_barrier->x2 = monitor.x + monitor.width; | ||
223 | 263 | vertical_barrier->y1 = monitor.y + monitor.height; | ||
224 | 264 | vertical_barrier->y2 = monitor.y + monitor.height; | ||
225 | 265 | vertical_barrier->direction = DOWN; | ||
226 | 266 | } | ||
227 | 267 | |||
228 | 253 | vertical_barrier->index = i; | 268 | vertical_barrier->index = i; |
229 | 254 | 269 | ||
230 | 255 | vertical_barrier->threshold = parent_->options()->edge_stop_velocity(); | 270 | vertical_barrier->threshold = parent_->options()->edge_stop_velocity(); |
231 | 256 | 271 | ||
232 | === modified file 'launcher/HudLauncherIcon.cpp' | |||
233 | --- launcher/HudLauncherIcon.cpp 2014-01-31 16:19:39 +0000 | |||
234 | +++ launcher/HudLauncherIcon.cpp 2016-03-18 01:19:20 +0000 | |||
235 | @@ -22,6 +22,7 @@ | |||
236 | 22 | #include <NuxCore/Logger.h> | 22 | #include <NuxCore/Logger.h> |
237 | 23 | 23 | ||
238 | 24 | #include "unity-shared/UBusMessages.h" | 24 | #include "unity-shared/UBusMessages.h" |
239 | 25 | #include "unity-shared/UnitySettings.h" | ||
240 | 25 | 26 | ||
241 | 26 | #include "config.h" | 27 | #include "config.h" |
242 | 27 | #include <glib/gi18n-lib.h> | 28 | #include <glib/gi18n-lib.h> |
243 | @@ -32,9 +33,9 @@ | |||
244 | 32 | { | 33 | { |
245 | 33 | DECLARE_LOGGER(logger, "unity.launcher.icon.hud"); | 34 | DECLARE_LOGGER(logger, "unity.launcher.icon.hud"); |
246 | 34 | 35 | ||
248 | 35 | HudLauncherIcon::HudLauncherIcon(LauncherHideMode hide_mode) | 36 | HudLauncherIcon::HudLauncherIcon() |
249 | 36 | : SingleMonitorLauncherIcon(IconType::HUD) | 37 | : SingleMonitorLauncherIcon(IconType::HUD) |
251 | 37 | , launcher_hide_mode_(hide_mode) | 38 | , launcher_hide_mode_(LAUNCHER_HIDE_NEVER) |
252 | 38 | , overlay_monitor_(0) | 39 | , overlay_monitor_(0) |
253 | 39 | , single_launcher_(false) | 40 | , single_launcher_(false) |
254 | 40 | , launcher_monitor_(0) | 41 | , launcher_monitor_(0) |
255 | @@ -90,7 +91,7 @@ | |||
256 | 90 | { | 91 | { |
257 | 91 | if (single_launcher_ == single_launcher && launcher_monitor_ == launcher_monitor) | 92 | if (single_launcher_ == single_launcher && launcher_monitor_ == launcher_monitor) |
258 | 92 | return; | 93 | return; |
260 | 93 | 94 | ||
261 | 94 | single_launcher_ = single_launcher; | 95 | single_launcher_ = single_launcher; |
262 | 95 | launcher_monitor_ = launcher_monitor; | 96 | launcher_monitor_ = launcher_monitor; |
263 | 96 | 97 | ||
264 | @@ -112,6 +113,7 @@ | |||
265 | 112 | // If the hud is open, we show the HUD button if we have a locked launcher | 113 | // If the hud is open, we show the HUD button if we have a locked launcher |
266 | 113 | if (overlay_identity.Str() == "hud" && | 114 | if (overlay_identity.Str() == "hud" && |
267 | 114 | launcher_hide_mode_ == LAUNCHER_HIDE_NEVER && | 115 | launcher_hide_mode_ == LAUNCHER_HIDE_NEVER && |
268 | 116 | Settings::Instance().launcher_position() == LauncherPosition::LEFT && | ||
269 | 115 | (!single_launcher_ || (single_launcher_ && launcher_monitor_ == overlay_monitor_))) | 117 | (!single_launcher_ || (single_launcher_ && launcher_monitor_ == overlay_monitor_))) |
270 | 116 | { | 118 | { |
271 | 117 | SetMonitor(visible ? overlay_monitor_ : -1); | 119 | SetMonitor(visible ? overlay_monitor_ : -1); |
272 | 118 | 120 | ||
273 | === modified file 'launcher/HudLauncherIcon.h' | |||
274 | --- launcher/HudLauncherIcon.h 2014-01-31 16:19:39 +0000 | |||
275 | +++ launcher/HudLauncherIcon.h 2016-03-18 01:19:20 +0000 | |||
276 | @@ -32,9 +32,8 @@ | |||
277 | 32 | 32 | ||
278 | 33 | class HudLauncherIcon : public SingleMonitorLauncherIcon | 33 | class HudLauncherIcon : public SingleMonitorLauncherIcon |
279 | 34 | { | 34 | { |
280 | 35 | |||
281 | 36 | public: | 35 | public: |
283 | 37 | HudLauncherIcon(LauncherHideMode hide_mode); | 36 | HudLauncherIcon(); |
284 | 38 | 37 | ||
285 | 39 | virtual nux::Color BackgroundColor() const; | 38 | virtual nux::Color BackgroundColor() const; |
286 | 40 | virtual nux::Color GlowColor(); | 39 | virtual nux::Color GlowColor(); |
287 | @@ -53,7 +52,7 @@ | |||
288 | 53 | nux::Color background_color_; | 52 | nux::Color background_color_; |
289 | 54 | LauncherHideMode launcher_hide_mode_; | 53 | LauncherHideMode launcher_hide_mode_; |
290 | 55 | UBusManager ubus_manager_; | 54 | UBusManager ubus_manager_; |
292 | 56 | gint32 overlay_monitor_; | 55 | gint32 overlay_monitor_; |
293 | 57 | bool single_launcher_; | 56 | bool single_launcher_; |
294 | 58 | int launcher_monitor_; | 57 | int launcher_monitor_; |
295 | 59 | }; | 58 | }; |
296 | 60 | 59 | ||
297 | === modified file 'launcher/Launcher.cpp' | |||
298 | --- launcher/Launcher.cpp 2015-11-25 23:16:57 +0000 | |||
299 | +++ launcher/Launcher.cpp 2016-03-18 01:19:20 +0000 | |||
300 | @@ -66,7 +66,7 @@ | |||
301 | 66 | 66 | ||
302 | 67 | const float BACKLIGHT_STRENGTH = 0.9f; | 67 | const float BACKLIGHT_STRENGTH = 0.9f; |
303 | 68 | const RawPixel ICON_PADDING = 6_em; | 68 | const RawPixel ICON_PADDING = 6_em; |
305 | 69 | const RawPixel RIGHT_LINE_WIDTH = 1_em; | 69 | const RawPixel SIDE_LINE_WIDTH = 1_em; |
306 | 70 | 70 | ||
307 | 71 | const int ANIM_DURATION_SHORT = 125; | 71 | const int ANIM_DURATION_SHORT = 125; |
308 | 72 | const int ANIM_DURATION_SHORT_SHORT = 100; | 72 | const int ANIM_DURATION_SHORT_SHORT = 100; |
309 | @@ -126,6 +126,7 @@ | |||
310 | 126 | , launcher_drag_delta_(0) | 126 | , launcher_drag_delta_(0) |
311 | 127 | , launcher_drag_delta_max_(0) | 127 | , launcher_drag_delta_max_(0) |
312 | 128 | , launcher_drag_delta_min_(0) | 128 | , launcher_drag_delta_min_(0) |
313 | 129 | , enter_x_(0) | ||
314 | 129 | , enter_y_(0) | 130 | , enter_y_(0) |
315 | 130 | , last_button_press_(0) | 131 | , last_button_press_(0) |
316 | 131 | , urgent_animation_period_(0) | 132 | , urgent_animation_period_(0) |
317 | @@ -135,6 +136,7 @@ | |||
318 | 135 | , last_reveal_progress_(0.0f) | 136 | , last_reveal_progress_(0.0f) |
319 | 136 | , drag_action_(nux::DNDACTION_NONE) | 137 | , drag_action_(nux::DNDACTION_NONE) |
320 | 137 | , bg_effect_helper_(this) | 138 | , bg_effect_helper_(this) |
321 | 139 | , launcher_position_(unity::Settings::Instance().launcher_position()) | ||
322 | 138 | , auto_hide_animation_(ANIM_DURATION_SHORT) | 140 | , auto_hide_animation_(ANIM_DURATION_SHORT) |
323 | 139 | , hover_animation_(ANIM_DURATION) | 141 | , hover_animation_(ANIM_DURATION) |
324 | 140 | , drag_over_animation_(ANIM_DURATION_LONG) | 142 | , drag_over_animation_(ANIM_DURATION_LONG) |
325 | @@ -184,11 +186,16 @@ | |||
326 | 184 | 186 | ||
327 | 185 | TextureCache& cache = TextureCache::GetDefault(); | 187 | TextureCache& cache = TextureCache::GetDefault(); |
328 | 186 | launcher_sheen_ = cache.FindTexture("dash_sheen.png"); | 188 | launcher_sheen_ = cache.FindTexture("dash_sheen.png"); |
329 | 187 | launcher_pressure_effect_ = cache.FindTexture("launcher_pressure_effect.png"); | ||
330 | 188 | 189 | ||
331 | 189 | options.changed.connect(sigc::mem_fun(this, &Launcher::OnOptionsChanged)); | 190 | options.changed.connect(sigc::mem_fun(this, &Launcher::OnOptionsChanged)); |
332 | 190 | monitor.changed.connect(sigc::mem_fun(this, &Launcher::OnMonitorChanged)); | 191 | monitor.changed.connect(sigc::mem_fun(this, &Launcher::OnMonitorChanged)); |
333 | 191 | 192 | ||
334 | 193 | launcher_position_changed_ = unity::Settings::Instance().launcher_position.changed.connect([this] (LauncherPosition const& position) { | ||
335 | 194 | launcher_position_ = position; | ||
336 | 195 | OnMonitorChanged(monitor); | ||
337 | 196 | QueueDraw(); | ||
338 | 197 | }); | ||
339 | 198 | |||
340 | 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)); |
341 | 193 | 200 | ||
342 | 194 | auto_hide_animation_.updated.connect(redraw_cb); | 201 | auto_hide_animation_.updated.connect(redraw_cb); |
343 | @@ -303,7 +310,12 @@ | |||
344 | 303 | bool Launcher::MouseBeyondDragThreshold() const | 310 | bool Launcher::MouseBeyondDragThreshold() const |
345 | 304 | { | 311 | { |
346 | 305 | if (GetActionState() == ACTION_DRAG_ICON) | 312 | if (GetActionState() == ACTION_DRAG_ICON) |
348 | 306 | return mouse_position_.x > GetGeometry().width + icon_size_.CP(cv_) / 2; | 313 | { |
349 | 314 | if (launcher_position_ == LauncherPosition::LEFT) | ||
350 | 315 | return mouse_position_.x > GetGeometry().width + icon_size_.CP(cv_) / 2; | ||
351 | 316 | else | ||
352 | 317 | return mouse_position_.y < GetGeometry().y - icon_size_.CP(cv_) / 2; | ||
353 | 318 | } | ||
354 | 307 | return false; | 319 | return false; |
355 | 308 | } | 320 | } |
356 | 309 | 321 | ||
357 | @@ -343,23 +355,31 @@ | |||
358 | 343 | 355 | ||
359 | 344 | void Launcher::SetDndDelta(float x, float y, nux::Geometry const& geo) | 356 | void Launcher::SetDndDelta(float x, float y, nux::Geometry const& geo) |
360 | 345 | { | 357 | { |
363 | 346 | auto const& anchor = MouseIconIntersection(x, enter_y_); | 358 | auto const& anchor = (launcher_position_ == LauncherPosition::LEFT) ? MouseIconIntersection(x, enter_y_) : MouseIconIntersection(enter_x_, y); |
362 | 347 | |||
364 | 348 | int c_icon_size = icon_size_.CP(cv_); | 359 | int c_icon_size = icon_size_.CP(cv_); |
365 | 349 | 360 | ||
366 | 350 | if (anchor) | 361 | if (anchor) |
367 | 351 | { | 362 | { |
369 | 352 | float position = y; | 363 | float position =(launcher_position_ == LauncherPosition::LEFT) ? y: x; |
370 | 364 | |||
371 | 353 | for (AbstractLauncherIcon::Ptr const& model_icon : *model_) | 365 | for (AbstractLauncherIcon::Ptr const& model_icon : *model_) |
372 | 354 | { | 366 | { |
373 | 355 | if (model_icon == anchor) | 367 | if (model_icon == anchor) |
374 | 356 | { | 368 | { |
375 | 357 | position += c_icon_size / 2; | 369 | position += c_icon_size / 2; |
381 | 358 | launcher_drag_delta_ = enter_y_ - position; | 370 | if (launcher_position_ == LauncherPosition::LEFT) |
382 | 359 | 371 | { | |
383 | 360 | if (position + c_icon_size / 2 + launcher_drag_delta_ > geo.height) | 372 | launcher_drag_delta_ = enter_y_ - position; |
384 | 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) |
385 | 362 | 374 | launcher_drag_delta_ -= (position + c_icon_size / 2 + launcher_drag_delta_) - geo.height; | |
386 | 375 | } | ||
387 | 376 | else | ||
388 | 377 | { | ||
389 | 378 | launcher_drag_delta_ = enter_x_ - position; | ||
390 | 379 | |||
391 | 380 | if (position + c_icon_size / 2 + launcher_drag_delta_ > geo.width) | ||
392 | 381 | launcher_drag_delta_ -= (position + c_icon_size / 2 + launcher_drag_delta_) - geo.width; | ||
393 | 382 | } | ||
394 | 363 | break; | 383 | break; |
395 | 364 | } | 384 | } |
396 | 365 | float visibility = model_icon->GetQuirkProgress(AbstractLauncherIcon::Quirk::VISIBLE, monitor()); | 385 | float visibility = model_icon->GetQuirkProgress(AbstractLauncherIcon::Quirk::VISIBLE, monitor()); |
397 | @@ -667,8 +687,9 @@ | |||
398 | 667 | arg.skip = true; | 687 | arg.skip = true; |
399 | 668 | 688 | ||
400 | 669 | int c_icon_size = icon_size_.CP(cv_); | 689 | int c_icon_size = icon_size_.CP(cv_); |
401 | 690 | auto moving_center = (launcher_position_ == LauncherPosition::LEFT) ? center.y : center.x; | ||
402 | 670 | // goes for 0.0f when fully unfolded, to 1.0f folded | 691 | // goes for 0.0f when fully unfolded, to 1.0f folded |
404 | 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); |
405 | 672 | float unfold_progress = icon->GetQuirkProgress(AbstractLauncherIcon::Quirk::UNFOLDED, monitor()); | 693 | float unfold_progress = icon->GetQuirkProgress(AbstractLauncherIcon::Quirk::UNFOLDED, monitor()); |
406 | 673 | float active_progress = icon->GetQuirkProgress(AbstractLauncherIcon::Quirk::ACTIVE, monitor()); | 694 | float active_progress = icon->GetQuirkProgress(AbstractLauncherIcon::Quirk::ACTIVE, monitor()); |
407 | 674 | 695 | ||
408 | @@ -688,23 +709,41 @@ | |||
409 | 688 | 709 | ||
410 | 689 | // icon is crossing threshold, start folding | 710 | // icon is crossing threshold, start folding |
411 | 690 | center.z += folded_z_distance * folding_progress; | 711 | center.z += folded_z_distance * folding_progress; |
413 | 691 | arg.rotation.x = animation_neg_rads * folding_progress; | 712 | if (launcher_position_ == LauncherPosition::LEFT) |
414 | 713 | arg.rotation.x = animation_neg_rads * folding_progress; | ||
415 | 714 | else | ||
416 | 715 | arg.rotation.y = animation_neg_rads * folding_progress; | ||
417 | 692 | 716 | ||
419 | 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); |
420 | 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; |
421 | 695 | 719 | ||
422 | 696 | nux::Point3 centerOffset; | 720 | nux::Point3 centerOffset; |
423 | 697 | float center_transit_progress = icon->GetQuirkProgress(AbstractLauncherIcon::Quirk::CENTER_SAVED, monitor()); | 721 | float center_transit_progress = icon->GetQuirkProgress(AbstractLauncherIcon::Quirk::CENTER_SAVED, monitor()); |
424 | 698 | if (center_transit_progress <= 1.0f) | 722 | if (center_transit_progress <= 1.0f) |
425 | 699 | { | 723 | { |
434 | 700 | int saved_center = icon->GetSavedCenter(monitor).y - parent_abs_geo.y; | 724 | if (launcher_position_ == LauncherPosition::LEFT) |
435 | 701 | centerOffset.y = (saved_center - (center.y + (half_size * size_modifier))) * (1.0f - center_transit_progress); | 725 | { |
436 | 702 | } | 726 | int saved_center = icon->GetSavedCenter(monitor).y - parent_abs_geo.y; |
437 | 703 | 727 | centerOffset.y = (saved_center - (center.y + (half_size * size_modifier))) * (1.0f - center_transit_progress); | |
438 | 704 | center.y += half_size * size_modifier; // move to center | 728 | } |
439 | 705 | 729 | else | |
440 | 706 | arg.render_center = nux::Point3(roundf(center.x + icon_hide_offset), roundf(center.y + centerOffset.y), roundf(center.z)); | 730 | { |
441 | 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; |
442 | 732 | centerOffset.x = (saved_center - (center.x + (half_size * size_modifier))) * (1.0f - center_transit_progress); | ||
443 | 733 | } | ||
444 | 734 | } | ||
445 | 735 | if (launcher_position_ == LauncherPosition::LEFT) | ||
446 | 736 | { | ||
447 | 737 | center.y += half_size * size_modifier; // move to center | ||
448 | 738 | arg.render_center = nux::Point3(roundf(center.x + icon_hide_offset), roundf(center.y + centerOffset.y), roundf(center.z)); | ||
449 | 739 | arg.logical_center = nux::Point3(roundf(center.x + icon_hide_offset), roundf(center.y), roundf(center.z)); | ||
450 | 740 | } | ||
451 | 741 | else | ||
452 | 742 | { | ||
453 | 743 | center.x += half_size * size_modifier; | ||
454 | 744 | arg.render_center = nux::Point3(roundf(center.x + centerOffset.x), roundf(center.y + icon_hide_offset), roundf(center.z)); | ||
455 | 745 | arg.logical_center = nux::Point3(roundf(center.x), roundf(center.y + icon_hide_offset), roundf(center.z)); | ||
456 | 746 | } | ||
457 | 708 | 747 | ||
458 | 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)); |
459 | 710 | icon->SetCenter(icon_center, monitor); | 749 | icon->SetCenter(icon_center, monitor); |
460 | @@ -715,7 +754,10 @@ | |||
461 | 715 | drag_window_->SetAnimationTarget(icon_center.x, icon_center.y); | 754 | drag_window_->SetAnimationTarget(icon_center.x, icon_center.y); |
462 | 716 | } | 755 | } |
463 | 717 | 756 | ||
465 | 718 | center.y += (half_size * size_modifier) + spacing; // move to end | 757 | if (launcher_position_ == LauncherPosition::LEFT) |
466 | 758 | center.y += (half_size * size_modifier) + spacing; // move to end | ||
467 | 759 | else | ||
468 | 760 | center.x += (half_size * size_modifier) + spacing; | ||
469 | 719 | } | 761 | } |
470 | 720 | 762 | ||
471 | 721 | float Launcher::DragLimiter(float x) | 763 | float Launcher::DragLimiter(float x) |
472 | @@ -757,21 +799,30 @@ | |||
473 | 757 | float folded_size = c_icon_size * folding_not_constant; | 799 | float folded_size = c_icon_size * folding_not_constant; |
474 | 758 | float folded_spacing = SPACE_BETWEEN_ICONS.CP(cv_) * folding_not_constant; | 800 | float folded_spacing = SPACE_BETWEEN_ICONS.CP(cv_) * folding_not_constant; |
475 | 759 | 801 | ||
478 | 760 | center.x = geo.width / 2; | 802 | if (launcher_position_ == LauncherPosition::LEFT) |
479 | 761 | center.y = SPACE_BETWEEN_ICONS.CP(cv_); | 803 | { |
480 | 804 | center.x = geo.width / 2; | ||
481 | 805 | center.y = SPACE_BETWEEN_ICONS.CP(cv_); | ||
482 | 806 | } | ||
483 | 807 | else | ||
484 | 808 | { | ||
485 | 809 | center.x = SPACE_BETWEEN_ICONS.CP(cv_); | ||
486 | 810 | center.y = geo.height / 2; | ||
487 | 811 | } | ||
488 | 762 | center.z = 0; | 812 | center.z = 0; |
489 | 763 | 813 | ||
491 | 764 | int launcher_height = geo.height; | 814 | int launcher_size = (launcher_position_ == LauncherPosition::LEFT) ? geo.height : geo.width; |
492 | 765 | folded_ = true; | 815 | folded_ = true; |
493 | 766 | 816 | ||
497 | 767 | // compute required height of launcher AND folding threshold | 817 | // compute required height/width of launcher AND folding threshold |
498 | 768 | float sum = 0.0f + center.y; | 818 | float sum = (launcher_position_ == LauncherPosition::LEFT) ? (0.0f + center.y) : (0.0f + center.x); |
499 | 769 | float folding_threshold = launcher_height - c_icon_size / 2.5f; | 819 | float folding_threshold = launcher_size - c_icon_size / 2.5f; |
500 | 820 | |||
501 | 770 | for (it = model_->begin(); it != model_->end(); ++it) | 821 | for (it = model_->begin(); it != model_->end(); ++it) |
502 | 771 | { | 822 | { |
503 | 772 | float visibility = (*it)->GetQuirkProgress(AbstractLauncherIcon::Quirk::VISIBLE, monitor()); | 823 | float visibility = (*it)->GetQuirkProgress(AbstractLauncherIcon::Quirk::VISIBLE, monitor()); |
506 | 773 | float height = (c_icon_size + SPACE_BETWEEN_ICONS.CP(cv_)) * visibility; | 824 | float size = (c_icon_size + SPACE_BETWEEN_ICONS.CP(cv_)) * visibility; |
507 | 774 | sum += height; | 825 | sum += size; |
508 | 775 | 826 | ||
509 | 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"; |
510 | 777 | const float magic_constant = 1.3f; | 828 | const float magic_constant = 1.3f; |
511 | @@ -780,12 +831,12 @@ | |||
512 | 780 | float active_progress = (*it)->GetQuirkProgress(AbstractLauncherIcon::Quirk::ACTIVE, monitor()); | 831 | float active_progress = (*it)->GetQuirkProgress(AbstractLauncherIcon::Quirk::ACTIVE, monitor()); |
513 | 781 | 832 | ||
514 | 782 | unfold_progress = CLAMP(unfold_progress + active_progress, 0.0f, 1.0f); | 833 | unfold_progress = CLAMP(unfold_progress + active_progress, 0.0f, 1.0f); |
516 | 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); |
517 | 784 | } | 835 | } |
518 | 785 | 836 | ||
520 | 786 | if (sum - SPACE_BETWEEN_ICONS.CP(cv_) <= launcher_height) | 837 | if (sum - SPACE_BETWEEN_ICONS.CP(cv_) <= launcher_size) |
521 | 787 | { | 838 | { |
523 | 788 | folding_threshold = launcher_height; | 839 | folding_threshold = launcher_size; |
524 | 789 | folded_ = false; | 840 | folded_ = false; |
525 | 790 | } | 841 | } |
526 | 791 | 842 | ||
527 | @@ -806,7 +857,10 @@ | |||
528 | 806 | { | 857 | { |
529 | 807 | if (autohide_progress > 0.0f) | 858 | if (autohide_progress > 0.0f) |
530 | 808 | { | 859 | { |
532 | 809 | autohide_offset -= geo.width * autohide_progress; | 860 | if (launcher_position_ == LauncherPosition::LEFT) |
533 | 861 | autohide_offset -= geo.width * autohide_progress; | ||
534 | 862 | else | ||
535 | 863 | autohide_offset += geo.height * autohide_progress; | ||
536 | 810 | if (options()->auto_hide_animation() == FADE_AND_SLIDE) | 864 | if (options()->auto_hide_animation() == FADE_AND_SLIDE) |
537 | 811 | *launcher_alpha = 1.0f - 0.5f * autohide_progress; | 865 | *launcher_alpha = 1.0f - 0.5f * autohide_progress; |
538 | 812 | } | 866 | } |
539 | @@ -816,7 +870,10 @@ | |||
540 | 816 | if (options()->hide_mode != LAUNCHER_HIDE_NEVER) | 870 | if (options()->hide_mode != LAUNCHER_HIDE_NEVER) |
541 | 817 | { | 871 | { |
542 | 818 | float drag_hide_progress = dnd_hide_animation_.GetCurrentValue(); | 872 | float drag_hide_progress = dnd_hide_animation_.GetCurrentValue(); |
544 | 819 | autohide_offset -= geo.width * 0.25f * drag_hide_progress; | 873 | if (launcher_position_ == LauncherPosition::LEFT) |
545 | 874 | autohide_offset -= geo.width * 0.25f * drag_hide_progress; | ||
546 | 875 | else | ||
547 | 876 | autohide_offset += geo.height * 0.25f * drag_hide_progress; | ||
548 | 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)); |
549 | 821 | } | 878 | } |
550 | 822 | 879 | ||
551 | @@ -824,7 +881,12 @@ | |||
552 | 824 | box_geo = geo; | 881 | box_geo = geo; |
553 | 825 | 882 | ||
554 | 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)) |
556 | 827 | box_geo.x += autohide_offset; | 884 | { |
557 | 885 | if (launcher_position_ == LauncherPosition::LEFT) | ||
558 | 886 | box_geo.x += autohide_offset; | ||
559 | 887 | else | ||
560 | 888 | box_geo.y += autohide_offset; | ||
561 | 889 | } | ||
562 | 828 | 890 | ||
563 | 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, |
564 | 830 | * it is initialized only first time). Infact we call SetDndDelta that calls MouseIconIntersection | 892 | * it is initialized only first time). Infact we call SetDndDelta that calls MouseIconIntersection |
565 | @@ -835,26 +897,35 @@ | |||
566 | 835 | static nux::Geometry last_geo = box_geo; | 897 | static nux::Geometry last_geo = box_geo; |
567 | 836 | 898 | ||
568 | 837 | // this happens on hover, basically its a flag and a value in one, we translate this into a dnd offset | 899 | // this happens on hover, basically its a flag and a value in one, we translate this into a dnd offset |
571 | 838 | if (enter_y_ != 0 && enter_y_ + c_icon_size / 2 > folding_threshold) | 900 | if (launcher_position_ == LauncherPosition::LEFT) |
572 | 839 | SetDndDelta(last_geo.x + last_geo.width / 2, center.y, geo); | 901 | { |
573 | 902 | if (enter_y_ != 0 && enter_y_ + c_icon_size / 2 > folding_threshold) | ||
574 | 903 | SetDndDelta(last_geo.x + last_geo.width / 2, center.y, geo); | ||
575 | 904 | } | ||
576 | 905 | else | ||
577 | 906 | { | ||
578 | 907 | if (enter_x_ != 0 && enter_x_ + c_icon_size / 2 > folding_threshold) | ||
579 | 908 | SetDndDelta(center.x, last_geo.y + last_geo.height / 2, geo); | ||
580 | 909 | } | ||
581 | 840 | 910 | ||
582 | 841 | // Update the last_geo value. | 911 | // Update the last_geo value. |
583 | 842 | last_geo = box_geo; | 912 | last_geo = box_geo; |
584 | 843 | enter_y_ = 0; | 913 | enter_y_ = 0; |
585 | 914 | enter_x_ = 0; | ||
586 | 844 | 915 | ||
587 | 845 | // logically dnd exit only restores to the clamped ranges | 916 | // logically dnd exit only restores to the clamped ranges |
588 | 846 | // hover_progress restores to 0 | 917 | // hover_progress restores to 0 |
589 | 847 | launcher_drag_delta_max_ = 0.0f; | 918 | launcher_drag_delta_max_ = 0.0f; |
591 | 848 | launcher_drag_delta_min_ = MIN(0.0f, launcher_height - sum); | 919 | launcher_drag_delta_min_ = MIN(0.0f, launcher_size - sum); |
592 | 849 | 920 | ||
593 | 850 | if (hover_progress > 0.0f && launcher_drag_delta_ != 0) | 921 | if (hover_progress > 0.0f && launcher_drag_delta_ != 0) |
594 | 851 | { | 922 | { |
596 | 852 | float delta_y = launcher_drag_delta_; | 923 | float delta = launcher_drag_delta_; |
597 | 853 | 924 | ||
598 | 854 | if (launcher_drag_delta_ > launcher_drag_delta_max_) | 925 | if (launcher_drag_delta_ > launcher_drag_delta_max_) |
600 | 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_); |
601 | 856 | else if (launcher_drag_delta_ < launcher_drag_delta_min_) | 927 | else if (launcher_drag_delta_ < launcher_drag_delta_min_) |
603 | 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_); |
604 | 858 | 929 | ||
605 | 859 | if (GetActionState() != ACTION_DRAG_LAUNCHER) | 930 | if (GetActionState() != ACTION_DRAG_LAUNCHER) |
606 | 860 | { | 931 | { |
607 | @@ -862,17 +933,21 @@ | |||
608 | 862 | float dnd_progress = std::pow(drag_over_animation_.GetCurrentValue(), 2); | 933 | float dnd_progress = std::pow(drag_over_animation_.GetCurrentValue(), 2); |
609 | 863 | 934 | ||
610 | 864 | if (launcher_drag_delta_ > launcher_drag_delta_max_) | 935 | if (launcher_drag_delta_ > launcher_drag_delta_max_) |
612 | 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; |
613 | 866 | else if (launcher_drag_delta_ < launcher_drag_delta_min_) | 937 | else if (launcher_drag_delta_ < launcher_drag_delta_min_) |
615 | 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; |
616 | 868 | 939 | ||
617 | 869 | if (dnd_progress == 0.0f) | 940 | if (dnd_progress == 0.0f) |
619 | 870 | launcher_drag_delta_ = (int) delta_y; | 941 | launcher_drag_delta_ = (int) delta; |
620 | 871 | } | 942 | } |
621 | 872 | 943 | ||
625 | 873 | delta_y *= hover_progress; | 944 | delta *= hover_progress; |
626 | 874 | center.y += delta_y; | 945 | folding_threshold += delta; |
627 | 875 | folding_threshold += delta_y; | 946 | |
628 | 947 | if (launcher_position_ == LauncherPosition::LEFT) | ||
629 | 948 | center.y += delta; | ||
630 | 949 | else | ||
631 | 950 | center.x += delta; | ||
632 | 876 | } | 951 | } |
633 | 877 | else | 952 | else |
634 | 878 | { | 953 | { |
635 | @@ -903,17 +978,26 @@ | |||
636 | 903 | for (it = model_->shelf_begin(); it != model_->shelf_end(); ++it) | 978 | for (it = model_->shelf_begin(); it != model_->shelf_end(); ++it) |
637 | 904 | { | 979 | { |
638 | 905 | float visibility = (*it)->GetQuirkProgress(AbstractLauncherIcon::Quirk::VISIBLE, monitor()); | 980 | float visibility = (*it)->GetQuirkProgress(AbstractLauncherIcon::Quirk::VISIBLE, monitor()); |
641 | 906 | float height = (c_icon_size + SPACE_BETWEEN_ICONS.CP(cv_)) * visibility; | 981 | float size = (c_icon_size + SPACE_BETWEEN_ICONS.CP(cv_)) * visibility; |
642 | 907 | shelf_sum += height; | 982 | shelf_sum += size; |
643 | 908 | } | 983 | } |
644 | 909 | 984 | ||
645 | 910 | // add bottom padding | 985 | // add bottom padding |
646 | 911 | if (shelf_sum > 0.0f) | 986 | if (shelf_sum > 0.0f) |
647 | 912 | shelf_sum += SPACE_BETWEEN_ICONS.CP(cv_); | 987 | shelf_sum += SPACE_BETWEEN_ICONS.CP(cv_); |
648 | 913 | 988 | ||
650 | 914 | float shelf_delta = MAX(((launcher_height - shelf_sum) + SPACE_BETWEEN_ICONS.CP(cv_)) - center.y, 0.0f); | 989 | float shelf_delta = 0; |
651 | 990 | if (launcher_position_ == LauncherPosition::LEFT) | ||
652 | 991 | { | ||
653 | 992 | shelf_delta = MAX(((launcher_size - shelf_sum) + SPACE_BETWEEN_ICONS.CP(cv_)) - center.y, 0.0f); | ||
654 | 993 | center.y += shelf_delta; | ||
655 | 994 | } | ||
656 | 995 | else | ||
657 | 996 | { | ||
658 | 997 | shelf_delta = MAX(((launcher_size - shelf_sum) + SPACE_BETWEEN_ICONS.CP(cv_)) - center.x, 0.0f); | ||
659 | 998 | center.x += shelf_delta; | ||
660 | 999 | } | ||
661 | 915 | folding_threshold += shelf_delta; | 1000 | folding_threshold += shelf_delta; |
662 | 916 | center.y += shelf_delta; | ||
663 | 917 | 1001 | ||
664 | 918 | force_show_window = false; | 1002 | force_show_window = false; |
665 | 919 | 1003 | ||
666 | @@ -1225,9 +1309,14 @@ | |||
667 | 1225 | auto monitor_geo = uscreen->GetMonitorGeometry(new_monitor); | 1309 | auto monitor_geo = uscreen->GetMonitorGeometry(new_monitor); |
668 | 1226 | unity::panel::Style &panel_style = panel::Style::Instance(); | 1310 | unity::panel::Style &panel_style = panel::Style::Instance(); |
669 | 1227 | int panel_height = panel_style.PanelHeight(new_monitor); | 1311 | int panel_height = panel_style.PanelHeight(new_monitor); |
671 | 1228 | 1312 | RawPixel launcher_height = icon_size_ + ICON_PADDING * 2 + SIDE_LINE_WIDTH - 2; | |
672 | 1229 | cv_ = unity::Settings::Instance().em(monitor); | 1313 | cv_ = unity::Settings::Instance().em(monitor); |
674 | 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_); |
675 | 1315 | |||
676 | 1316 | if (launcher_position_ == LauncherPosition::LEFT) | ||
677 | 1317 | Resize(nux::Point(monitor_geo.x, monitor_geo.y + panel_height), monitor_geo.height - panel_height); | ||
678 | 1318 | else | ||
679 | 1319 | Resize(nux::Point(monitor_geo.x, monitor_geo.y + monitor_geo.height - launcher_height), monitor_geo.width); | ||
680 | 1231 | 1320 | ||
681 | 1232 | icon_renderer_->monitor = new_monitor; | 1321 | icon_renderer_->monitor = new_monitor; |
682 | 1233 | icon_renderer_->scale = cv_->DPIScale(); | 1322 | icon_renderer_->scale = cv_->DPIScale(); |
683 | @@ -1240,6 +1329,7 @@ | |||
684 | 1240 | SetHideMode(options->hide_mode); | 1329 | SetHideMode(options->hide_mode); |
685 | 1241 | SetScrollInactiveIcons(options->scroll_inactive_icons); | 1330 | SetScrollInactiveIcons(options->scroll_inactive_icons); |
686 | 1242 | SetLauncherMinimizeWindow(options->minimize_window_on_click); | 1331 | SetLauncherMinimizeWindow(options->minimize_window_on_click); |
687 | 1332 | OnMonitorChanged(monitor); | ||
688 | 1243 | 1333 | ||
689 | 1244 | if (model_) | 1334 | if (model_) |
690 | 1245 | { | 1335 | { |
691 | @@ -1318,7 +1408,10 @@ | |||
692 | 1318 | hovered_ = hovered; | 1408 | hovered_ = hovered; |
693 | 1319 | 1409 | ||
694 | 1320 | if (!IsInKeyNavMode() && hovered_) | 1410 | if (!IsInKeyNavMode() && hovered_) |
695 | 1411 | { | ||
696 | 1321 | enter_y_ = mouse_position_.y; | 1412 | enter_y_ = mouse_position_.y; |
697 | 1413 | enter_x_ = mouse_position_.x; | ||
698 | 1414 | } | ||
699 | 1322 | 1415 | ||
700 | 1323 | if (folded_) | 1416 | if (folded_) |
701 | 1324 | animation::StartOrReverseIf(hover_animation_, hovered_); | 1417 | animation::StartOrReverseIf(hover_animation_, hovered_); |
702 | @@ -1334,12 +1427,18 @@ | |||
703 | 1334 | 1427 | ||
704 | 1335 | bool Launcher::MouseOverTopScrollArea() | 1428 | bool Launcher::MouseOverTopScrollArea() |
705 | 1336 | { | 1429 | { |
707 | 1337 | return mouse_position_.y < SCROLL_AREA_HEIGHT.CP(cv_); | 1430 | if (launcher_position_ == LauncherPosition::LEFT) |
708 | 1431 | return mouse_position_.y < SCROLL_AREA_HEIGHT.CP(cv_); | ||
709 | 1432 | else | ||
710 | 1433 | return mouse_position_.x < SCROLL_AREA_HEIGHT.CP(cv_); | ||
711 | 1338 | } | 1434 | } |
712 | 1339 | 1435 | ||
713 | 1340 | bool Launcher::MouseOverBottomScrollArea() | 1436 | bool Launcher::MouseOverBottomScrollArea() |
714 | 1341 | { | 1437 | { |
716 | 1342 | return mouse_position_.y >= GetGeometry().height - SCROLL_AREA_HEIGHT.CP(cv_); | 1438 | if (launcher_position_ == LauncherPosition::LEFT) |
717 | 1439 | return mouse_position_.y >= GetGeometry().height - SCROLL_AREA_HEIGHT.CP(cv_); | ||
718 | 1440 | else | ||
719 | 1441 | return mouse_position_.x >= GetGeometry().width - SCROLL_AREA_HEIGHT.CP(cv_); | ||
720 | 1343 | } | 1442 | } |
721 | 1344 | 1443 | ||
722 | 1345 | bool Launcher::OnScrollTimeout() | 1444 | bool Launcher::OnScrollTimeout() |
723 | @@ -1358,7 +1457,11 @@ | |||
724 | 1358 | } | 1457 | } |
725 | 1359 | else | 1458 | else |
726 | 1360 | { | 1459 | { |
728 | 1361 | int mouse_distance = (SCROLL_AREA_HEIGHT.CP(cv_) - mouse_position_.y); | 1460 | int mouse_distance = 0; |
729 | 1461 | if (launcher_position_ == LauncherPosition::LEFT) | ||
730 | 1462 | mouse_distance = (SCROLL_AREA_HEIGHT.CP(cv_) - mouse_position_.y); | ||
731 | 1463 | else | ||
732 | 1464 | mouse_distance = (SCROLL_AREA_HEIGHT.CP(cv_) - mouse_position_.x); | ||
733 | 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; |
734 | 1363 | launcher_drag_delta_ += speed; | 1466 | launcher_drag_delta_ += speed; |
735 | 1364 | } | 1467 | } |
736 | @@ -1371,7 +1474,11 @@ | |||
737 | 1371 | } | 1474 | } |
738 | 1372 | else | 1475 | else |
739 | 1373 | { | 1476 | { |
741 | 1374 | int mouse_distance = (mouse_position_.y + 1) - (GetGeometry().height - SCROLL_AREA_HEIGHT.CP(cv_)); | 1477 | int mouse_distance = 0; |
742 | 1478 | if (launcher_position_ == LauncherPosition::LEFT) | ||
743 | 1479 | mouse_distance = (mouse_position_.y + 1) - (GetGeometry().height - SCROLL_AREA_HEIGHT.CP(cv_)); | ||
744 | 1480 | else | ||
745 | 1481 | mouse_distance = (mouse_position_.x + 1) - (GetGeometry().width - SCROLL_AREA_HEIGHT.CP(cv_)); | ||
746 | 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; |
747 | 1376 | launcher_drag_delta_ -= speed; | 1483 | launcher_drag_delta_ -= speed; |
748 | 1377 | } | 1484 | } |
749 | @@ -1533,7 +1640,10 @@ | |||
750 | 1533 | AbstractLauncherIcon::icon_size = icon_size_; | 1640 | AbstractLauncherIcon::icon_size = icon_size_; |
751 | 1534 | 1641 | ||
752 | 1535 | nux::Geometry const& parent_geo = parent_->GetGeometry(); | 1642 | nux::Geometry const& parent_geo = parent_->GetGeometry(); |
754 | 1536 | Resize(nux::Point(parent_geo.x, parent_geo.y), parent_geo.height); | 1643 | if (launcher_position_ == LauncherPosition::LEFT) |
755 | 1644 | Resize(nux::Point(parent_geo.x, parent_geo.y), parent_geo.height); | ||
756 | 1645 | else | ||
757 | 1646 | Resize(nux::Point(parent_geo.x, parent_geo.y), parent_geo.width); | ||
758 | 1537 | } | 1647 | } |
759 | 1538 | 1648 | ||
760 | 1539 | int Launcher::GetIconSize() const | 1649 | int Launcher::GetIconSize() const |
761 | @@ -1541,13 +1651,24 @@ | |||
762 | 1541 | return icon_size_.CP(cv_); | 1651 | return icon_size_.CP(cv_); |
763 | 1542 | } | 1652 | } |
764 | 1543 | 1653 | ||
766 | 1544 | void Launcher::Resize(nux::Point const& offset, int height) | 1654 | void Launcher::Resize(nux::Point const& offset, int size) |
767 | 1545 | { | 1655 | { |
773 | 1546 | RawPixel width = icon_size_ + ICON_PADDING * 2 + RIGHT_LINE_WIDTH - 2; | 1656 | RawPixel width = 0, height = 0; |
774 | 1547 | 1657 | if (launcher_position_ == LauncherPosition::LEFT) | |
775 | 1548 | width = width.CP(cv_); | 1658 | { |
776 | 1549 | 1659 | width = icon_size_ + ICON_PADDING * 2 + SIDE_LINE_WIDTH - 2; | |
777 | 1550 | SetMaximumHeight(height); | 1660 | width = width.CP(cv_); |
778 | 1661 | height = size; | ||
779 | 1662 | SetMaximumHeight(height); | ||
780 | 1663 | } | ||
781 | 1664 | else | ||
782 | 1665 | { | ||
783 | 1666 | height = icon_size_ + ICON_PADDING * 2 + SIDE_LINE_WIDTH - 2; | ||
784 | 1667 | height = height.CP(cv_); | ||
785 | 1668 | width = size; | ||
786 | 1669 | SetMaximumWidth(width); | ||
787 | 1670 | } | ||
788 | 1671 | |||
789 | 1551 | SetGeometry(nux::Geometry(0, 0, width, height)); | 1672 | SetGeometry(nux::Geometry(0, 0, width, height)); |
790 | 1552 | parent_->SetGeometry(nux::Geometry(offset.x, offset.y, width, height)); | 1673 | parent_->SetGeometry(nux::Geometry(offset.x, offset.y, width, height)); |
791 | 1553 | 1674 | ||
792 | @@ -1692,7 +1813,11 @@ | |||
793 | 1692 | bool force_show_window; | 1813 | bool force_show_window; |
794 | 1693 | nux::Geometry const& geo_absolute = GetAbsoluteGeometry(); | 1814 | nux::Geometry const& geo_absolute = GetAbsoluteGeometry(); |
795 | 1694 | RenderArgs(args, bkg_box, &launcher_alpha, geo_absolute, force_show_window); | 1815 | RenderArgs(args, bkg_box, &launcher_alpha, geo_absolute, force_show_window); |
797 | 1695 | bkg_box.width -= RIGHT_LINE_WIDTH.CP(cv_); | 1816 | |
798 | 1817 | if (launcher_position_ == LauncherPosition::LEFT) | ||
799 | 1818 | bkg_box.width -= SIDE_LINE_WIDTH.CP(cv_); | ||
800 | 1819 | else | ||
801 | 1820 | bkg_box.height -= SIDE_LINE_WIDTH.CP(cv_); | ||
802 | 1696 | 1821 | ||
803 | 1697 | if (options()->hide_mode != LAUNCHER_HIDE_NEVER && | 1822 | if (options()->hide_mode != LAUNCHER_HIDE_NEVER && |
804 | 1698 | bkg_box.x + bkg_box.width <= 0 && | 1823 | bkg_box.x + bkg_box.width <= 0 && |
805 | @@ -1717,10 +1842,19 @@ | |||
806 | 1717 | 1842 | ||
807 | 1718 | int push_count = 1; | 1843 | int push_count = 1; |
808 | 1719 | 1844 | ||
811 | 1720 | // clip vertically but not horizontally | 1845 | if (launcher_position_ == LauncherPosition::LEFT) |
812 | 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)); |
813 | 1847 | else | ||
814 | 1848 | GfxContext.PushClippingRectangle(nux::Geometry(bkg_box.x, base.y, bkg_box.width, base.height)); | ||
815 | 1722 | 1849 | ||
816 | 1723 | float reveal_progress = hide_machine_.reveal_progress; | 1850 | float reveal_progress = hide_machine_.reveal_progress; |
817 | 1851 | TextureCache& cache = TextureCache::GetDefault(); | ||
818 | 1852 | |||
819 | 1853 | std::string launcher_pressure_icon = "launcher_pressure_effect.png"; | ||
820 | 1854 | if (launcher_position_ == LauncherPosition::BOTTOM) | ||
821 | 1855 | launcher_pressure_icon = "launcher_pressure_effect_rotated.png"; | ||
822 | 1856 | |||
823 | 1857 | launcher_pressure_effect_ = cache.FindTexture(launcher_pressure_icon); | ||
824 | 1724 | 1858 | ||
825 | 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()) |
826 | 1726 | { | 1860 | { |
827 | @@ -1737,7 +1871,22 @@ | |||
828 | 1737 | } | 1871 | } |
829 | 1738 | nux::Color pressure_color = nux::color::White * last_reveal_progress_; | 1872 | nux::Color pressure_color = nux::color::White * last_reveal_progress_; |
830 | 1739 | nux::TexCoordXForm texxform_pressure; | 1873 | nux::TexCoordXForm texxform_pressure; |
832 | 1740 | GfxContext.QRP_1Tex(base.x, base.y, launcher_pressure_effect_->GetWidth(), base.height, | 1874 | |
833 | 1875 | int pressure_y = 0, pressure_width = 0, pressure_height = 0; | ||
834 | 1876 | if (launcher_position_ == LauncherPosition::LEFT) | ||
835 | 1877 | { | ||
836 | 1878 | pressure_y = base.y; | ||
837 | 1879 | pressure_width = launcher_pressure_effect_->GetWidth(); | ||
838 | 1880 | pressure_height = base.height; | ||
839 | 1881 | } | ||
840 | 1882 | else | ||
841 | 1883 | { | ||
842 | 1884 | pressure_y = base.y + base.height - SIDE_LINE_WIDTH.CP(cv_) - launcher_pressure_effect_->GetHeight(); | ||
843 | 1885 | pressure_width = base.width; | ||
844 | 1886 | pressure_height = launcher_pressure_effect_->GetHeight(); | ||
845 | 1887 | } | ||
846 | 1888 | |||
847 | 1889 | GfxContext.QRP_1Tex(base.x, pressure_y, pressure_width, pressure_height, | ||
848 | 1741 | launcher_pressure_effect_->GetDeviceTexture(), | 1890 | launcher_pressure_effect_->GetDeviceTexture(), |
849 | 1742 | texxform_pressure, | 1891 | texxform_pressure, |
850 | 1743 | pressure_color); | 1892 | pressure_color); |
851 | @@ -1749,7 +1898,12 @@ | |||
852 | 1749 | { | 1898 | { |
853 | 1750 | nux::ObjectPtr<nux::IOpenGLBaseTexture> blur_texture; | 1899 | nux::ObjectPtr<nux::IOpenGLBaseTexture> blur_texture; |
854 | 1751 | 1900 | ||
856 | 1752 | if (BackgroundEffectHelper::blur_type != unity::BLUR_NONE && (bkg_box.x + bkg_box.width > 0)) | 1901 | bool visible = false; |
857 | 1902 | if ((launcher_position_ == LauncherPosition::LEFT && (bkg_box.x + bkg_box.width > 0)) || | ||
858 | 1903 | (launcher_position_ == LauncherPosition::BOTTOM && (bkg_box.y < bkg_box.height))) | ||
859 | 1904 | visible = true; | ||
860 | 1905 | |||
861 | 1906 | if (BackgroundEffectHelper::blur_type != unity::BLUR_NONE && visible) | ||
862 | 1753 | { | 1907 | { |
863 | 1754 | blur_texture = bg_effect_helper_.GetBlurRegion(); | 1908 | blur_texture = bg_effect_helper_.GetBlurRegion(); |
864 | 1755 | } | 1909 | } |
865 | @@ -1849,13 +2003,42 @@ | |||
866 | 1849 | icon_renderer_->PreprocessIcons(args, base); | 2003 | icon_renderer_->PreprocessIcons(args, base); |
867 | 1850 | EventLogic(); | 2004 | EventLogic(); |
868 | 1851 | 2005 | ||
869 | 2006 | if (!IsOverlayOpen() && launcher_position_ == LauncherPosition::BOTTOM) | ||
870 | 2007 | { | ||
871 | 2008 | const double top_line_opacity = 0.15f * launcher_alpha; | ||
872 | 2009 | |||
873 | 2010 | gPainter.Paint2DQuadColor(GfxContext, | ||
874 | 2011 | nux::Geometry(bkg_box.x, | ||
875 | 2012 | bkg_box.y, | ||
876 | 2013 | bkg_box.width, | ||
877 | 2014 | SIDE_LINE_WIDTH.CP(cv_)), | ||
878 | 2015 | nux::color::White * top_line_opacity); | ||
879 | 2016 | |||
880 | 2017 | gPainter.Paint2DQuadColor(GfxContext, | ||
881 | 2018 | nux::Geometry(bkg_box.x, | ||
882 | 2019 | bkg_box.y, | ||
883 | 2020 | bkg_box.width, | ||
884 | 2021 | 8), | ||
885 | 2022 | nux::Color(0x70000000), | ||
886 | 2023 | nux::Color(0x00000000), | ||
887 | 2024 | nux::Color(0x00000000), | ||
888 | 2025 | nux::Color(0x70000000)); | ||
889 | 2026 | } | ||
890 | 2027 | |||
891 | 1852 | /* draw launcher */ | 2028 | /* draw launcher */ |
892 | 1853 | for (rev_it = args.rbegin(); rev_it != args.rend(); ++rev_it) | 2029 | for (rev_it = args.rbegin(); rev_it != args.rend(); ++rev_it) |
893 | 1854 | { | 2030 | { |
894 | 1855 | if ((*rev_it).stick_thingy) | 2031 | if ((*rev_it).stick_thingy) |
898 | 1856 | gPainter.Paint2DQuadColor(GfxContext, | 2032 | { |
899 | 1857 | nux::Geometry(bkg_box.x, (*rev_it).render_center.y - 3, bkg_box.width, 2), | 2033 | if (launcher_position_ == LauncherPosition::LEFT) |
900 | 1858 | nux::Color(0xAAAAAAAA)); | 2034 | gPainter.Paint2DQuadColor(GfxContext, |
901 | 2035 | nux::Geometry(bkg_box.x, (*rev_it).render_center.y - 3, bkg_box.width, 2), | ||
902 | 2036 | nux::Color(0xAAAAAAAA)); | ||
903 | 2037 | else | ||
904 | 2038 | gPainter.Paint2DQuadColor(GfxContext, | ||
905 | 2039 | nux::Geometry((*rev_it).render_center.x - 3, bkg_box.y, 2, bkg_box.height), | ||
906 | 2040 | nux::Color(0xAAAAAAAA)); | ||
907 | 2041 | } | ||
908 | 1859 | 2042 | ||
909 | 1860 | if ((*rev_it).skip) | 2043 | if ((*rev_it).skip) |
910 | 1861 | continue; | 2044 | continue; |
911 | @@ -1863,14 +2046,14 @@ | |||
912 | 1863 | icon_renderer_->RenderIcon(GfxContext, *rev_it, bkg_box, base); | 2046 | icon_renderer_->RenderIcon(GfxContext, *rev_it, bkg_box, base); |
913 | 1864 | } | 2047 | } |
914 | 1865 | 2048 | ||
916 | 1866 | if (!IsOverlayOpen()) | 2049 | if (!IsOverlayOpen() && launcher_position_ == LauncherPosition::LEFT) |
917 | 1867 | { | 2050 | { |
918 | 1868 | const double right_line_opacity = 0.15f * launcher_alpha; | 2051 | const double right_line_opacity = 0.15f * launcher_alpha; |
919 | 1869 | 2052 | ||
920 | 1870 | gPainter.Paint2DQuadColor(GfxContext, | 2053 | gPainter.Paint2DQuadColor(GfxContext, |
921 | 1871 | nux::Geometry(bkg_box.x + bkg_box.width, | 2054 | nux::Geometry(bkg_box.x + bkg_box.width, |
922 | 1872 | bkg_box.y, | 2055 | bkg_box.y, |
924 | 1873 | RIGHT_LINE_WIDTH.CP(cv_), | 2056 | SIDE_LINE_WIDTH.CP(cv_), |
925 | 1874 | bkg_box.height), | 2057 | bkg_box.height), |
926 | 1875 | nux::color::White * right_line_opacity); | 2058 | nux::color::White * right_line_opacity); |
927 | 1876 | 2059 | ||
928 | @@ -1929,7 +2112,18 @@ | |||
929 | 1929 | void Launcher::StartIconDragRequest(int x, int y) | 2112 | void Launcher::StartIconDragRequest(int x, int y) |
930 | 1930 | { | 2113 | { |
931 | 1931 | auto const& abs_geo = GetAbsoluteGeometry(); | 2114 | auto const& abs_geo = GetAbsoluteGeometry(); |
933 | 1932 | auto const& drag_icon = MouseIconIntersection(abs_geo.width / 2.0f, y); | 2115 | int mouse_x = 0, mouse_y = 0; |
934 | 2116 | if (launcher_position_ == LauncherPosition::LEFT) | ||
935 | 2117 | { | ||
936 | 2118 | mouse_x = abs_geo.width / 2.0f; | ||
937 | 2119 | mouse_y = y; | ||
938 | 2120 | } | ||
939 | 2121 | else | ||
940 | 2122 | { | ||
941 | 2123 | mouse_x = x; | ||
942 | 2124 | mouse_y = abs_geo.height / 2.0f; | ||
943 | 2125 | } | ||
944 | 2126 | auto const& drag_icon = MouseIconIntersection(mouse_x, mouse_y); | ||
945 | 1933 | 2127 | ||
946 | 1934 | // FIXME: nux doesn't give nux::GetEventButton (button_flags) there, relying | 2128 | // FIXME: nux doesn't give nux::GetEventButton (button_flags) there, relying |
947 | 1935 | // on an internal Launcher property then | 2129 | // on an internal Launcher property then |
948 | @@ -2064,7 +2258,18 @@ | |||
949 | 2064 | return; | 2258 | return; |
950 | 2065 | 2259 | ||
951 | 2066 | auto const& launcher_geo = GetGeometry(); | 2260 | auto const& launcher_geo = GetGeometry(); |
953 | 2067 | auto const& hovered_icon = MouseIconIntersection((launcher_geo.x + launcher_geo.width) / 2.0, y - GetAbsoluteY()); | 2261 | int mouse_x = 0, mouse_y = 0; |
954 | 2262 | if (launcher_position_ == LauncherPosition::LEFT) | ||
955 | 2263 | { | ||
956 | 2264 | mouse_x = (launcher_geo.x + launcher_geo.width) / 2.0; | ||
957 | 2265 | mouse_y = y - GetAbsoluteY(); | ||
958 | 2266 | } | ||
959 | 2267 | else | ||
960 | 2268 | { | ||
961 | 2269 | mouse_x = x - GetAbsoluteX(); | ||
962 | 2270 | mouse_y = (launcher_geo.y + launcher_geo.height) / 2.0; | ||
963 | 2271 | } | ||
964 | 2272 | auto const& hovered_icon = MouseIconIntersection(mouse_x, mouse_y); | ||
965 | 2068 | bool mouse_beyond_drag_threshold = MouseBeyondDragThreshold(); | 2273 | bool mouse_beyond_drag_threshold = MouseBeyondDragThreshold(); |
966 | 2069 | 2274 | ||
967 | 2070 | if (hovered_icon && drag_icon_ != hovered_icon) | 2275 | if (hovered_icon && drag_icon_ != hovered_icon) |
968 | @@ -2088,7 +2293,8 @@ | |||
969 | 2088 | if (!icon->IsVisibleOnMonitor(monitor)) | 2293 | if (!icon->IsVisibleOnMonitor(monitor)) |
970 | 2089 | continue; | 2294 | continue; |
971 | 2090 | 2295 | ||
973 | 2091 | if (y >= icon->GetCenter(monitor).y) | 2296 | if ((launcher_position_ == LauncherPosition::LEFT && y >= icon->GetCenter(monitor).y) || |
974 | 2297 | (launcher_position_ == LauncherPosition::BOTTOM && x >= icon->GetCenter(monitor).x)) | ||
975 | 2092 | { | 2298 | { |
976 | 2093 | model_->ReorderAfter(drag_icon_, icon); | 2299 | model_->ReorderAfter(drag_icon_, icon); |
977 | 2094 | break; | 2300 | break; |
978 | @@ -2154,12 +2360,18 @@ | |||
979 | 2154 | if (GetActionState() == ACTION_NONE) | 2360 | if (GetActionState() == ACTION_NONE) |
980 | 2155 | { | 2361 | { |
981 | 2156 | #ifdef USE_X11 | 2362 | #ifdef USE_X11 |
983 | 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) |
984 | 2158 | { | 2364 | { |
985 | 2159 | launcher_drag_delta_ += dnd_delta_y_; | 2365 | launcher_drag_delta_ += dnd_delta_y_; |
986 | 2160 | SetActionState(ACTION_DRAG_LAUNCHER); | 2366 | SetActionState(ACTION_DRAG_LAUNCHER); |
987 | 2161 | hide_machine_.SetQuirk(LauncherHideMachine::VERTICAL_SLIDE_ACTIVE, true); | 2367 | hide_machine_.SetQuirk(LauncherHideMachine::VERTICAL_SLIDE_ACTIVE, true); |
988 | 2162 | } | 2368 | } |
989 | 2369 | else if (nux::Abs(dnd_delta_x_) >= nux::Abs(dnd_delta_y_) && launcher_position_ == LauncherPosition::BOTTOM) | ||
990 | 2370 | { | ||
991 | 2371 | launcher_drag_delta_ += dnd_delta_x_; | ||
992 | 2372 | SetActionState(ACTION_DRAG_LAUNCHER); | ||
993 | 2373 | hide_machine_.SetQuirk(LauncherHideMachine::VERTICAL_SLIDE_ACTIVE, true); | ||
994 | 2374 | } | ||
995 | 2163 | else | 2375 | else |
996 | 2164 | { | 2376 | { |
997 | 2165 | // We we can safely start the icon drag, from the original mouse-down position | 2377 | // We we can safely start the icon drag, from the original mouse-down position |
998 | @@ -2170,7 +2382,10 @@ | |||
999 | 2170 | } | 2382 | } |
1000 | 2171 | else if (GetActionState() == ACTION_DRAG_LAUNCHER) | 2383 | else if (GetActionState() == ACTION_DRAG_LAUNCHER) |
1001 | 2172 | { | 2384 | { |
1003 | 2173 | launcher_drag_delta_ += dy; | 2385 | if (launcher_position_ == LauncherPosition::LEFT) |
1004 | 2386 | launcher_drag_delta_ += dy; | ||
1005 | 2387 | else | ||
1006 | 2388 | launcher_drag_delta_ += dx; | ||
1007 | 2174 | } | 2389 | } |
1008 | 2175 | else if (GetActionState() == ACTION_DRAG_ICON) | 2390 | else if (GetActionState() == ACTION_DRAG_ICON) |
1009 | 2176 | { | 2391 | { |
1010 | @@ -2256,20 +2471,42 @@ | |||
1011 | 2256 | nux::Geometry const& abs_geo = GetAbsoluteGeometry(); | 2471 | nux::Geometry const& abs_geo = GetAbsoluteGeometry(); |
1012 | 2257 | 2472 | ||
1013 | 2258 | bool apply_to_reveal = false; | 2473 | bool apply_to_reveal = false; |
1015 | 2259 | if (event->x >= abs_geo.x && event->x <= abs_geo.x + abs_geo.width) | 2474 | if (launcher_position_ == LauncherPosition::LEFT) |
1016 | 2260 | { | 2475 | { |
1019 | 2261 | if (!hidden_) | 2476 | if (event->x >= abs_geo.x && event->x <= abs_geo.x + abs_geo.width) |
1020 | 2262 | return ui::EdgeBarrierSubscriber::Result::ALREADY_HANDLED; | 2477 | { |
1021 | 2478 | if (!hidden_) | ||
1022 | 2479 | return ui::EdgeBarrierSubscriber::Result::ALREADY_HANDLED; | ||
1023 | 2263 | 2480 | ||
1028 | 2264 | if (options()->reveal_trigger == RevealTrigger::EDGE) | 2481 | if (options()->reveal_trigger == RevealTrigger::EDGE) |
1029 | 2265 | { | 2482 | { |
1030 | 2266 | if (event->y >= abs_geo.y) | 2483 | if (event->y >= abs_geo.y) |
1031 | 2267 | apply_to_reveal = true; | 2484 | apply_to_reveal = true; |
1032 | 2485 | } | ||
1033 | 2486 | else if (options()->reveal_trigger == RevealTrigger::CORNER) | ||
1034 | 2487 | { | ||
1035 | 2488 | if (event->y < abs_geo.y) | ||
1036 | 2489 | apply_to_reveal = true; | ||
1037 | 2490 | } | ||
1038 | 2268 | } | 2491 | } |
1040 | 2269 | else if (options()->reveal_trigger == RevealTrigger::CORNER) | 2492 | } |
1041 | 2493 | else | ||
1042 | 2494 | { | ||
1043 | 2495 | if (event->y >= abs_geo.y && event->y <= abs_geo.y + abs_geo.height) | ||
1044 | 2270 | { | 2496 | { |
1047 | 2271 | if (event->y < abs_geo.y) | 2497 | if (!hidden_) |
1048 | 2272 | apply_to_reveal = true; | 2498 | return ui::EdgeBarrierSubscriber::Result::ALREADY_HANDLED; |
1049 | 2499 | |||
1050 | 2500 | if (options()->reveal_trigger == RevealTrigger::EDGE) | ||
1051 | 2501 | { | ||
1052 | 2502 | if (event->x >= abs_geo.x + panel::Style::Instance().PanelHeight(monitor())) | ||
1053 | 2503 | apply_to_reveal = true; | ||
1054 | 2504 | } | ||
1055 | 2505 | else if (options()->reveal_trigger == RevealTrigger::CORNER) | ||
1056 | 2506 | { | ||
1057 | 2507 | if (event->x < abs_geo.x + panel::Style::Instance().PanelHeight(monitor())) | ||
1058 | 2508 | apply_to_reveal = true; | ||
1059 | 2509 | } | ||
1060 | 2273 | } | 2510 | } |
1061 | 2274 | } | 2511 | } |
1062 | 2275 | 2512 | ||
1063 | @@ -2455,6 +2692,7 @@ | |||
1064 | 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); |
1065 | 2456 | arg.logical_center = arg.render_center; | 2693 | arg.logical_center = arg.render_center; |
1066 | 2457 | arg.rotation.x = 0.0f; | 2694 | arg.rotation.x = 0.0f; |
1067 | 2695 | arg.rotation.y = 0.0f; | ||
1068 | 2458 | arg.running_arrow = false; | 2696 | arg.running_arrow = false; |
1069 | 2459 | arg.active_arrow = false; | 2697 | arg.active_arrow = false; |
1070 | 2460 | arg.skip = false; | 2698 | arg.skip = false; |
1071 | @@ -2616,8 +2854,11 @@ | |||
1072 | 2616 | 2854 | ||
1073 | 2617 | if (options()->hide_mode != LAUNCHER_HIDE_NEVER) | 2855 | if (options()->hide_mode != LAUNCHER_HIDE_NEVER) |
1074 | 2618 | { | 2856 | { |
1077 | 2619 | if (monitor() == 0 && !IsOverlayOpen() && mouse_position_.x == 0 && !drag_edge_touching_ && | 2857 | if ((monitor() == 0 && !IsOverlayOpen() && mouse_position_.x == 0 && !drag_edge_touching_) && |
1078 | 2620 | mouse_position_.y <= (parent_->GetGeometry().height - icon_size_.CP(cv_) - 2 * SPACE_BETWEEN_ICONS.CP(cv_))) | 2858 | ((launcher_position_ == LauncherPosition::LEFT && |
1079 | 2859 | mouse_position_.y <= (parent_->GetGeometry().height - icon_size_.CP(cv_) - 2 * SPACE_BETWEEN_ICONS.CP(cv_))) || | ||
1080 | 2860 | (launcher_position_ == LauncherPosition::BOTTOM && | ||
1081 | 2861 | mouse_position_.x <= (parent_->GetGeometry().width - icon_size_.CP(cv_) - 2 * SPACE_BETWEEN_ICONS.CP(cv_))))) | ||
1082 | 2621 | { | 2862 | { |
1083 | 2622 | if (dnd_hovered_icon_) | 2863 | if (dnd_hovered_icon_) |
1084 | 2623 | { | 2864 | { |
1085 | @@ -2628,7 +2869,9 @@ | |||
1086 | 2628 | animation::StartOrReverse(dnd_hide_animation_, animation::Direction::FORWARD); | 2869 | animation::StartOrReverse(dnd_hide_animation_, animation::Direction::FORWARD); |
1087 | 2629 | drag_edge_touching_ = true; | 2870 | drag_edge_touching_ = true; |
1088 | 2630 | } | 2871 | } |
1090 | 2631 | else if (mouse_position_.x != 0 && drag_edge_touching_) | 2872 | else if (drag_edge_touching_ && |
1091 | 2873 | ((launcher_position_ == LauncherPosition::LEFT && mouse_position_.x != 0) || | ||
1092 | 2874 | (launcher_position_ == LauncherPosition::BOTTOM && mouse_position_.y != 0))) | ||
1093 | 2632 | { | 2875 | { |
1094 | 2633 | animation::StartOrReverse(dnd_hide_animation_, animation::Direction::BACKWARD); | 2876 | animation::StartOrReverse(dnd_hide_animation_, animation::Direction::BACKWARD); |
1095 | 2634 | drag_edge_touching_ = false; | 2877 | drag_edge_touching_ = false; |
1096 | 2635 | 2878 | ||
1097 | === modified file 'launcher/Launcher.h' | |||
1098 | --- launcher/Launcher.h 2015-05-21 16:30:26 +0000 | |||
1099 | +++ launcher/Launcher.h 2016-03-18 01:19:20 +0000 | |||
1100 | @@ -43,6 +43,7 @@ | |||
1101 | 43 | #include "LauncherHoverMachine.h" | 43 | #include "LauncherHoverMachine.h" |
1102 | 44 | #include "unity-shared/MockableBaseWindow.h" | 44 | #include "unity-shared/MockableBaseWindow.h" |
1103 | 45 | #include "unity-shared/UBusWrapper.h" | 45 | #include "unity-shared/UBusWrapper.h" |
1104 | 46 | #include "unity-shared/UnitySettings.h" | ||
1105 | 46 | #include "SoftwareCenterLauncherIcon.h" | 47 | #include "SoftwareCenterLauncherIcon.h" |
1106 | 47 | #include "TooltipManager.h" | 48 | #include "TooltipManager.h" |
1107 | 48 | 49 | ||
1108 | @@ -345,6 +346,7 @@ | |||
1109 | 345 | int launcher_drag_delta_; | 346 | int launcher_drag_delta_; |
1110 | 346 | int launcher_drag_delta_max_; | 347 | int launcher_drag_delta_max_; |
1111 | 347 | int launcher_drag_delta_min_; | 348 | int launcher_drag_delta_min_; |
1112 | 349 | int enter_x_; | ||
1113 | 348 | int enter_y_; | 350 | int enter_y_; |
1114 | 349 | int last_button_press_; | 351 | int last_button_press_; |
1115 | 350 | int drag_icon_position_; | 352 | int drag_icon_position_; |
1116 | @@ -367,6 +369,9 @@ | |||
1117 | 367 | BaseTexturePtr launcher_pressure_effect_; | 369 | BaseTexturePtr launcher_pressure_effect_; |
1118 | 368 | BackgroundEffectHelper bg_effect_helper_; | 370 | BackgroundEffectHelper bg_effect_helper_; |
1119 | 369 | 371 | ||
1120 | 372 | LauncherPosition launcher_position_; | ||
1121 | 373 | connection::Wrapper launcher_position_changed_; | ||
1122 | 374 | |||
1123 | 370 | nux::animation::AnimateValue<float> auto_hide_animation_; | 375 | nux::animation::AnimateValue<float> auto_hide_animation_; |
1124 | 371 | nux::animation::AnimateValue<float> hover_animation_; | 376 | nux::animation::AnimateValue<float> hover_animation_; |
1125 | 372 | nux::animation::AnimateValue<float> drag_over_animation_; | 377 | nux::animation::AnimateValue<float> drag_over_animation_; |
1126 | 373 | 378 | ||
1127 | === modified file 'launcher/LauncherController.cpp' | |||
1128 | --- launcher/LauncherController.cpp 2016-03-07 18:38:06 +0000 | |||
1129 | +++ launcher/LauncherController.cpp 2016-03-18 01:19:20 +0000 | |||
1130 | @@ -34,13 +34,11 @@ | |||
1131 | 34 | #include "VolumeLauncherIcon.h" | 34 | #include "VolumeLauncherIcon.h" |
1132 | 35 | #include "FavoriteStore.h" | 35 | #include "FavoriteStore.h" |
1133 | 36 | #include "FileManagerLauncherIcon.h" | 36 | #include "FileManagerLauncherIcon.h" |
1134 | 37 | #include "HudLauncherIcon.h" | ||
1135 | 38 | #include "LauncherController.h" | 37 | #include "LauncherController.h" |
1136 | 39 | #include "LauncherControllerPrivate.h" | 38 | #include "LauncherControllerPrivate.h" |
1137 | 40 | #include "SoftwareCenterLauncherIcon.h" | 39 | #include "SoftwareCenterLauncherIcon.h" |
1138 | 41 | #include "ExpoLauncherIcon.h" | 40 | #include "ExpoLauncherIcon.h" |
1139 | 42 | #include "TrashLauncherIcon.h" | 41 | #include "TrashLauncherIcon.h" |
1140 | 43 | #include "BFBLauncherIcon.h" | ||
1141 | 44 | #include "unity-shared/AppStreamApplication.h" | 42 | #include "unity-shared/AppStreamApplication.h" |
1142 | 45 | #include "unity-shared/IconRenderer.h" | 43 | #include "unity-shared/IconRenderer.h" |
1143 | 46 | #include "unity-shared/UScreen.h" | 44 | #include "unity-shared/UScreen.h" |
1144 | @@ -107,6 +105,8 @@ | |||
1145 | 107 | , model_(std::make_shared<LauncherModel>()) | 105 | , model_(std::make_shared<LauncherModel>()) |
1146 | 108 | , xdnd_manager_(xdnd_manager) | 106 | , xdnd_manager_(xdnd_manager) |
1147 | 109 | , device_section_(std::make_shared<DeviceLauncherSection>()) | 107 | , device_section_(std::make_shared<DeviceLauncherSection>()) |
1148 | 108 | , bfb_icon_(new BFBLauncherIcon()) | ||
1149 | 109 | , hud_icon_(new HudLauncherIcon()) | ||
1150 | 110 | , expo_icon_(new ExpoLauncherIcon()) | 110 | , expo_icon_(new ExpoLauncherIcon()) |
1151 | 111 | , desktop_icon_(new DesktopLauncherIcon()) | 111 | , desktop_icon_(new DesktopLauncherIcon()) |
1152 | 112 | , edge_barriers_(edge_barriers) | 112 | , edge_barriers_(edge_barriers) |
1153 | @@ -130,20 +130,28 @@ | |||
1154 | 130 | remote_model_.entry_added.connect(sigc::mem_fun(this, &Impl::OnLauncherEntryRemoteAdded)); | 130 | remote_model_.entry_added.connect(sigc::mem_fun(this, &Impl::OnLauncherEntryRemoteAdded)); |
1155 | 131 | remote_model_.entry_removed.connect(sigc::mem_fun(this, &Impl::OnLauncherEntryRemoteRemoved)); | 131 | remote_model_.entry_removed.connect(sigc::mem_fun(this, &Impl::OnLauncherEntryRemoteRemoved)); |
1156 | 132 | 132 | ||
1160 | 133 | LauncherHideMode hide_mode = parent_->options()->hide_mode; | 133 | auto hide_mode = parent_->options()->hide_mode(); |
1161 | 134 | BFBLauncherIcon* bfb = new BFBLauncherIcon(hide_mode); | 134 | bfb_icon_->SetHideMode(hide_mode); |
1162 | 135 | RegisterIcon(AbstractLauncherIcon::Ptr(bfb)); | 135 | RegisterIcon(AbstractLauncherIcon::Ptr(bfb_icon_)); |
1163 | 136 | 136 | ||
1167 | 137 | HudLauncherIcon* hud = new HudLauncherIcon(hide_mode); | 137 | hud_icon_->SetHideMode(hide_mode); |
1168 | 138 | RegisterIcon(AbstractLauncherIcon::Ptr(hud)); | 138 | RegisterIcon(AbstractLauncherIcon::Ptr(hud_icon_)); |
1166 | 139 | hud_icon_ = hud; | ||
1169 | 140 | 139 | ||
1170 | 141 | TrashLauncherIcon* trash = new TrashLauncherIcon(); | 140 | TrashLauncherIcon* trash = new TrashLauncherIcon(); |
1171 | 142 | RegisterIcon(AbstractLauncherIcon::Ptr(trash)); | 141 | RegisterIcon(AbstractLauncherIcon::Ptr(trash)); |
1172 | 143 | 142 | ||
1176 | 144 | parent_->options()->hide_mode.changed.connect([bfb, hud](LauncherHideMode mode) { | 143 | parent_->options()->hide_mode.changed.connect([this] (LauncherHideMode mode) { |
1177 | 145 | bfb->SetHideMode(mode); | 144 | bfb_icon_->SetHideMode(mode); |
1178 | 146 | hud->SetHideMode(mode); | 145 | hud_icon_->SetHideMode(mode); |
1179 | 146 | }); | ||
1180 | 147 | |||
1181 | 148 | parent_->multiple_launchers.changed.connect([this] (bool value) { | ||
1182 | 149 | UScreen* uscreen = UScreen::GetDefault(); | ||
1183 | 150 | auto monitors = uscreen->GetMonitors(); | ||
1184 | 151 | int primary = uscreen->GetPrimaryMonitor(); | ||
1185 | 152 | EnsureLaunchers(primary, monitors); | ||
1186 | 153 | parent_->options()->show_for_all = !value; | ||
1187 | 154 | hud_icon_->SetSingleLauncher(!value, primary); | ||
1188 | 147 | }); | 155 | }); |
1189 | 148 | 156 | ||
1190 | 149 | WindowManager& wm = WindowManager::Default(); | 157 | WindowManager& wm = WindowManager::Default(); |
1191 | @@ -1049,16 +1057,7 @@ | |||
1192 | 1049 | : options(std::make_shared<Options>()) | 1057 | : options(std::make_shared<Options>()) |
1193 | 1050 | , multiple_launchers(true) | 1058 | , multiple_launchers(true) |
1194 | 1051 | , pimpl(new Impl(this, xdnd_manager, edge_barriers)) | 1059 | , pimpl(new Impl(this, xdnd_manager, edge_barriers)) |
1205 | 1052 | { | 1060 | {} |
1196 | 1053 | multiple_launchers.changed.connect([this] (bool value) { | ||
1197 | 1054 | UScreen* uscreen = UScreen::GetDefault(); | ||
1198 | 1055 | auto monitors = uscreen->GetMonitors(); | ||
1199 | 1056 | int primary = uscreen->GetPrimaryMonitor(); | ||
1200 | 1057 | pimpl->EnsureLaunchers(primary, monitors); | ||
1201 | 1058 | options()->show_for_all = !value; | ||
1202 | 1059 | pimpl->hud_icon_->SetSingleLauncher(!value, primary); | ||
1203 | 1060 | }); | ||
1204 | 1061 | } | ||
1206 | 1062 | 1061 | ||
1207 | 1063 | Controller::~Controller() | 1062 | Controller::~Controller() |
1208 | 1064 | {} | 1063 | {} |
1209 | @@ -1446,35 +1445,60 @@ | |||
1210 | 1446 | 1445 | ||
1211 | 1447 | switch (keysym) | 1446 | switch (keysym) |
1212 | 1448 | { | 1447 | { |
1214 | 1449 | // up (move selection up or go to global-menu if at top-most icon) | 1448 | // up |
1215 | 1450 | case NUX_VK_UP: | 1449 | case NUX_VK_UP: |
1216 | 1451 | case NUX_KP_UP: | 1450 | case NUX_KP_UP: |
1218 | 1452 | parent_->KeyNavPrevious(); | 1451 | if (Settings::Instance().launcher_position() == LauncherPosition::LEFT) |
1219 | 1452 | // move selection up or go to global-menu if at top-most icon | ||
1220 | 1453 | parent_->KeyNavPrevious(); | ||
1221 | 1454 | else | ||
1222 | 1455 | OpenQuicklist(); | ||
1223 | 1453 | break; | 1456 | break; |
1224 | 1454 | 1457 | ||
1226 | 1455 | // down (move selection down and unfold launcher if needed) | 1458 | // down |
1227 | 1456 | case NUX_VK_DOWN: | 1459 | case NUX_VK_DOWN: |
1228 | 1457 | case NUX_KP_DOWN: | 1460 | case NUX_KP_DOWN: |
1233 | 1458 | parent_->KeyNavNext(); | 1461 | if (Settings::Instance().launcher_position() == LauncherPosition::LEFT) |
1234 | 1459 | break; | 1462 | // move selection down and unfold launcher if needed |
1235 | 1460 | 1463 | parent_->KeyNavNext(); | |
1236 | 1461 | // super/control/esc/left (close quicklist or exit laucher key-focus) | 1464 | else |
1237 | 1465 | // exit launcher key-focus | ||
1238 | 1466 | parent_->KeyNavTerminate(false); | ||
1239 | 1467 | break; | ||
1240 | 1468 | |||
1241 | 1469 | // left | ||
1242 | 1470 | case NUX_VK_LEFT: | ||
1243 | 1471 | case NUX_KP_LEFT: | ||
1244 | 1472 | if (Settings::Instance().launcher_position() == LauncherPosition::LEFT) | ||
1245 | 1473 | parent_->KeyNavTerminate(false); | ||
1246 | 1474 | else | ||
1247 | 1475 | // move selection left or go to global-menu if at top-most icon or close quicklist | ||
1248 | 1476 | parent_->KeyNavPrevious(); | ||
1249 | 1477 | break; | ||
1250 | 1478 | |||
1251 | 1479 | // right | ||
1252 | 1480 | case NUX_VK_RIGHT: | ||
1253 | 1481 | case NUX_KP_RIGHT: | ||
1254 | 1482 | if (Settings::Instance().launcher_position() == LauncherPosition::LEFT) | ||
1255 | 1483 | OpenQuicklist(); | ||
1256 | 1484 | else | ||
1257 | 1485 | // move selection right and unfold launcher if needed | ||
1258 | 1486 | parent_->KeyNavNext(); | ||
1259 | 1487 | break; | ||
1260 | 1488 | |||
1261 | 1489 | // super/control/esc (close quicklist or exit laucher key-focus) | ||
1262 | 1462 | case NUX_VK_LWIN: | 1490 | case NUX_VK_LWIN: |
1263 | 1463 | case NUX_VK_RWIN: | 1491 | case NUX_VK_RWIN: |
1264 | 1464 | case NUX_VK_CONTROL: | 1492 | case NUX_VK_CONTROL: |
1265 | 1465 | case NUX_VK_LEFT: | ||
1266 | 1466 | case NUX_KP_LEFT: | ||
1267 | 1467 | case NUX_VK_ESCAPE: | 1493 | case NUX_VK_ESCAPE: |
1268 | 1468 | // hide again | 1494 | // hide again |
1269 | 1469 | parent_->KeyNavTerminate(false); | 1495 | parent_->KeyNavTerminate(false); |
1270 | 1470 | break; | 1496 | break; |
1271 | 1471 | 1497 | ||
1273 | 1472 | // right/shift-f10 (open quicklist of currently selected icon) | 1498 | // shift-f10 (open quicklist of currently selected icon) |
1274 | 1473 | case XK_F10: | 1499 | case XK_F10: |
1275 | 1474 | if (!(state & nux::NUX_STATE_SHIFT)) | 1500 | if (!(state & nux::NUX_STATE_SHIFT)) |
1276 | 1475 | break; | 1501 | break; |
1277 | 1476 | case NUX_VK_RIGHT: | ||
1278 | 1477 | case NUX_KP_RIGHT: | ||
1279 | 1478 | case XK_Menu: | 1502 | case XK_Menu: |
1280 | 1479 | OpenQuicklist(); | 1503 | OpenQuicklist(); |
1281 | 1480 | break; | 1504 | break; |
1282 | 1481 | 1505 | ||
1283 | === modified file 'launcher/LauncherControllerPrivate.h' | |||
1284 | --- launcher/LauncherControllerPrivate.h 2016-02-19 12:36:57 +0000 | |||
1285 | +++ launcher/LauncherControllerPrivate.h 2016-03-18 01:19:20 +0000 | |||
1286 | @@ -36,10 +36,11 @@ | |||
1287 | 36 | #include "LauncherEntryRemote.h" | 36 | #include "LauncherEntryRemote.h" |
1288 | 37 | #include "LauncherEntryRemoteModel.h" | 37 | #include "LauncherEntryRemoteModel.h" |
1289 | 38 | #include "LauncherModel.h" | 38 | #include "LauncherModel.h" |
1290 | 39 | #include "BFBLauncherIcon.h" | ||
1291 | 40 | #include "HudLauncherIcon.h" | ||
1292 | 39 | #include "SoftwareCenterLauncherIcon.h" | 41 | #include "SoftwareCenterLauncherIcon.h" |
1293 | 40 | #include "unity-shared/UBusWrapper.h" | 42 | #include "unity-shared/UBusWrapper.h" |
1294 | 41 | #include "XdndManager.h" | 43 | #include "XdndManager.h" |
1295 | 42 | #include "HudLauncherIcon.h" | ||
1296 | 43 | 44 | ||
1297 | 44 | namespace unity | 45 | namespace unity |
1298 | 45 | { | 46 | { |
1299 | @@ -124,9 +125,10 @@ | |||
1300 | 124 | XdndManager::Ptr xdnd_manager_; | 125 | XdndManager::Ptr xdnd_manager_; |
1301 | 125 | DeviceLauncherSection::Ptr device_section_; | 126 | DeviceLauncherSection::Ptr device_section_; |
1302 | 126 | LauncherEntryRemoteModel remote_model_; | 127 | LauncherEntryRemoteModel remote_model_; |
1303 | 128 | BFBLauncherIcon* bfb_icon_; | ||
1304 | 129 | HudLauncherIcon* hud_icon_; | ||
1305 | 127 | AbstractLauncherIcon::Ptr expo_icon_; | 130 | AbstractLauncherIcon::Ptr expo_icon_; |
1306 | 128 | AbstractLauncherIcon::Ptr desktop_icon_; | 131 | AbstractLauncherIcon::Ptr desktop_icon_; |
1307 | 129 | HudLauncherIcon* hud_icon_; | ||
1308 | 130 | 132 | ||
1309 | 131 | #ifdef USE_X11 | 133 | #ifdef USE_X11 |
1310 | 132 | ui::EdgeBarrierController::Ptr edge_barriers_; | 134 | ui::EdgeBarrierController::Ptr edge_barriers_; |
1311 | @@ -148,7 +150,7 @@ | |||
1312 | 148 | 150 | ||
1313 | 149 | connection::Wrapper launcher_key_press_connection_; | 151 | connection::Wrapper launcher_key_press_connection_; |
1314 | 150 | connection::Wrapper launcher_event_outside_connection_; | 152 | connection::Wrapper launcher_event_outside_connection_; |
1316 | 151 | connection::Wrapper launcher_key_nav_terminate_; | 153 | connection::Wrapper launcher_key_nav_terminate_; |
1317 | 152 | connection::Wrapper average_color_connection_; | 154 | connection::Wrapper average_color_connection_; |
1318 | 153 | }; | 155 | }; |
1319 | 154 | 156 | ||
1320 | 155 | 157 | ||
1321 | === modified file 'launcher/LauncherIcon.cpp' | |||
1322 | --- launcher/LauncherIcon.cpp 2016-02-25 15:59:41 +0000 | |||
1323 | +++ launcher/LauncherIcon.cpp 2016-03-18 01:19:20 +0000 | |||
1324 | @@ -465,7 +465,14 @@ | |||
1325 | 465 | nux::Point LauncherIcon::GetTipPosition(int monitor) const | 465 | nux::Point LauncherIcon::GetTipPosition(int monitor) const |
1326 | 466 | { | 466 | { |
1327 | 467 | auto const& converter = Settings::Instance().em(monitor); | 467 | auto const& converter = Settings::Instance().em(monitor); |
1329 | 468 | return nux::Point(_center[monitor].x + converter->CP(icon_size()) / 2 + 1, _center[monitor].y); | 468 | if (Settings::Instance().launcher_position() == LauncherPosition::LEFT) |
1330 | 469 | { | ||
1331 | 470 | return nux::Point(_center[monitor].x + converter->CP(icon_size()) / 2 + 1, _center[monitor].y); | ||
1332 | 471 | } | ||
1333 | 472 | else | ||
1334 | 473 | { | ||
1335 | 474 | return nux::Point(_center[monitor].x, _center[monitor].y - converter->CP(icon_size()) / 2 - 1); | ||
1336 | 475 | } | ||
1337 | 469 | } | 476 | } |
1338 | 470 | 477 | ||
1339 | 471 | void LauncherIcon::ShowTooltip() | 478 | void LauncherIcon::ShowTooltip() |
1340 | 472 | 479 | ||
1341 | === modified file 'launcher/QuicklistView.cpp' | |||
1342 | --- launcher/QuicklistView.cpp 2015-05-20 15:31:09 +0000 | |||
1343 | +++ launcher/QuicklistView.cpp 2016-03-18 01:19:20 +0000 | |||
1344 | @@ -81,8 +81,16 @@ | |||
1345 | 81 | { | 81 | { |
1346 | 82 | SetGeometry(nux::Geometry(0, 0, 1, 1)); | 82 | SetGeometry(nux::Geometry(0, 0, 1, 1)); |
1347 | 83 | 83 | ||
1350 | 84 | _left_space = new nux::SpaceLayout(RawPixel(_padding + ANCHOR_WIDTH + CORNER_RADIUS + LEFT_PADDING_CORRECTION).CP(cv_), | 84 | int width = 0; |
1351 | 85 | RawPixel(_padding + ANCHOR_WIDTH + CORNER_RADIUS + LEFT_PADDING_CORRECTION).CP(cv_), | 85 | int height = 0; |
1352 | 86 | // when launcher is on the left, the anchor is on the left of the menuitem, and | ||
1353 | 87 | // when launcher is on the bottom, the anchor is on the bottom of the menuitem. | ||
1354 | 88 | if (Settings::Instance().launcher_position == LauncherPosition::LEFT) | ||
1355 | 89 | width = ANCHOR_WIDTH; | ||
1356 | 90 | else | ||
1357 | 91 | height = ANCHOR_WIDTH; | ||
1358 | 92 | _left_space = new nux::SpaceLayout(RawPixel(_padding + width + CORNER_RADIUS + LEFT_PADDING_CORRECTION).CP(cv_), | ||
1359 | 93 | RawPixel(_padding + width + CORNER_RADIUS + LEFT_PADDING_CORRECTION).CP(cv_), | ||
1360 | 86 | 1, MAX_HEIGHT.CP(cv_)); | 94 | 1, MAX_HEIGHT.CP(cv_)); |
1361 | 87 | 95 | ||
1362 | 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_), |
1363 | @@ -94,8 +102,8 @@ | |||
1364 | 94 | _padding.CP(cv_) + CORNER_RADIUS.CP(cv_)); | 102 | _padding.CP(cv_) + CORNER_RADIUS.CP(cv_)); |
1365 | 95 | 103 | ||
1366 | 96 | _bottom_space = new nux::SpaceLayout(1, MAX_WIDTH.CP(cv_), | 104 | _bottom_space = new nux::SpaceLayout(1, MAX_WIDTH.CP(cv_), |
1369 | 97 | _padding.CP(cv_) + CORNER_RADIUS.CP(cv_), | 105 | _padding.CP(cv_) + height + CORNER_RADIUS.CP(cv_), |
1370 | 98 | _padding.CP(cv_) + CORNER_RADIUS.CP(cv_)); | 106 | _padding.CP(cv_) + height + CORNER_RADIUS.CP(cv_)); |
1371 | 99 | 107 | ||
1372 | 100 | _vlayout = new nux::VLayout(TEXT(""), NUX_TRACKER_LOCATION); | 108 | _vlayout = new nux::VLayout(TEXT(""), NUX_TRACKER_LOCATION); |
1373 | 101 | _vlayout->AddLayout(_top_space, 0); | 109 | _vlayout->AddLayout(_top_space, 0); |
1374 | @@ -129,12 +137,35 @@ | |||
1375 | 129 | 137 | ||
1376 | 130 | int QuicklistView::CalculateX() const | 138 | int QuicklistView::CalculateX() const |
1377 | 131 | { | 139 | { |
1379 | 132 | return _anchorX - _padding.CP(cv_); | 140 | int x = 0; |
1380 | 141 | if (Settings::Instance().launcher_position() == LauncherPosition::LEFT) | ||
1381 | 142 | x = _anchorX - _padding.CP(cv_); | ||
1382 | 143 | else | ||
1383 | 144 | { | ||
1384 | 145 | int size = 0; | ||
1385 | 146 | int max = GetBaseWidth() - ANCHOR_HEIGHT.CP(cv_) - 2 * CORNER_RADIUS.CP(cv_) - 2 * _padding.CP(cv_); | ||
1386 | 147 | if (_top_size.CP(cv_) > max) | ||
1387 | 148 | { | ||
1388 | 149 | size = max; | ||
1389 | 150 | } | ||
1390 | 151 | else if (_top_size.CP(cv_) > 0) | ||
1391 | 152 | { | ||
1392 | 153 | size = _top_size.CP(cv_); | ||
1393 | 154 | } | ||
1394 | 155 | x = _anchorX - (ANCHOR_HEIGHT.CP(cv_) / 2) - size - CORNER_RADIUS.CP(cv_) - _padding.CP(cv_); | ||
1395 | 156 | } | ||
1396 | 157 | |||
1397 | 158 | return x; | ||
1398 | 133 | } | 159 | } |
1399 | 134 | 160 | ||
1400 | 135 | int QuicklistView::CalculateY() const | 161 | int QuicklistView::CalculateY() const |
1401 | 136 | { | 162 | { |
1403 | 137 | return _anchorY - (ANCHOR_HEIGHT.CP(cv_) / 2) - _top_size.CP(cv_) - CORNER_RADIUS.CP(cv_) - _padding.CP(cv_); | 163 | int y = 0; |
1404 | 164 | if (Settings::Instance().launcher_position() == LauncherPosition::LEFT) | ||
1405 | 165 | y = _anchorY - (ANCHOR_HEIGHT.CP(cv_) / 2) - _top_size.CP(cv_) - CORNER_RADIUS.CP(cv_) - _padding.CP(cv_); | ||
1406 | 166 | else | ||
1407 | 167 | y = _anchorY - GetBaseHeight() + _padding.CP(cv_); | ||
1408 | 168 | return y; | ||
1409 | 138 | } | 169 | } |
1410 | 139 | 170 | ||
1411 | 140 | void | 171 | void |
1412 | @@ -338,12 +369,29 @@ | |||
1413 | 338 | auto* us = UScreen::GetDefault(); | 369 | auto* us = UScreen::GetDefault(); |
1414 | 339 | int ql_monitor = us->GetMonitorAtPosition(_anchorX, _anchorY); | 370 | int ql_monitor = us->GetMonitorAtPosition(_anchorX, _anchorY); |
1415 | 340 | auto const& ql_monitor_geo = us->GetMonitorGeometry(ql_monitor); | 371 | auto const& ql_monitor_geo = us->GetMonitorGeometry(ql_monitor); |
1417 | 341 | int offscreen_size = GetBaseY() + GetBaseHeight() - (ql_monitor_geo.y + ql_monitor_geo.height); | 372 | auto launcher_position = Settings::Instance().launcher_position(); |
1418 | 342 | 373 | ||
1421 | 343 | if (offscreen_size > 0) | 374 | if (launcher_position == LauncherPosition::LEFT) |
1422 | 344 | _top_size = offscreen_size + TOP_SIZE; | 375 | { |
1423 | 376 | int offscreen_size = GetBaseY() + GetBaseHeight() - (ql_monitor_geo.y + ql_monitor_geo.height); | ||
1424 | 377 | if (offscreen_size > 0) | ||
1425 | 378 | _top_size = offscreen_size + TOP_SIZE; | ||
1426 | 379 | else | ||
1427 | 380 | _top_size = TOP_SIZE; | ||
1428 | 381 | } | ||
1429 | 345 | else | 382 | else |
1431 | 346 | _top_size = TOP_SIZE; | 383 | { |
1432 | 384 | int offscreen_size_left = ql_monitor_geo.x - (_anchorX - GetBaseWidth() / 2); | ||
1433 | 385 | int offscreen_size_right = _anchorX + GetBaseWidth()/2 - (ql_monitor_geo.x + ql_monitor_geo.width); | ||
1434 | 386 | int half_size = (GetBaseWidth() / 2) - _padding.CP(cv_) - CORNER_RADIUS.CP(cv_) - (ANCHOR_HEIGHT.CP(cv_) / 2); | ||
1435 | 387 | |||
1436 | 388 | if (offscreen_size_left > 0) | ||
1437 | 389 | _top_size = half_size - offscreen_size_left; | ||
1438 | 390 | else if (offscreen_size_right > 0) | ||
1439 | 391 | _top_size = half_size + offscreen_size_right; | ||
1440 | 392 | else | ||
1441 | 393 | _top_size = half_size; | ||
1442 | 394 | } | ||
1443 | 347 | 395 | ||
1444 | 348 | SetXY(CalculateX(), CalculateY()); | 396 | SetXY(CalculateX(), CalculateY()); |
1445 | 349 | } | 397 | } |
1446 | @@ -442,10 +490,14 @@ | |||
1447 | 442 | TotalItemHeight += text_extents.height; | 490 | TotalItemHeight += text_extents.height; |
1448 | 443 | } | 491 | } |
1449 | 444 | 492 | ||
1450 | 493 | int rotated_anchor_height = 0; | ||
1451 | 494 | if (Settings::Instance().launcher_position() == LauncherPosition::BOTTOM) | ||
1452 | 495 | rotated_anchor_height = ANCHOR_WIDTH; | ||
1453 | 496 | |||
1454 | 445 | if (TotalItemHeight < ANCHOR_HEIGHT.CP(cv_)) | 497 | if (TotalItemHeight < ANCHOR_HEIGHT.CP(cv_)) |
1455 | 446 | { | 498 | { |
1458 | 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; |
1459 | 448 | int t = b + OFFSET_CORRECTION.CP(cv_); | 500 | int t = b + OFFSET_CORRECTION.CP(cv_) - rotated_anchor_height; |
1460 | 449 | 501 | ||
1461 | 450 | _top_space->SetMinimumHeight(t); | 502 | _top_space->SetMinimumHeight(t); |
1462 | 451 | _top_space->SetMaximumHeight(t); | 503 | _top_space->SetMaximumHeight(t); |
1463 | @@ -455,8 +507,8 @@ | |||
1464 | 455 | } | 507 | } |
1465 | 456 | else | 508 | else |
1466 | 457 | { | 509 | { |
1469 | 458 | int b = _padding.CP(cv_) + CORNER_RADIUS.CP(cv_); | 510 | int b = _padding.CP(cv_) + CORNER_RADIUS.CP(cv_) + rotated_anchor_height; |
1470 | 459 | int t = b + OFFSET_CORRECTION.CP(cv_); | 511 | int t = b + OFFSET_CORRECTION.CP(cv_) - rotated_anchor_height; |
1471 | 460 | 512 | ||
1472 | 461 | _top_space->SetMinimumHeight(t); | 513 | _top_space->SetMinimumHeight(t); |
1473 | 462 | _top_space->SetMaximumHeight(t); | 514 | _top_space->SetMaximumHeight(t); |
1474 | @@ -476,7 +528,10 @@ | |||
1475 | 476 | 528 | ||
1476 | 477 | UpdateTexture(); | 529 | UpdateTexture(); |
1477 | 478 | 530 | ||
1479 | 479 | int x = RawPixel(_padding + ANCHOR_WIDTH + CORNER_RADIUS + OFFSET_CORRECTION).CP(cv_); | 531 | int width = 0; |
1480 | 532 | if (Settings::Instance().launcher_position() == LauncherPosition::LEFT) | ||
1481 | 533 | width = ANCHOR_WIDTH; | ||
1482 | 534 | int x = RawPixel(_padding + width + CORNER_RADIUS + OFFSET_CORRECTION).CP(cv_); | ||
1483 | 480 | int y = _top_space->GetMinimumHeight(); | 535 | int y = _top_space->GetMinimumHeight(); |
1484 | 481 | 536 | ||
1485 | 482 | for (auto const& item : _item_list) | 537 | for (auto const& item : _item_list) |
1486 | @@ -655,7 +710,9 @@ | |||
1487 | 655 | 710 | ||
1488 | 656 | nux::Area* QuicklistView::FindAreaUnderMouse(const nux::Point& mouse_position, nux::NuxEventType event_type) | 711 | nux::Area* QuicklistView::FindAreaUnderMouse(const nux::Point& mouse_position, nux::NuxEventType event_type) |
1489 | 657 | { | 712 | { |
1491 | 658 | if (mouse_position.x > _anchorX) | 713 | auto launcher_position = Settings::Instance().launcher_position(); |
1492 | 714 | if ((launcher_position == LauncherPosition::LEFT && (mouse_position.x > _anchorX)) || | ||
1493 | 715 | (launcher_position == LauncherPosition::BOTTOM && (mouse_position.y < _anchorY))) | ||
1494 | 659 | { | 716 | { |
1495 | 660 | return (CairoBaseWindow::FindAreaUnderMouse(mouse_position, event_type)); | 717 | return (CairoBaseWindow::FindAreaUnderMouse(mouse_position, event_type)); |
1496 | 661 | } | 718 | } |
1497 | @@ -864,109 +921,164 @@ | |||
1498 | 864 | gfloat radius, | 921 | gfloat radius, |
1499 | 865 | guint pad) | 922 | guint pad) |
1500 | 866 | { | 923 | { |
1522 | 867 | // 0 1 2 3 | 924 | // On the right of the icon: On the top of the icon: |
1523 | 868 | // +--+--------+--+ | 925 | // 0 1 2 3 0 1 2 3 |
1524 | 869 | // | | | 926 | // +--+--------+--+ +--+-----------+--+ |
1525 | 870 | // + 14 + 4 | 927 | // | | | | |
1526 | 871 | // | | | 928 | // + 14 + 4 14 + + 4 |
1527 | 872 | // | | | 929 | // | | | | |
1528 | 873 | // | | | 930 | // | | | | |
1529 | 874 | // + 13 | | 931 | // | | | | |
1530 | 875 | // / | | 932 | // + 13 | | | |
1531 | 876 | // / | | 933 | // / | | | |
1532 | 877 | // + 12 | | 934 | // / | | | |
1533 | 878 | // \ | | 935 | // + 12 | | | |
1534 | 879 | // \ | | 936 | // \ | | | |
1535 | 880 | // 11 + | | 937 | // \ | | | |
1536 | 881 | // | | | 938 | // 11 + | | | |
1537 | 882 | // | | | 939 | // | | 13 + + 5 |
1538 | 883 | // | | | 940 | // | | | 10 8 | |
1539 | 884 | // 10 + + 5 | 941 | // | | 12 +--+--+ +--+--+ 6 |
1540 | 885 | // | | | 942 | // 10 + + 5 11 \ / 7 |
1541 | 886 | // +--+--------+--+ 6 | 943 | // | | \ / |
1542 | 887 | // 9 8 7 | 944 | // +--+--------+--+ 6 + |
1543 | 945 | // 9 8 7 9 | ||
1544 | 888 | 946 | ||
1545 | 889 | 947 | ||
1546 | 890 | gfloat padding = pad; | 948 | gfloat padding = pad; |
1547 | 891 | int ZEROPOINT5 = 0.0f; | 949 | int ZEROPOINT5 = 0.0f; |
1555 | 892 | 950 | auto launcher_position = Settings::Instance().launcher_position(); | |
1549 | 893 | gfloat HeightToAnchor = ((gfloat) height - 2.0f * radius - anchor_height - 2 * padding) / 2.0f; | ||
1550 | 894 | if (HeightToAnchor < 0.0f) | ||
1551 | 895 | { | ||
1552 | 896 | g_warning("Anchor-height and corner-radius a higher than whole texture!"); | ||
1553 | 897 | return; | ||
1554 | 898 | } | ||
1556 | 899 | 951 | ||
1557 | 900 | //gint dynamic_size = height - 2*radius - 2*padding - anchor_height; | 952 | //gint dynamic_size = height - 2*radius - 2*padding - anchor_height; |
1558 | 901 | //gint upper_dynamic_size = upper_size; | 953 | //gint upper_dynamic_size = upper_size; |
1559 | 902 | //gint lower_dynamic_size = dynamic_size - upper_dynamic_size; | 954 | //gint lower_dynamic_size = dynamic_size - upper_dynamic_size; |
1560 | 903 | 955 | ||
1561 | 956 | int size = 0; | ||
1562 | 957 | if (launcher_position == LauncherPosition::LEFT) | ||
1563 | 958 | size = height; | ||
1564 | 959 | else | ||
1565 | 960 | size = width; | ||
1566 | 961 | |||
1567 | 962 | gfloat HeightToAnchor = ((gfloat) size - 2.0f * radius - anchor_height - 2 * padding) / 2.0f; | ||
1568 | 963 | if (HeightToAnchor < 0.0f) | ||
1569 | 964 | { | ||
1570 | 965 | g_warning("Anchor-height and corner-radius a higher than whole texture!"); | ||
1571 | 966 | return; | ||
1572 | 967 | } | ||
1573 | 968 | |||
1574 | 904 | if (upper_size >= 0) | 969 | if (upper_size >= 0) |
1575 | 905 | { | 970 | { |
1577 | 906 | if (upper_size > height - 2.0f * radius - anchor_height - 2 * padding) | 971 | if (upper_size > size - 2.0f * radius - anchor_height - 2 * padding) |
1578 | 907 | { | 972 | { |
1579 | 908 | //g_warning ("[_compute_full_mask_path] incorrect upper_size value"); | 973 | //g_warning ("[_compute_full_mask_path] incorrect upper_size value"); |
1580 | 909 | HeightToAnchor = 0; | 974 | HeightToAnchor = 0; |
1581 | 910 | } | 975 | } |
1582 | 911 | else | 976 | else |
1583 | 912 | { | 977 | { |
1585 | 913 | HeightToAnchor = height - 2.0f * radius - anchor_height - 2 * padding - upper_size; | 978 | HeightToAnchor = size - 2.0f * radius - anchor_height - 2 * padding - upper_size; |
1586 | 914 | } | 979 | } |
1587 | 915 | } | 980 | } |
1588 | 916 | else | 981 | else |
1589 | 917 | { | 982 | { |
1591 | 918 | HeightToAnchor = (height - 2.0f * radius - anchor_height - 2 * padding) / 2.0f; | 983 | if (launcher_position == LauncherPosition::LEFT) |
1592 | 984 | HeightToAnchor = (size - 2.0f * radius - anchor_height - 2 * padding) / 2.0f; | ||
1593 | 985 | else | ||
1594 | 986 | HeightToAnchor = size - 2.0f * radius - anchor_height - 2 * padding; | ||
1595 | 919 | } | 987 | } |
1596 | 920 | 988 | ||
1597 | 921 | cairo_translate(cr, -0.5f, -0.5f); | 989 | cairo_translate(cr, -0.5f, -0.5f); |
1598 | 922 | 990 | ||
1599 | 923 | // create path | 991 | // create path |
1646 | 924 | cairo_move_to(cr, padding + anchor_width + radius + ZEROPOINT5, padding + ZEROPOINT5); // Point 1 | 992 | if (launcher_position == LauncherPosition::LEFT) |
1647 | 925 | cairo_line_to(cr, width - padding - radius, padding + ZEROPOINT5); // Point 2 | 993 | { |
1648 | 926 | cairo_arc(cr, | 994 | cairo_move_to(cr, padding + anchor_width + radius + ZEROPOINT5, padding + ZEROPOINT5); // Point 1 |
1649 | 927 | width - padding - radius + ZEROPOINT5, | 995 | cairo_line_to(cr, width - padding - radius, padding + ZEROPOINT5); // Point 2 |
1650 | 928 | padding + radius + ZEROPOINT5, | 996 | cairo_arc(cr, |
1651 | 929 | radius, | 997 | width - padding - radius + ZEROPOINT5, |
1652 | 930 | -90.0f * G_PI / 180.0f, | 998 | padding + radius + ZEROPOINT5, |
1653 | 931 | 0.0f * G_PI / 180.0f); // Point 4 | 999 | radius, |
1654 | 932 | cairo_line_to(cr, | 1000 | -90.0f * G_PI / 180.0f, |
1655 | 933 | (gdouble) width - padding + ZEROPOINT5, | 1001 | 0.0f * G_PI / 180.0f); // Point 4 |
1656 | 934 | (gdouble) height - radius - padding + ZEROPOINT5); // Point 5 | 1002 | cairo_line_to(cr, |
1657 | 935 | cairo_arc(cr, | 1003 | (gdouble) width - padding + ZEROPOINT5, |
1658 | 936 | (gdouble) width - padding - radius + ZEROPOINT5, | 1004 | (gdouble) height - radius - padding + ZEROPOINT5); // Point 5 |
1659 | 937 | (gdouble) height - padding - radius + ZEROPOINT5, | 1005 | cairo_arc(cr, |
1660 | 938 | radius, | 1006 | (gdouble) width - padding - radius + ZEROPOINT5, |
1661 | 939 | 0.0f * G_PI / 180.0f, | 1007 | (gdouble) height - padding - radius + ZEROPOINT5, |
1662 | 940 | 90.0f * G_PI / 180.0f); // Point 7 | 1008 | radius, |
1663 | 941 | cairo_line_to(cr, | 1009 | 0.0f * G_PI / 180.0f, |
1664 | 942 | anchor_width + padding + radius + ZEROPOINT5, | 1010 | 90.0f * G_PI / 180.0f); // Point 7 |
1665 | 943 | (gdouble) height - padding + ZEROPOINT5); // Point 8 | 1011 | cairo_line_to(cr, |
1666 | 944 | 1012 | anchor_width + padding + radius + ZEROPOINT5, | |
1667 | 945 | cairo_arc(cr, | 1013 | (gdouble) height - padding + ZEROPOINT5); // Point 8 |
1668 | 946 | anchor_width + padding + radius + ZEROPOINT5, | 1014 | cairo_arc(cr, |
1669 | 947 | (gdouble) height - padding - radius, | 1015 | anchor_width + padding + radius + ZEROPOINT5, |
1670 | 948 | radius, | 1016 | (gdouble) height - padding - radius, |
1671 | 949 | 90.0f * G_PI / 180.0f, | 1017 | radius, |
1672 | 950 | 180.0f * G_PI / 180.0f); // Point 10 | 1018 | 90.0f * G_PI / 180.0f, |
1673 | 951 | 1019 | 180.0f * G_PI / 180.0f); // Point 10 | |
1674 | 952 | cairo_line_to(cr, | 1020 | cairo_line_to(cr, |
1675 | 953 | padding + anchor_width + ZEROPOINT5, | 1021 | padding + anchor_width + ZEROPOINT5, |
1676 | 954 | (gdouble) height - padding - radius - HeightToAnchor + ZEROPOINT5); // Point 11 | 1022 | (gdouble) height - padding - radius - HeightToAnchor + ZEROPOINT5); // Point 11 |
1677 | 955 | cairo_line_to(cr, | 1023 | cairo_line_to(cr, |
1678 | 956 | padding + ZEROPOINT5, | 1024 | padding + ZEROPOINT5, |
1679 | 957 | (gdouble) height - padding - radius - HeightToAnchor - anchor_height / 2.0f + ZEROPOINT5); // Point 12 | 1025 | (gdouble) height - padding - radius - HeightToAnchor - anchor_height / 2.0f + ZEROPOINT5); // Point 12 |
1680 | 958 | cairo_line_to(cr, | 1026 | cairo_line_to(cr, |
1681 | 959 | padding + anchor_width + ZEROPOINT5, | 1027 | padding + anchor_width + ZEROPOINT5, |
1682 | 960 | (gdouble) height - padding - radius - HeightToAnchor - anchor_height + ZEROPOINT5); // Point 13 | 1028 | (gdouble) height - padding - radius - HeightToAnchor - anchor_height + ZEROPOINT5); // Point 13 |
1683 | 961 | 1029 | cairo_line_to(cr, padding + anchor_width + ZEROPOINT5, padding + radius + ZEROPOINT5); // Point 14 | |
1684 | 962 | cairo_line_to(cr, padding + anchor_width + ZEROPOINT5, padding + radius + ZEROPOINT5); // Point 14 | 1030 | cairo_arc(cr, |
1685 | 963 | cairo_arc(cr, | 1031 | padding + anchor_width + radius + ZEROPOINT5, |
1686 | 964 | padding + anchor_width + radius + ZEROPOINT5, | 1032 | padding + radius + ZEROPOINT5, |
1687 | 965 | padding + radius + ZEROPOINT5, | 1033 | radius, |
1688 | 966 | radius, | 1034 | 180.0f * G_PI / 180.0f, |
1689 | 967 | 180.0f * G_PI / 180.0f, | 1035 | 270.0f * G_PI / 180.0f); |
1690 | 968 | 270.0f * G_PI / 180.0f); | 1036 | } |
1691 | 969 | 1037 | else | |
1692 | 1038 | { | ||
1693 | 1039 | cairo_move_to(cr, padding + radius + ZEROPOINT5, padding + ZEROPOINT5); // Point 1 | ||
1694 | 1040 | cairo_line_to(cr, width - padding - radius, padding + ZEROPOINT5); // Point 2 | ||
1695 | 1041 | cairo_arc(cr, | ||
1696 | 1042 | width - padding - radius + ZEROPOINT5, | ||
1697 | 1043 | padding + radius + ZEROPOINT5, | ||
1698 | 1044 | radius, | ||
1699 | 1045 | -90.0f * G_PI / 180.0f, | ||
1700 | 1046 | 0.0f * G_PI / 180.0f); // Point 4 | ||
1701 | 1047 | cairo_line_to(cr, | ||
1702 | 1048 | (gdouble) width - padding + ZEROPOINT5, | ||
1703 | 1049 | (gdouble) height - radius - anchor_width - padding + ZEROPOINT5); // Point 5 | ||
1704 | 1050 | cairo_arc(cr, | ||
1705 | 1051 | (gdouble) width - padding - radius + ZEROPOINT5, | ||
1706 | 1052 | (gdouble) height - padding - anchor_width - radius + ZEROPOINT5, | ||
1707 | 1053 | radius, | ||
1708 | 1054 | 0.0f * G_PI / 180.0f, | ||
1709 | 1055 | 90.0f * G_PI / 180.0f); // Point 7 | ||
1710 | 1056 | cairo_line_to(cr, | ||
1711 | 1057 | (gdouble) width - padding - radius - HeightToAnchor + ZEROPOINT5, | ||
1712 | 1058 | height - padding - anchor_width + ZEROPOINT5); // Point 8 | ||
1713 | 1059 | cairo_line_to(cr, | ||
1714 | 1060 | (gdouble) width - padding - radius - HeightToAnchor - anchor_height / 2.0f + ZEROPOINT5, | ||
1715 | 1061 | height - padding + ZEROPOINT5); // Point 9 | ||
1716 | 1062 | cairo_line_to(cr, | ||
1717 | 1063 | (gdouble) width - padding - radius - HeightToAnchor - anchor_height + ZEROPOINT5, | ||
1718 | 1064 | height - padding - anchor_width + ZEROPOINT5); // Point 10 | ||
1719 | 1065 | cairo_arc(cr, | ||
1720 | 1066 | padding + radius + ZEROPOINT5, | ||
1721 | 1067 | (gdouble) height - padding - anchor_width - radius, | ||
1722 | 1068 | radius, | ||
1723 | 1069 | 90.0f * G_PI / 180.0f, | ||
1724 | 1070 | 180.0f * G_PI / 180.0f); // Point 11 | ||
1725 | 1071 | cairo_line_to(cr, | ||
1726 | 1072 | padding + ZEROPOINT5, | ||
1727 | 1073 | (gdouble) height - padding -anchor_width - radius + ZEROPOINT5); // Point 13 | ||
1728 | 1074 | cairo_line_to(cr, padding + ZEROPOINT5, padding + radius + ZEROPOINT5); // Point 14 | ||
1729 | 1075 | cairo_arc(cr, | ||
1730 | 1076 | padding + radius + ZEROPOINT5, | ||
1731 | 1077 | padding + radius + ZEROPOINT5, | ||
1732 | 1078 | radius, | ||
1733 | 1079 | 180.0f * G_PI / 180.0f, | ||
1734 | 1080 | 270.0f * G_PI / 180.0f); | ||
1735 | 1081 | } | ||
1736 | 970 | cairo_close_path(cr); | 1082 | cairo_close_path(cr); |
1737 | 971 | } | 1083 | } |
1738 | 972 | 1084 | ||
1739 | 973 | 1085 | ||
1740 | === modified file 'launcher/SoftwareCenterLauncherIcon.cpp' | |||
1741 | --- launcher/SoftwareCenterLauncherIcon.cpp 2016-02-23 15:39:49 +0000 | |||
1742 | +++ launcher/SoftwareCenterLauncherIcon.cpp 2016-03-18 01:19:20 +0000 | |||
1743 | @@ -31,6 +31,7 @@ | |||
1744 | 31 | #include "LauncherDragWindow.h" | 31 | #include "LauncherDragWindow.h" |
1745 | 32 | #include "LauncherModel.h" | 32 | #include "LauncherModel.h" |
1746 | 33 | #include "DesktopUtilities.h" | 33 | #include "DesktopUtilities.h" |
1747 | 34 | #include "unity-shared/UnitySettings.h" | ||
1748 | 34 | 35 | ||
1749 | 35 | namespace unity | 36 | namespace unity |
1750 | 36 | { | 37 | { |
1751 | 37 | 38 | ||
1752 | === modified file 'launcher/Tooltip.cpp' | |||
1753 | --- launcher/Tooltip.cpp 2014-08-27 20:53:27 +0000 | |||
1754 | +++ launcher/Tooltip.cpp 2016-03-18 01:19:20 +0000 | |||
1755 | @@ -25,6 +25,7 @@ | |||
1756 | 25 | #include <unity-shared/CairoTexture.h> | 25 | #include <unity-shared/CairoTexture.h> |
1757 | 26 | #include <unity-shared/RawPixel.h> | 26 | #include <unity-shared/RawPixel.h> |
1758 | 27 | #include <unity-shared/UnitySettings.h> | 27 | #include <unity-shared/UnitySettings.h> |
1759 | 28 | #include <unity-shared/UScreen.h> | ||
1760 | 28 | #include "unity-shared/DecorationStyle.h" | 29 | #include "unity-shared/DecorationStyle.h" |
1761 | 29 | 30 | ||
1762 | 30 | #include "Tooltip.h" | 31 | #include "Tooltip.h" |
1763 | @@ -33,11 +34,14 @@ | |||
1764 | 33 | { | 34 | { |
1765 | 34 | namespace | 35 | namespace |
1766 | 35 | { | 36 | { |
1772 | 36 | const RawPixel ANCHOR_WIDTH = 14_em; | 37 | const RawPixel ANCHOR_WIDTH = 14_em; |
1773 | 37 | const RawPixel ANCHOR_HEIGHT = 18_em; | 38 | const RawPixel ANCHOR_HEIGHT = 18_em; |
1774 | 38 | const RawPixel CORNER_RADIUS = 4_em; | 39 | const RawPixel ROTATED_ANCHOR_WIDTH = 18_em; |
1775 | 39 | const RawPixel TEXT_PADDING = 8_em; | 40 | const RawPixel ROTATED_ANCHOR_HEIGHT = 10_em; |
1776 | 40 | const RawPixel MINIMUM_TEXT_WIDTH = 100_em; | 41 | const RawPixel CORNER_RADIUS = 4_em; |
1777 | 42 | const RawPixel LEFT_SIZE = 4_em; | ||
1778 | 43 | const RawPixel TEXT_PADDING = 8_em; | ||
1779 | 44 | const RawPixel MINIMUM_TEXT_WIDTH = 100_em; | ||
1780 | 41 | } | 45 | } |
1781 | 42 | 46 | ||
1782 | 43 | NUX_IMPLEMENT_OBJECT_TYPE(Tooltip); | 47 | NUX_IMPLEMENT_OBJECT_TYPE(Tooltip); |
1783 | @@ -45,17 +49,30 @@ | |||
1784 | 45 | CairoBaseWindow(monitor), | 49 | CairoBaseWindow(monitor), |
1785 | 46 | _anchorX(0), | 50 | _anchorX(0), |
1786 | 47 | _anchorY(0), | 51 | _anchorY(0), |
1787 | 52 | _left_size(LEFT_SIZE), | ||
1788 | 48 | _padding(decoration::Style::Get()->ActiveShadowRadius()), | 53 | _padding(decoration::Style::Get()->ActiveShadowRadius()), |
1789 | 49 | _cairo_text_has_changed(true) | 54 | _cairo_text_has_changed(true) |
1790 | 50 | { | 55 | { |
1791 | 51 | _hlayout = new nux::HLayout(TEXT(""), NUX_TRACKER_LOCATION); | 56 | _hlayout = new nux::HLayout(TEXT(""), NUX_TRACKER_LOCATION); |
1792 | 52 | _vlayout = new nux::VLayout(TEXT(""), NUX_TRACKER_LOCATION); | 57 | _vlayout = new nux::VLayout(TEXT(""), NUX_TRACKER_LOCATION); |
1793 | 53 | 58 | ||
1795 | 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; |
1796 | 60 | int bottom_space_height = 0; | ||
1797 | 61 | if (Settings::Instance().launcher_position() == LauncherPosition::LEFT) | ||
1798 | 62 | { | ||
1799 | 63 | left_space_width = _padding.CP(cv_) + ANCHOR_WIDTH.CP(cv_); | ||
1800 | 64 | bottom_space_height = _padding.CP(cv_); | ||
1801 | 65 | } | ||
1802 | 66 | else | ||
1803 | 67 | { | ||
1804 | 68 | left_space_width = _padding.CP(cv_); | ||
1805 | 69 | bottom_space_height = _padding.CP(cv_) + ROTATED_ANCHOR_HEIGHT.CP(cv_); | ||
1806 | 70 | } | ||
1807 | 71 | _left_space = new nux::SpaceLayout(left_space_width, left_space_width, 1, 1000); | ||
1808 | 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); |
1809 | 56 | 73 | ||
1810 | 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_)); |
1812 | 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); |
1813 | 59 | 76 | ||
1814 | 60 | _vlayout->AddLayout(_top_space, 0); | 77 | _vlayout->AddLayout(_top_space, 0); |
1815 | 61 | 78 | ||
1816 | @@ -96,6 +113,44 @@ | |||
1817 | 96 | SetLayout(_hlayout); | 113 | SetLayout(_hlayout); |
1818 | 97 | } | 114 | } |
1819 | 98 | 115 | ||
1820 | 116 | int Tooltip::CalculateX() const | ||
1821 | 117 | { | ||
1822 | 118 | int x = 0; | ||
1823 | 119 | if (Settings::Instance().launcher_position() == LauncherPosition::LEFT) | ||
1824 | 120 | { | ||
1825 | 121 | x = _anchorX - _padding.CP(cv_); | ||
1826 | 122 | } | ||
1827 | 123 | else | ||
1828 | 124 | { | ||
1829 | 125 | int size = 0; | ||
1830 | 126 | int max = GetBaseWidth() - ROTATED_ANCHOR_WIDTH.CP(cv_) - 2 * CORNER_RADIUS.CP(cv_) - 2 * _padding.CP(cv_); | ||
1831 | 127 | if (_left_size.CP(cv_) > max) | ||
1832 | 128 | { | ||
1833 | 129 | size = max; | ||
1834 | 130 | } | ||
1835 | 131 | else if (_left_size.CP(cv_) > 0) | ||
1836 | 132 | { | ||
1837 | 133 | size = _left_size.CP(cv_); | ||
1838 | 134 | } | ||
1839 | 135 | x = _anchorX - (ROTATED_ANCHOR_WIDTH.CP(cv_) / 2) - size - CORNER_RADIUS.CP(cv_) - _padding.CP(cv_); | ||
1840 | 136 | } | ||
1841 | 137 | return x; | ||
1842 | 138 | } | ||
1843 | 139 | |||
1844 | 140 | int Tooltip::CalculateY() const | ||
1845 | 141 | { | ||
1846 | 142 | int y = 0; | ||
1847 | 143 | if (Settings::Instance().launcher_position() == LauncherPosition::LEFT) | ||
1848 | 144 | { | ||
1849 | 145 | y = _anchorY - ANCHOR_HEIGHT.CP(cv_) / 2 - CORNER_RADIUS.CP(cv_) - _padding.CP(cv_); | ||
1850 | 146 | } | ||
1851 | 147 | else | ||
1852 | 148 | { | ||
1853 | 149 | y = _anchorY - GetBaseHeight() + _padding.CP(cv_); | ||
1854 | 150 | } | ||
1855 | 151 | return y; | ||
1856 | 152 | } | ||
1857 | 153 | |||
1858 | 99 | nux::Area* Tooltip::FindAreaUnderMouse(const nux::Point& mouse_position, nux::NuxEventType event_type) | 154 | nux::Area* Tooltip::FindAreaUnderMouse(const nux::Point& mouse_position, nux::NuxEventType event_type) |
1859 | 100 | { | 155 | { |
1860 | 101 | // No area under mouse to allow click through to entities below | 156 | // No area under mouse to allow click through to entities below |
1861 | @@ -107,10 +162,25 @@ | |||
1862 | 107 | _anchorX = tip_x; | 162 | _anchorX = tip_x; |
1863 | 108 | _anchorY = tip_y; | 163 | _anchorY = tip_y; |
1864 | 109 | 164 | ||
1869 | 110 | int x = _anchorX - _padding.CP(cv_); | 165 | if (Settings::Instance().launcher_position() == LauncherPosition::BOTTOM) |
1870 | 111 | int y = _anchorY - ANCHOR_HEIGHT.CP(cv_) / 2 - CORNER_RADIUS.CP(cv_) - _padding.CP(cv_); | 166 | { |
1871 | 112 | 167 | auto* us = UScreen::GetDefault(); | |
1872 | 113 | SetBaseXY(x, y); | 168 | int monitor = us->GetMonitorAtPosition(_anchorX, _anchorY); |
1873 | 169 | auto const& monitor_geo = us->GetMonitorGeometry(monitor); | ||
1874 | 170 | int offscreen_size_right = _anchorX + GetBaseWidth()/2 - (monitor_geo.x + monitor_geo.width); | ||
1875 | 171 | int offscreen_size_left = monitor_geo.x - (_anchorX - GetBaseWidth()/2); | ||
1876 | 172 | int half_size = (GetBaseWidth() / 2) - _padding.CP(cv_) - CORNER_RADIUS.CP(cv_) - (ROTATED_ANCHOR_WIDTH.CP(cv_) / 2); | ||
1877 | 173 | |||
1878 | 174 | if (offscreen_size_left > 0) | ||
1879 | 175 | _left_size = half_size - offscreen_size_left; | ||
1880 | 176 | else if (offscreen_size_right > 0) | ||
1881 | 177 | _left_size = half_size + offscreen_size_right; | ||
1882 | 178 | else | ||
1883 | 179 | _left_size = half_size; | ||
1884 | 180 | _cairo_text_has_changed = true; | ||
1885 | 181 | } | ||
1886 | 182 | |||
1887 | 183 | SetBaseXY(CalculateX(), CalculateY()); | ||
1888 | 114 | } | 184 | } |
1889 | 115 | 185 | ||
1890 | 116 | void Tooltip::ShowTooltipWithTipAt(int x, int y) | 186 | void Tooltip::ShowTooltipWithTipAt(int x, int y) |
1891 | @@ -149,7 +219,10 @@ | |||
1892 | 149 | space_height += (ANCHOR_HEIGHT.CP(cv_) - text_height) / 2; | 219 | space_height += (ANCHOR_HEIGHT.CP(cv_) - text_height) / 2; |
1893 | 150 | 220 | ||
1894 | 151 | _top_space->SetMinMaxSize(1, space_height); | 221 | _top_space->SetMinMaxSize(1, space_height); |
1896 | 152 | _bottom_space->SetMinMaxSize(1, space_height + 1); | 222 | if (Settings::Instance().launcher_position() == LauncherPosition::LEFT) |
1897 | 223 | _bottom_space->SetMinMaxSize(1, space_height + 1); | ||
1898 | 224 | else | ||
1899 | 225 | _bottom_space->SetMinMaxSize(1, space_height + ROTATED_ANCHOR_HEIGHT + 1); | ||
1900 | 153 | 226 | ||
1901 | 154 | CairoBaseWindow::PreLayoutManagement(); | 227 | CairoBaseWindow::PreLayoutManagement(); |
1902 | 155 | } | 228 | } |
1903 | @@ -250,51 +323,120 @@ | |||
1904 | 250 | gfloat anchor_height, | 323 | gfloat anchor_height, |
1905 | 251 | gfloat width, | 324 | gfloat width, |
1906 | 252 | gfloat height, | 325 | gfloat height, |
1908 | 253 | gint upper_size, | 326 | gint left_size, |
1909 | 254 | gfloat radius, | 327 | gfloat radius, |
1910 | 255 | guint pad) | 328 | guint pad) |
1911 | 256 | { | 329 | { |
1912 | 257 | 330 | ||
1922 | 258 | // 0 1 2 | 331 | // On the right of the icon: On the top of the icon: |
1923 | 259 | // +------------+-+ | 332 | // 0 1 2 0 1 2 3 |
1924 | 260 | // / + 3 | 333 | // +------------------+-+ +-+----------------+-+ |
1925 | 261 | // / | | 334 | // / + 3 14 + + 4 |
1926 | 262 | // + 8 | | 335 | // / | | | |
1927 | 263 | // \ | | 336 | // + 8 | | | |
1928 | 264 | // \ + 4 | 337 | // \ | | | |
1929 | 265 | // +------------+-+ | 338 | // \ + 4 13 + 10 8 + 5 |
1930 | 266 | // 7 6 5 | 339 | // +------------------+-+ +-+---+ +--------+-+ |
1931 | 340 | // 7 6 5 12 11 \ / 7 6 | ||
1932 | 341 | // + 9 | ||
1933 | 267 | 342 | ||
1934 | 268 | gfloat padding = pad; | 343 | gfloat padding = pad; |
1935 | 269 | 344 | ||
1936 | 270 | cairo_translate(cr, -0.5f, -0.5f); | 345 | cairo_translate(cr, -0.5f, -0.5f); |
1937 | 271 | 346 | ||
1938 | 272 | // create path | 347 | // create path |
1964 | 273 | cairo_move_to(cr, padding + anchor_width, padding); // Point 0 | 348 | if (Settings::Instance().launcher_position() == LauncherPosition::LEFT) |
1965 | 274 | cairo_line_to(cr, width - padding - radius, padding); // Point 1 | 349 | { |
1966 | 275 | cairo_arc(cr, | 350 | cairo_move_to(cr, padding + anchor_width, padding); // Point 0 |
1967 | 276 | width - padding - radius, | 351 | cairo_line_to(cr, width - padding - radius, padding); // Point 1 |
1968 | 277 | padding + radius, | 352 | cairo_arc(cr, |
1969 | 278 | radius, | 353 | width - padding - radius, |
1970 | 279 | -90.0f * G_PI / 180.0f, | 354 | padding + radius, |
1971 | 280 | 0.0f * G_PI / 180.0f); // Point 3 | 355 | radius, |
1972 | 281 | cairo_line_to(cr, | 356 | -90.0f * G_PI / 180.0f, |
1973 | 282 | (gdouble) width - padding, | 357 | 0.0f * G_PI / 180.0f); // Point 3 |
1974 | 283 | (gdouble) height - radius - padding); // Point 4 | 358 | cairo_line_to(cr, |
1975 | 284 | cairo_arc(cr, | 359 | (gdouble) width - padding, |
1976 | 285 | (gdouble) width - padding - radius, | 360 | (gdouble) height - radius - padding); // Point 4 |
1977 | 286 | (gdouble) height - padding - radius, | 361 | cairo_arc(cr, |
1978 | 287 | radius, | 362 | (gdouble) width - padding - radius, |
1979 | 288 | 0.0f * G_PI / 180.0f, | 363 | (gdouble) height - padding - radius, |
1980 | 289 | 90.0f * G_PI / 180.0f); // Point 6 | 364 | radius, |
1981 | 290 | cairo_line_to(cr, | 365 | 0.0f * G_PI / 180.0f, |
1982 | 291 | anchor_width + padding, | 366 | 90.0f * G_PI / 180.0f); // Point 6 |
1983 | 292 | (gdouble) height - padding); // Point 7 | 367 | cairo_line_to(cr, |
1984 | 293 | 368 | anchor_width + padding, | |
1985 | 294 | cairo_line_to(cr, | 369 | (gdouble) height - padding); // Point 7 |
1986 | 295 | padding, | 370 | |
1987 | 296 | (gdouble) height / 2.0f); // Point 8 | 371 | cairo_line_to(cr, |
1988 | 297 | 372 | padding, | |
1989 | 373 | (gdouble) height / 2.0f); // Point 8 | ||
1990 | 374 | } | ||
1991 | 375 | else | ||
1992 | 376 | { | ||
1993 | 377 | gfloat WidthToAnchor = ((gfloat) width - 2.0f * radius - anchor_width - 2 * padding) / 2.0f; | ||
1994 | 378 | if (WidthToAnchor < 0.0f) | ||
1995 | 379 | { | ||
1996 | 380 | g_warning("Anchor-width and corner-radius a wider than whole texture!"); | ||
1997 | 381 | return; | ||
1998 | 382 | } | ||
1999 | 383 | |||
2000 | 384 | if (left_size > width - 2.0f * radius - anchor_width - 2 * padding) | ||
2001 | 385 | { | ||
2002 | 386 | WidthToAnchor = 0; | ||
2003 | 387 | } | ||
2004 | 388 | else if (left_size < 0) | ||
2005 | 389 | { | ||
2006 | 390 | WidthToAnchor = width - 2.0f * radius - anchor_width - 2 * padding; | ||
2007 | 391 | } | ||
2008 | 392 | else | ||
2009 | 393 | { | ||
2010 | 394 | WidthToAnchor = width - 2.0f * radius - anchor_width - 2 * padding - left_size; | ||
2011 | 395 | } | ||
2012 | 396 | |||
2013 | 397 | cairo_move_to(cr, padding + radius, padding); // Point 1 | ||
2014 | 398 | cairo_line_to(cr, width - padding - radius, padding); // Point 2 | ||
2015 | 399 | cairo_arc(cr, | ||
2016 | 400 | width - padding - radius, | ||
2017 | 401 | padding + radius, | ||
2018 | 402 | radius, | ||
2019 | 403 | -90.0f * G_PI / 180.0f, | ||
2020 | 404 | 0.0f * G_PI / 180.0f); // Point 4 | ||
2021 | 405 | cairo_line_to(cr, | ||
2022 | 406 | (gdouble) width - padding, | ||
2023 | 407 | (gdouble) height - radius - anchor_height - padding); // Point 5 | ||
2024 | 408 | cairo_arc(cr, | ||
2025 | 409 | (gdouble) width - padding - radius, | ||
2026 | 410 | (gdouble) height - padding - anchor_height - radius, | ||
2027 | 411 | radius, | ||
2028 | 412 | 0.0f * G_PI / 180.0f, | ||
2029 | 413 | 90.0f * G_PI / 180.0f); // Point 7 | ||
2030 | 414 | cairo_line_to(cr, | ||
2031 | 415 | (gdouble) width - padding - radius - WidthToAnchor, | ||
2032 | 416 | height - padding - anchor_height); // Point 8 | ||
2033 | 417 | cairo_line_to(cr, | ||
2034 | 418 | (gdouble) width - padding - radius - WidthToAnchor - anchor_width / 2.0f, | ||
2035 | 419 | height - padding); // Point 9 | ||
2036 | 420 | cairo_line_to(cr, | ||
2037 | 421 | (gdouble) width - padding - radius - WidthToAnchor - anchor_width, | ||
2038 | 422 | height - padding - anchor_height); // Point 10 | ||
2039 | 423 | cairo_arc(cr, | ||
2040 | 424 | padding + radius, | ||
2041 | 425 | (gdouble) height - padding - anchor_height - radius, | ||
2042 | 426 | radius, | ||
2043 | 427 | 90.0f * G_PI / 180.0f, | ||
2044 | 428 | 180.0f * G_PI / 180.0f); // Point 11 | ||
2045 | 429 | cairo_line_to(cr, | ||
2046 | 430 | padding, | ||
2047 | 431 | (gdouble) height - padding -anchor_height - radius); // Point 13 | ||
2048 | 432 | cairo_line_to(cr, padding, padding + radius); // Point 14 | ||
2049 | 433 | cairo_arc(cr, | ||
2050 | 434 | padding + radius, | ||
2051 | 435 | padding + radius, | ||
2052 | 436 | radius, | ||
2053 | 437 | 180.0f * G_PI / 180.0f, | ||
2054 | 438 | 270.0f * G_PI / 180.0f); | ||
2055 | 439 | } | ||
2056 | 298 | cairo_close_path(cr); | 440 | cairo_close_path(cr); |
2057 | 299 | } | 441 | } |
2058 | 300 | 442 | ||
2059 | @@ -388,7 +530,7 @@ | |||
2060 | 388 | gfloat height, | 530 | gfloat height, |
2061 | 389 | gfloat anchor_width, | 531 | gfloat anchor_width, |
2062 | 390 | gfloat anchor_height, | 532 | gfloat anchor_height, |
2064 | 391 | gint upper_size, | 533 | gint left_size, |
2065 | 392 | gfloat corner_radius, | 534 | gfloat corner_radius, |
2066 | 393 | guint blur_coeff, | 535 | guint blur_coeff, |
2067 | 394 | nux::Color const& shadow_color, | 536 | nux::Color const& shadow_color, |
2068 | @@ -402,7 +544,7 @@ | |||
2069 | 402 | anchor_height, | 544 | anchor_height, |
2070 | 403 | width, | 545 | width, |
2071 | 404 | height, | 546 | height, |
2073 | 405 | upper_size, | 547 | left_size, |
2074 | 406 | corner_radius, | 548 | corner_radius, |
2075 | 407 | padding_size); | 549 | padding_size); |
2076 | 408 | 550 | ||
2077 | @@ -421,7 +563,7 @@ | |||
2078 | 421 | gfloat radius, | 563 | gfloat radius, |
2079 | 422 | gfloat anchor_width, | 564 | gfloat anchor_width, |
2080 | 423 | gfloat anchor_height, | 565 | gfloat anchor_height, |
2082 | 424 | gint upper_size, | 566 | gint left_size, |
2083 | 425 | gboolean negative, | 567 | gboolean negative, |
2084 | 426 | gboolean outline, | 568 | gboolean outline, |
2085 | 427 | gfloat line_width, | 569 | gfloat line_width, |
2086 | @@ -434,7 +576,7 @@ | |||
2087 | 434 | anchor_height, | 576 | anchor_height, |
2088 | 435 | width, | 577 | width, |
2089 | 436 | height, | 578 | height, |
2091 | 437 | upper_size, | 579 | left_size, |
2092 | 438 | radius, | 580 | radius, |
2093 | 439 | padding_size); | 581 | padding_size); |
2094 | 440 | _finalize(&cr, outline, line_width, color, negative, outline); | 582 | _finalize(&cr, outline, line_width, color, negative, outline); |
2095 | @@ -445,12 +587,22 @@ | |||
2096 | 445 | if (_cairo_text_has_changed == false) | 587 | if (_cairo_text_has_changed == false) |
2097 | 446 | return; | 588 | return; |
2098 | 447 | 589 | ||
2099 | 590 | SetTooltipPosition(_anchorX, _anchorY); | ||
2100 | 591 | |||
2101 | 448 | int width = GetBaseWidth(); | 592 | int width = GetBaseWidth(); |
2102 | 449 | int height = GetBaseHeight(); | 593 | int height = GetBaseHeight(); |
2107 | 450 | 594 | int anchor_width = 0; | |
2108 | 451 | int x = _anchorX - _padding.CP(cv_); | 595 | int anchor_height = 0; |
2109 | 452 | int y = _anchorY - height / 2; | 596 | if (Settings::Instance().launcher_position == LauncherPosition::LEFT) |
2110 | 453 | SetXY(x, y); | 597 | { |
2111 | 598 | anchor_width = ANCHOR_WIDTH; | ||
2112 | 599 | anchor_height = ANCHOR_HEIGHT; | ||
2113 | 600 | } | ||
2114 | 601 | else | ||
2115 | 602 | { | ||
2116 | 603 | anchor_width = ROTATED_ANCHOR_WIDTH; | ||
2117 | 604 | anchor_height = ROTATED_ANCHOR_HEIGHT; | ||
2118 | 605 | } | ||
2119 | 454 | 606 | ||
2120 | 455 | auto const& deco_style = decoration::Style::Get(); | 607 | auto const& deco_style = decoration::Style::Get(); |
2121 | 456 | float dpi_scale = cv_->DPIScale(); | 608 | float dpi_scale = cv_->DPIScale(); |
2122 | @@ -499,9 +651,9 @@ | |||
2123 | 499 | cairo_outline.GetSurface(), | 651 | cairo_outline.GetSurface(), |
2124 | 500 | width / dpi_scale, | 652 | width / dpi_scale, |
2125 | 501 | height / dpi_scale, | 653 | height / dpi_scale, |
2129 | 502 | ANCHOR_WIDTH, | 654 | anchor_width, |
2130 | 503 | ANCHOR_HEIGHT, | 655 | anchor_height, |
2131 | 504 | -1, | 656 | _left_size, |
2132 | 505 | CORNER_RADIUS, | 657 | CORNER_RADIUS, |
2133 | 506 | blur_coef, | 658 | blur_coef, |
2134 | 507 | shadow_color, | 659 | shadow_color, |
2135 | @@ -515,9 +667,9 @@ | |||
2136 | 515 | width / dpi_scale, | 667 | width / dpi_scale, |
2137 | 516 | height / dpi_scale, | 668 | height / dpi_scale, |
2138 | 517 | CORNER_RADIUS, // radius, | 669 | CORNER_RADIUS, // radius, |
2142 | 518 | ANCHOR_WIDTH, // anchor_width, | 670 | anchor_width, // anchor_width, |
2143 | 519 | ANCHOR_HEIGHT, // anchor_height, | 671 | anchor_height, // anchor_height, |
2144 | 520 | -1, // upper_size, | 672 | _left_size, // left_size, |
2145 | 521 | true, // negative, | 673 | true, // negative, |
2146 | 522 | false, // outline, | 674 | false, // outline, |
2147 | 523 | 1.0, // line_width, | 675 | 1.0, // line_width, |
2148 | 524 | 676 | ||
2149 | === modified file 'launcher/Tooltip.h' | |||
2150 | --- launcher/Tooltip.h 2014-03-24 23:44:58 +0000 | |||
2151 | +++ launcher/Tooltip.h 2016-03-18 01:19:20 +0000 | |||
2152 | @@ -73,8 +73,12 @@ | |||
2153 | 73 | void NotifyConfigurationChange(int width, | 73 | void NotifyConfigurationChange(int width, |
2154 | 74 | int height); | 74 | int height); |
2155 | 75 | 75 | ||
2156 | 76 | int CalculateX() const; | ||
2157 | 77 | int CalculateY() const; | ||
2158 | 78 | |||
2159 | 76 | int _anchorX; | 79 | int _anchorX; |
2160 | 77 | int _anchorY; | 80 | int _anchorY; |
2161 | 81 | RawPixel _left_size; // size of the segment from point 10 to 11, used when launcher at bottom. | ||
2162 | 78 | RawPixel _padding; | 82 | RawPixel _padding; |
2163 | 79 | 83 | ||
2164 | 80 | nux::HLayout* _hlayout; | 84 | nux::HLayout* _hlayout; |
2165 | 81 | 85 | ||
2166 | === modified file 'panel/PanelView.cpp' | |||
2167 | --- panel/PanelView.cpp 2016-03-07 18:37:24 +0000 | |||
2168 | +++ panel/PanelView.cpp 2016-03-18 01:19:20 +0000 | |||
2169 | @@ -368,7 +368,8 @@ | |||
2170 | 368 | 368 | ||
2171 | 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); |
2172 | 370 | 370 | ||
2174 | 371 | refine_x_pos += unity::Settings::Instance().LauncherWidth(monitor_); | 371 | if (Settings::Instance().launcher_position() == LauncherPosition::LEFT) |
2175 | 372 | refine_x_pos += unity::Settings::Instance().LauncherSize(monitor_); | ||
2176 | 372 | GfxContext.QRP_1Tex(refine_x_pos, geo.y, | 373 | GfxContext.QRP_1Tex(refine_x_pos, geo.y, |
2177 | 373 | bg_refine_tex_->GetWidth(), | 374 | bg_refine_tex_->GetWidth(), |
2178 | 374 | bg_refine_tex_->GetHeight(), | 375 | bg_refine_tex_->GetHeight(), |
2179 | @@ -465,7 +466,8 @@ | |||
2180 | 465 | nux::Geometry refine_geo = geo; | 466 | nux::Geometry refine_geo = geo; |
2181 | 466 | 467 | ||
2182 | 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); |
2184 | 468 | refine_x_pos += unity::Settings::Instance().LauncherWidth(monitor_); | 469 | if (Settings::Instance().launcher_position() == LauncherPosition::LEFT) |
2185 | 470 | refine_x_pos += unity::Settings::Instance().LauncherSize(monitor_); | ||
2186 | 469 | 471 | ||
2187 | 470 | refine_geo.x = refine_x_pos; | 472 | refine_geo.x = refine_x_pos; |
2188 | 471 | refine_geo.width = bg_refine_tex_->GetWidth(); | 473 | refine_geo.width = bg_refine_tex_->GetWidth(); |
2189 | 472 | 474 | ||
2190 | === modified file 'plugins/unityshell/src/unityshell.cpp' | |||
2191 | --- plugins/unityshell/src/unityshell.cpp 2016-03-09 17:30:50 +0000 | |||
2192 | +++ plugins/unityshell/src/unityshell.cpp 2016-03-18 01:19:20 +0000 | |||
2193 | @@ -77,6 +77,7 @@ | |||
2194 | 77 | #include "UScreen.h" | 77 | #include "UScreen.h" |
2195 | 78 | 78 | ||
2196 | 79 | #include "config.h" | 79 | #include "config.h" |
2197 | 80 | #include "unity-shared/UnitySettings.h" | ||
2198 | 80 | 81 | ||
2199 | 81 | /* FIXME: once we get a better method to add the toplevel windows to | 82 | /* FIXME: once we get a better method to add the toplevel windows to |
2200 | 82 | the accessible root object, this include would not be required */ | 83 | the accessible root object, this include would not be required */ |
2201 | @@ -3826,9 +3827,9 @@ | |||
2202 | 3826 | } | 3827 | } |
2203 | 3827 | 3828 | ||
2204 | 3828 | auto max_bounds = NuxGeometryFromCompRect(output.workArea()); | 3829 | auto max_bounds = NuxGeometryFromCompRect(output.workArea()); |
2206 | 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) |
2207 | 3830 | { | 3831 | { |
2209 | 3831 | int monitor_width = unity_settings_.LauncherWidth(monitor); | 3832 | int monitor_width = unity_settings_.LauncherSize(monitor); |
2210 | 3832 | max_bounds.x += monitor_width; | 3833 | max_bounds.x += monitor_width; |
2211 | 3833 | max_bounds.width -= monitor_width; | 3834 | max_bounds.width -= monitor_width; |
2212 | 3834 | } | 3835 | } |
2213 | @@ -4071,22 +4072,35 @@ | |||
2214 | 4071 | manager->PromptLockScreen(); | 4072 | manager->PromptLockScreen(); |
2215 | 4072 | 4073 | ||
2216 | 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) { |
2218 | 4074 | /* The launcher geometry includes 1px used to draw the right margin | 4075 | /* The launcher geometry includes 1px used to draw the right/top margin |
2219 | 4075 | * that must not be considered when drawing an overlay */ | 4076 | * that must not be considered when drawing an overlay */ |
2220 | 4076 | 4077 | ||
2221 | 4077 | auto* launcher = static_cast<Launcher*>(area); | 4078 | auto* launcher = static_cast<Launcher*>(area); |
2234 | 4078 | int launcher_width = w - (1_em).CP(unity_settings_.em(launcher->monitor)->DPIScale()); | 4079 | auto launcher_position = Settings::Instance().launcher_position(); |
2235 | 4079 | 4080 | ||
2236 | 4080 | unity::Settings::Instance().SetLauncherWidth(launcher_width, launcher->monitor); | 4081 | int size = 0; |
2237 | 4081 | shortcut_controller_->SetAdjustment(launcher_width, panel_style_.PanelHeight(launcher->monitor)); | 4082 | if (launcher_position == LauncherPosition::LEFT) |
2238 | 4082 | 4083 | size = w; | |
2239 | 4083 | CompOption::Value v(launcher_width); | 4084 | else |
2240 | 4084 | screen->setOptionForPlugin("expo", "x_offset", v); | 4085 | size = h; |
2241 | 4085 | 4086 | int launcher_size = size - (1_em).CP(unity_settings_.em(launcher->monitor)->DPIScale()); | |
2242 | 4086 | if (launcher_controller_->options()->hide_mode == LAUNCHER_HIDE_NEVER) | 4087 | |
2243 | 4087 | v.set(0); | 4088 | unity::Settings::Instance().SetLauncherSize(launcher_size, launcher->monitor); |
2244 | 4088 | 4089 | int adjustment_x = 0; | |
2245 | 4089 | screen->setOptionForPlugin("scale", "x_offset", v); | 4090 | if (launcher_position == LauncherPosition::LEFT) |
2246 | 4091 | adjustment_x = launcher_size; | ||
2247 | 4092 | shortcut_controller_->SetAdjustment(adjustment_x, panel_style_.PanelHeight(launcher->monitor)); | ||
2248 | 4093 | |||
2249 | 4094 | if (launcher_position == LauncherPosition::LEFT) | ||
2250 | 4095 | { | ||
2251 | 4096 | CompOption::Value v(launcher_size); | ||
2252 | 4097 | screen->setOptionForPlugin("expo", "x_offset", v); | ||
2253 | 4098 | |||
2254 | 4099 | if (launcher_controller_->options()->hide_mode == LAUNCHER_HIDE_NEVER) | ||
2255 | 4100 | v.set(0); | ||
2256 | 4101 | |||
2257 | 4102 | screen->setOptionForPlugin("scale", "x_offset", v); | ||
2258 | 4103 | } | ||
2259 | 4090 | }; | 4104 | }; |
2260 | 4091 | 4105 | ||
2261 | 4092 | auto check_launchers_size = [this, on_launcher_size_changed] { | 4106 | auto check_launchers_size = [this, on_launcher_size_changed] { |
2262 | 4093 | 4107 | ||
2263 | === added file 'resources/launcher_arrow_btt_19.svg' | |||
2264 | --- resources/launcher_arrow_btt_19.svg 1970-01-01 00:00:00 +0000 | |||
2265 | +++ resources/launcher_arrow_btt_19.svg 2016-03-18 01:19:20 +0000 | |||
2266 | @@ -0,0 +1,18 @@ | |||
2267 | 1 | <?xml version="1.0" encoding="utf-8"?> | ||
2268 | 2 | <!-- Generator: Adobe Illustrator 15.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) --> | ||
2269 | 3 | <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"> | ||
2270 | 4 | <svg version="1.1" | ||
2271 | 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" | ||
2272 | 6 | xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" width="18.992px" | ||
2273 | 7 | height="10.006px" viewBox="0 0 18.992 10.006" enable-background="new 0 0 18.992 10.006" xml:space="preserve"> | ||
2274 | 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"> | ||
2275 | 9 | <inkscape:grid type="xygrid" enabled="true" visible="true" id="grid4740" snapvisiblegridlinesonly="true" empspacing="8"> | ||
2276 | 10 | </inkscape:grid> | ||
2277 | 11 | </sodipodi:namedview> | ||
2278 | 12 | <g id="layer1" transform="translate(0,-1033.3622)" inkscape:label="Layer 1" inkscape:groupmode="layer"> | ||
2279 | 13 | <path id="path5726" inkscape:connector-curvature="0" sodipodi:nodetypes="cccc" opacity="0.14" enable-background="new " d=" | ||
2280 | 14 | M4.696,1043.368l4.8-6.316l4.8,6.316H4.696z"/> | ||
2281 | 15 | <path id="path4097" inkscape:connector-curvature="0" sodipodi:nodetypes="cccc" fill="#FFFFFF" d="M5.696,1043.368l3.8-5.001 | ||
2282 | 16 | l3.802,5.001H5.696z"/> | ||
2283 | 17 | </g> | ||
2284 | 18 | </svg> | ||
2285 | 0 | 19 | ||
2286 | === added file 'resources/launcher_arrow_btt_37.svg' | |||
2287 | --- resources/launcher_arrow_btt_37.svg 1970-01-01 00:00:00 +0000 | |||
2288 | +++ resources/launcher_arrow_btt_37.svg 2016-03-18 01:19:20 +0000 | |||
2289 | @@ -0,0 +1,21 @@ | |||
2290 | 1 | <?xml version="1.0" encoding="utf-8"?> | ||
2291 | 2 | <!-- Generator: Adobe Illustrator 15.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) --> | ||
2292 | 3 | <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"> | ||
2293 | 4 | <svg version="1.1" | ||
2294 | 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" | ||
2295 | 6 | xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" width="36.992px" | ||
2296 | 7 | height="20.012px" viewBox="0 0 36.992 20.012" enable-background="new 0 0 36.992 20.012" xml:space="preserve"> | ||
2297 | 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"> | ||
2298 | 9 | <inkscape:grid type="xygrid" enabled="true" visible="true" id="grid4740" snapvisiblegridlinesonly="true" empspacing="8"> | ||
2299 | 10 | </inkscape:grid> | ||
2300 | 11 | <sodipodi:guide id="guide3004" position="8,19" orientation="0,1"></sodipodi:guide> | ||
2301 | 12 | </sodipodi:namedview> | ||
2302 | 13 | <g id="layer1" transform="translate(0,-1015.3622)" inkscape:label="Layer 1" inkscape:groupmode="layer"> | ||
2303 | 14 | |||
2304 | 15 | <path id="path5730" inkscape:connector-curvature="0" inkscape:transform-center-x="16.337474" sodipodi:nodetypes="cccc" opacity="0.14" enable-background="new " d=" | ||
2305 | 16 | M8.014,1035.374l9.944-12.785l9.945,12.785H8.014z"/> | ||
2306 | 17 | |||
2307 | 18 | <path id="path4079" inkscape:connector-curvature="0" inkscape:transform-center-x="14.694444" sodipodi:nodetypes="cccc" fill="#FFFFFF" d=" | ||
2308 | 19 | M9.014,1035.374l8.944-11.5l8.944,11.5H9.014z"/> | ||
2309 | 20 | </g> | ||
2310 | 21 | </svg> | ||
2311 | 0 | 22 | ||
2312 | === added file 'resources/launcher_arrow_outline_btt_19.svg' | |||
2313 | --- resources/launcher_arrow_outline_btt_19.svg 1970-01-01 00:00:00 +0000 | |||
2314 | +++ resources/launcher_arrow_outline_btt_19.svg 2016-03-18 01:19:20 +0000 | |||
2315 | @@ -0,0 +1,15 @@ | |||
2316 | 1 | <?xml version="1.0" encoding="utf-8"?> | ||
2317 | 2 | <!-- Generator: Adobe Illustrator 15.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) --> | ||
2318 | 3 | <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"> | ||
2319 | 4 | <svg version="1.1" | ||
2320 | 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" | ||
2321 | 6 | xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" width="18.992px" | ||
2322 | 7 | height="10.006px" viewBox="0 0 18.992 10.006" enable-background="new 0 0 18.992 10.006" xml:space="preserve"> | ||
2323 | 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"> | ||
2324 | 9 | <inkscape:grid type="xygrid" enabled="true" visible="true" id="grid4740" snapvisiblegridlinesonly="true" empspacing="8"> | ||
2325 | 10 | </inkscape:grid> | ||
2326 | 11 | </sodipodi:namedview> | ||
2327 | 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 | ||
2328 | 13 | L5.008,10.006z"/> | ||
2329 | 14 | <path id="path4097" fill="#FFFFFF" d="M6.008,10.006h1.52l2.281-3l2.281,3h1.52l-3.801-5L6.008,10.006z"/> | ||
2330 | 15 | </svg> | ||
2331 | 0 | 16 | ||
2332 | === added file 'resources/launcher_arrow_outline_btt_37.svg' | |||
2333 | --- resources/launcher_arrow_outline_btt_37.svg 1970-01-01 00:00:00 +0000 | |||
2334 | +++ resources/launcher_arrow_outline_btt_37.svg 2016-03-18 01:19:20 +0000 | |||
2335 | @@ -0,0 +1,19 @@ | |||
2336 | 1 | <?xml version="1.0" encoding="utf-8"?> | ||
2337 | 2 | <!-- Generator: Adobe Illustrator 15.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) --> | ||
2338 | 3 | <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"> | ||
2339 | 4 | <svg version="1.1" | ||
2340 | 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" | ||
2341 | 6 | xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" width="36.992px" | ||
2342 | 7 | height="20.012px" viewBox="0 0 36.992 20.012" enable-background="new 0 0 36.992 20.012" xml:space="preserve"> | ||
2343 | 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"> | ||
2344 | 9 | <inkscape:grid type="xygrid" enabled="true" visible="true" id="grid4740" snapvisiblegridlinesonly="true" empspacing="8"> | ||
2345 | 10 | </inkscape:grid> | ||
2346 | 11 | <sodipodi:guide id="guide3004" position="8,19" orientation="0,1"></sodipodi:guide> | ||
2347 | 12 | </sodipodi:namedview> | ||
2348 | 13 | <g id="layer1" transform="translate(0,-1015.3622)" inkscape:label="Layer 1" inkscape:groupmode="layer"> | ||
2349 | 14 | <path id="path5730" inkscape:connector-curvature="0" opacity="0.14" enable-background="new " d="M8.551,1035.374l9.945-12.785 | ||
2350 | 15 | l9.946,12.785h-4.899l-5.045-6.486l-5.045,6.486H8.551z"/> | ||
2351 | 16 | <path id="path4079" inkscape:connector-curvature="0" fill="#FFFFFF" d="M9.551,1035.374h2.957l5.988-7.699l5.989,7.699h2.957 | ||
2352 | 17 | l-8.946-11.5L9.551,1035.374z"/> | ||
2353 | 18 | </g> | ||
2354 | 19 | </svg> | ||
2355 | 0 | 20 | ||
2356 | === added file 'resources/launcher_arrow_ttb_19.svg' | |||
2357 | --- resources/launcher_arrow_ttb_19.svg 1970-01-01 00:00:00 +0000 | |||
2358 | +++ resources/launcher_arrow_ttb_19.svg 2016-03-18 01:19:20 +0000 | |||
2359 | @@ -0,0 +1,16 @@ | |||
2360 | 1 | <?xml version="1.0" encoding="utf-8"?> | ||
2361 | 2 | <!-- Generator: Adobe Illustrator 15.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) --> | ||
2362 | 3 | <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"> | ||
2363 | 4 | <svg version="1.1" | ||
2364 | 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" | ||
2365 | 6 | xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" width="18.992px" | ||
2366 | 7 | height="10.006px" viewBox="0 0 18.992 10.006" enable-background="new 0 0 18.992 10.006" xml:space="preserve"> | ||
2367 | 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"> | ||
2368 | 9 | <inkscape:grid type="xygrid" visible="true" enabled="true" id="grid4740" snapvisiblegridlinesonly="true" empspacing="8"> | ||
2369 | 10 | </inkscape:grid> | ||
2370 | 11 | </sodipodi:namedview> | ||
2371 | 12 | <path id="path5726" inkscape:connector-curvature="0" sodipodi:nodetypes="cccc" opacity="0.14" enable-background="new " d=" | ||
2372 | 13 | M14.296,0l-4.8,6.316L4.696,0H14.296z"/> | ||
2373 | 14 | <path id="path4097" inkscape:connector-curvature="0" sodipodi:nodetypes="cccc" fill="#FFFFFF" d="M13.296,0l-3.8,5L5.695,0H13.296 | ||
2374 | 15 | z"/> | ||
2375 | 16 | </svg> | ||
2376 | 0 | 17 | ||
2377 | === added file 'resources/launcher_arrow_ttb_37.svg' | |||
2378 | --- resources/launcher_arrow_ttb_37.svg 1970-01-01 00:00:00 +0000 | |||
2379 | +++ resources/launcher_arrow_ttb_37.svg 2016-03-18 01:19:20 +0000 | |||
2380 | @@ -0,0 +1,21 @@ | |||
2381 | 1 | <?xml version="1.0" encoding="utf-8"?> | ||
2382 | 2 | <!-- Generator: Adobe Illustrator 15.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) --> | ||
2383 | 3 | <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"> | ||
2384 | 4 | <svg version="1.1" | ||
2385 | 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" | ||
2386 | 6 | xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" width="36.992px" | ||
2387 | 7 | height="20.012px" viewBox="0 0 36.992 20.012" enable-background="new 0 0 36.992 20.012" xml:space="preserve"> | ||
2388 | 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"> | ||
2389 | 9 | <inkscape:grid type="xygrid" visible="true" enabled="true" id="grid4740" snapvisiblegridlinesonly="true" empspacing="8"> | ||
2390 | 10 | </inkscape:grid> | ||
2391 | 11 | <sodipodi:guide id="guide3004" orientation="0,1" position="8,19"></sodipodi:guide> | ||
2392 | 12 | </sodipodi:namedview> | ||
2393 | 13 | <g id="layer1" transform="translate(0,-1015.3622)" inkscape:label="Layer 1" inkscape:groupmode="layer"> | ||
2394 | 14 | |||
2395 | 15 | <path id="path5730" inkscape:connector-curvature="0" sodipodi:nodetypes="cccc" inkscape:transform-center-x="16.337474" opacity="0.14" enable-background="new " d=" | ||
2396 | 16 | M28.646,1015.362l-9.943,12.785l-9.945-12.785H28.646z"/> | ||
2397 | 17 | |||
2398 | 18 | <path id="path4079" inkscape:connector-curvature="0" sodipodi:nodetypes="cccc" inkscape:transform-center-x="14.694444" fill="#FFFFFF" d=" | ||
2399 | 19 | M27.647,1015.362l-8.944,11.5l-8.945-11.5H27.647z"/> | ||
2400 | 20 | </g> | ||
2401 | 21 | </svg> | ||
2402 | 0 | 22 | ||
2403 | === added file 'resources/launcher_pip_btt_19.svg' | |||
2404 | --- resources/launcher_pip_btt_19.svg 1970-01-01 00:00:00 +0000 | |||
2405 | +++ resources/launcher_pip_btt_19.svg 2016-03-18 01:19:20 +0000 | |||
2406 | @@ -0,0 +1,18 @@ | |||
2407 | 1 | <?xml version="1.0" encoding="utf-8"?> | ||
2408 | 2 | <!-- Generator: Adobe Illustrator 15.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) --> | ||
2409 | 3 | <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"> | ||
2410 | 4 | <svg version="1.1" | ||
2411 | 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" | ||
2412 | 6 | xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" width="18.992px" | ||
2413 | 7 | height="10.006px" viewBox="0 0 18.992 10.006" enable-background="new 0 0 18.992 10.006" xml:space="preserve"> | ||
2414 | 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"> | ||
2415 | 9 | <inkscape:grid type="xygrid" enabled="true" visible="true" id="grid4740" snapvisiblegridlinesonly="true" empspacing="8"> | ||
2416 | 10 | </inkscape:grid> | ||
2417 | 11 | </sodipodi:namedview> | ||
2418 | 12 | <g id="layer1" transform="translate(0,-1033.3622)" inkscape:label="Layer 1" inkscape:groupmode="layer"> | ||
2419 | 13 | <path id="path5728" inkscape:connector-curvature="0" sodipodi:nodetypes="cccccc" opacity="0.14" enable-background="new " d=" | ||
2420 | 14 | M6.996,1043.368v-3.5l2.5-3l2.5,3v3.5H6.996z"/> | ||
2421 | 15 | <path id="path4742" inkscape:connector-curvature="0" sodipodi:nodetypes="cccccc" fill="#FFFFFF" d="M7.996,1043.368v-3l1.5-2 | ||
2422 | 16 | l1.5,2v3H7.996z"/> | ||
2423 | 17 | </g> | ||
2424 | 18 | </svg> | ||
2425 | 0 | 19 | ||
2426 | === added file 'resources/launcher_pip_btt_37.svg' | |||
2427 | --- resources/launcher_pip_btt_37.svg 1970-01-01 00:00:00 +0000 | |||
2428 | +++ resources/launcher_pip_btt_37.svg 2016-03-18 01:19:20 +0000 | |||
2429 | @@ -0,0 +1,19 @@ | |||
2430 | 1 | <?xml version="1.0" encoding="utf-8"?> | ||
2431 | 2 | <!-- Generator: Adobe Illustrator 18.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) --> | ||
2432 | 3 | <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"> | ||
2433 | 4 | <svg version="1.1" | ||
2434 | 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" | ||
2435 | 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" | ||
2436 | 7 | enable-background="new 0 0 37 20" xml:space="preserve"> | ||
2437 | 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"> | ||
2438 | 9 | <inkscape:grid type="xygrid" enabled="true" id="grid4740" visible="true" empspacing="8" snapvisiblegridlinesonly="true"> | ||
2439 | 10 | </inkscape:grid> | ||
2440 | 11 | <sodipodi:guide id="guide3004" orientation="0,1" position="8,19"></sodipodi:guide> | ||
2441 | 12 | </sodipodi:namedview> | ||
2442 | 13 | <g id="layer1" transform="translate(0,-1015.3622)" inkscape:label="Layer 1" inkscape:groupmode="layer"> | ||
2443 | 14 | <path id="path5745" sodipodi:nodetypes="cccccc" inkscape:connector-curvature="0" opacity="0.14" enable-background="new " d=" | ||
2444 | 15 | M14,1035.4v-7.5l4.5-5.5l4.5,5.5v7.5H14z"/> | ||
2445 | 16 | <path id="path4742" sodipodi:nodetypes="cccccc" inkscape:connector-curvature="0" fill="#FFFFFF" d="M15,1035.4v-7l3.5-4.5 | ||
2446 | 17 | l3.5,4.5v7H15z"/> | ||
2447 | 18 | </g> | ||
2448 | 19 | </svg> | ||
2449 | 0 | 20 | ||
2450 | === added file 'resources/launcher_pressure_effect_rotated.png' | |||
2451 | 1 | Binary 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 | 21 | Binary 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 |
2452 | === modified file 'tests/autopilot/unity/emulators/__init__.py' | |||
2453 | --- tests/autopilot/unity/emulators/__init__.py 2015-08-19 13:54:05 +0000 | |||
2454 | +++ tests/autopilot/unity/emulators/__init__.py 2016-03-18 01:19:20 +0000 | |||
2455 | @@ -20,7 +20,14 @@ | |||
2456 | 20 | 20 | ||
2457 | 21 | from dbus import DBusException | 21 | from dbus import DBusException |
2458 | 22 | 22 | ||
2460 | 23 | 23 | keys = { | |
2461 | 24 | "Left/launcher/keynav/prev": "launcher/keynav/prev", | ||
2462 | 25 | "Left/launcher/keynav/next": "launcher/keynav/next", | ||
2463 | 26 | "Left/launcher/keynav/open-quicklist": "launcher/keynav/open-quicklist", | ||
2464 | 27 | "Bottom/launcher/keynav/prev": "launcher/keynav/close-quicklist", | ||
2465 | 28 | "Bottom/launcher/keynav/next": "launcher/keynav/open-quicklist", | ||
2466 | 29 | "Bottom/launcher/keynav/open-quicklist": "launcher/keynav/prev", | ||
2467 | 30 | } | ||
2468 | 24 | class UnityIntrospectionObject(CustomEmulatorBase): | 31 | class UnityIntrospectionObject(CustomEmulatorBase): |
2469 | 25 | 32 | ||
2470 | 26 | DBUS_SERVICE = "com.canonical.Unity" | 33 | DBUS_SERVICE = "com.canonical.Unity" |
2471 | 27 | 34 | ||
2472 | === modified file 'tests/autopilot/unity/emulators/launcher.py' | |||
2473 | --- tests/autopilot/unity/emulators/launcher.py 2015-09-10 13:23:47 +0000 | |||
2474 | +++ tests/autopilot/unity/emulators/launcher.py 2016-03-18 01:19:20 +0000 | |||
2475 | @@ -17,6 +17,7 @@ | |||
2476 | 17 | from time import sleep | 17 | from time import sleep |
2477 | 18 | 18 | ||
2478 | 19 | from unity.emulators import UnityIntrospectionObject | 19 | from unity.emulators import UnityIntrospectionObject |
2479 | 20 | from unity.emulators import keys | ||
2480 | 20 | from unity.emulators.icons import ( | 21 | from unity.emulators.icons import ( |
2481 | 21 | ApplicationLauncherIcon, | 22 | ApplicationLauncherIcon, |
2482 | 22 | BFBLauncherIcon, | 23 | BFBLauncherIcon, |
2483 | @@ -37,6 +38,10 @@ | |||
2484 | 37 | BEFORE = 3 | 38 | BEFORE = 3 |
2485 | 38 | AFTER = 4 | 39 | AFTER = 4 |
2486 | 39 | 40 | ||
2487 | 41 | class LauncherPosition: | ||
2488 | 42 | """Define launcher possible positions""" | ||
2489 | 43 | LEFT = "Left" | ||
2490 | 44 | BOTTOM = "Bottom" | ||
2491 | 40 | 45 | ||
2492 | 41 | class LauncherController(UnityIntrospectionObject): | 46 | class LauncherController(UnityIntrospectionObject): |
2493 | 42 | """The LauncherController class.""" | 47 | """The LauncherController class.""" |
2494 | @@ -104,12 +109,16 @@ | |||
2495 | 104 | """Places the mouse on the screen of this launcher.""" | 109 | """Places the mouse on the screen of this launcher.""" |
2496 | 105 | move_mouse_to_screen(self.monitor) | 110 | move_mouse_to_screen(self.monitor) |
2497 | 106 | 111 | ||
2499 | 107 | def move_mouse_to_right_of_launcher(self): | 112 | def move_mouse_beside_launcher(self): |
2500 | 108 | """Places the mouse to the right of this launcher.""" | 113 | """Places the mouse to the right of this launcher.""" |
2501 | 109 | move_mouse_to_screen(self.monitor) | 114 | move_mouse_to_screen(self.monitor) |
2502 | 110 | (x, y, w, h) = self.geometry | 115 | (x, y, w, h) = self.geometry |
2505 | 111 | target_x = x + w + 10 | 116 | if h > w: |
2506 | 112 | target_y = y + h / 2 | 117 | target_x = x + w + 10 |
2507 | 118 | target_y = y + h / 2 | ||
2508 | 119 | else: | ||
2509 | 120 | target_x = x + w / 2 | ||
2510 | 121 | target_y = y - 10 | ||
2511 | 113 | 122 | ||
2512 | 114 | logger.debug("Moving mouse away from launcher.") | 123 | logger.debug("Moving mouse away from launcher.") |
2513 | 115 | self._mouse.move(target_x, target_y, False) | 124 | self._mouse.move(target_x, target_y, False) |
2514 | @@ -153,8 +162,13 @@ | |||
2515 | 153 | move_mouse_to_screen(self.monitor) | 162 | move_mouse_to_screen(self.monitor) |
2516 | 154 | (x, y, w, h) = self.geometry | 163 | (x, y, w, h) = self.geometry |
2517 | 155 | 164 | ||
2520 | 156 | target_x = x - 300 # this is the pressure we need to reveal the launcher. | 165 | if h > w: |
2521 | 157 | target_y = y + h / 2 | 166 | target_x = x - 300 # this is the pressure we need to reveal the launcher. |
2522 | 167 | target_y = y + h / 2 | ||
2523 | 168 | else: | ||
2524 | 169 | target_x = x + w / 2 | ||
2525 | 170 | target_y = y + h + 300 | ||
2526 | 171 | |||
2527 | 158 | logger.debug("Revealing launcher on monitor %d with mouse.", self.monitor) | 172 | logger.debug("Revealing launcher on monitor %d with mouse.", self.monitor) |
2528 | 159 | self._mouse.move(target_x, target_y, True, 5, .002) | 173 | self._mouse.move(target_x, target_y, True, 5, .002) |
2529 | 160 | 174 | ||
2530 | @@ -177,7 +191,7 @@ | |||
2531 | 177 | if self.hidemode == 1: | 191 | if self.hidemode == 1: |
2532 | 178 | self.is_showing.wait_for(False) | 192 | self.is_showing.wait_for(False) |
2533 | 179 | 193 | ||
2535 | 180 | def keyboard_select_icon(self, **kwargs): | 194 | def keyboard_select_icon(self, launcher_position = LauncherPosition.LEFT, **kwargs): |
2536 | 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. |
2537 | 182 | 196 | ||
2538 | 183 | The desired mode (keynav or switcher) must be started already before | 197 | The desired mode (keynav or switcher) must be started already before |
2539 | @@ -218,7 +232,7 @@ | |||
2540 | 218 | if matches: | 232 | if matches: |
2541 | 219 | return | 233 | return |
2542 | 220 | if self.in_keynav_mode: | 234 | if self.in_keynav_mode: |
2544 | 221 | self.key_nav_next() | 235 | self.key_nav_next(launcher_position) |
2545 | 222 | elif self.in_switcher_mode: | 236 | elif self.in_switcher_mode: |
2546 | 223 | self.switcher_next() | 237 | self.switcher_next() |
2547 | 224 | raise ValueError("No icon found that matches: %r", kwargs) | 238 | raise ValueError("No icon found that matches: %r", kwargs) |
2548 | @@ -244,23 +258,23 @@ | |||
2549 | 244 | self._perform_key_nav_exit_binding("launcher/keynav/activate") | 258 | self._perform_key_nav_exit_binding("launcher/keynav/activate") |
2550 | 245 | self._get_controller().key_nav_is_active.wait_for(False) | 259 | self._get_controller().key_nav_is_active.wait_for(False) |
2551 | 246 | 260 | ||
2553 | 247 | def key_nav_next(self): | 261 | def key_nav_next(self, launcher_position = LauncherPosition.LEFT): |
2554 | 248 | """Moves the launcher keynav focus to the next launcher icon""" | 262 | """Moves the launcher keynav focus to the next launcher icon""" |
2555 | 249 | logger.debug("Selecting next item in keyboard navigation mode.") | 263 | logger.debug("Selecting next item in keyboard navigation mode.") |
2556 | 250 | old_selection = self._get_controller().key_nav_selection | 264 | old_selection = self._get_controller().key_nav_selection |
2558 | 251 | self._perform_key_nav_binding("launcher/keynav/next") | 265 | self._perform_key_nav_binding(keys[launcher_position + "/launcher/keynav/next"]) |
2559 | 252 | self._get_controller().key_nav_selection.wait_for(NotEquals(old_selection)) | 266 | self._get_controller().key_nav_selection.wait_for(NotEquals(old_selection)) |
2560 | 253 | 267 | ||
2562 | 254 | def key_nav_prev(self): | 268 | def key_nav_prev(self, launcher_position = LauncherPosition.LEFT): |
2563 | 255 | """Moves the launcher keynav focus to the previous launcher icon""" | 269 | """Moves the launcher keynav focus to the previous launcher icon""" |
2564 | 256 | logger.debug("Selecting previous item in keyboard navigation mode.") | 270 | logger.debug("Selecting previous item in keyboard navigation mode.") |
2565 | 257 | old_selection = self._get_controller().key_nav_selection | 271 | old_selection = self._get_controller().key_nav_selection |
2567 | 258 | self._perform_key_nav_binding("launcher/keynav/prev") | 272 | self._perform_key_nav_binding(keys[launcher_position + "/launcher/keynav/prev"]) |
2568 | 259 | self._get_controller().key_nav_selection.wait_for(NotEquals(old_selection)) | 273 | self._get_controller().key_nav_selection.wait_for(NotEquals(old_selection)) |
2569 | 260 | 274 | ||
2571 | 261 | def key_nav_enter_quicklist(self): | 275 | def key_nav_enter_quicklist(self, launcher_position = LauncherPosition.LEFT): |
2572 | 262 | logger.debug("Opening quicklist for currently selected icon.") | 276 | logger.debug("Opening quicklist for currently selected icon.") |
2574 | 263 | self._perform_key_nav_binding("launcher/keynav/open-quicklist") | 277 | self._perform_key_nav_binding(keys[launcher_position + "/launcher/keynav/open-quicklist"]) |
2575 | 264 | self.quicklist_open.wait_for(True) | 278 | self.quicklist_open.wait_for(True) |
2576 | 265 | 279 | ||
2577 | 266 | def key_nav_exit_quicklist(self): | 280 | def key_nav_exit_quicklist(self): |
2578 | @@ -329,9 +343,9 @@ | |||
2579 | 329 | self._mouse.click(button) | 343 | self._mouse.click(button) |
2580 | 330 | 344 | ||
2581 | 331 | if (move_mouse_after): | 345 | if (move_mouse_after): |
2583 | 332 | self.move_mouse_to_right_of_launcher() | 346 | self.move_mouse_beside_launcher() |
2584 | 333 | 347 | ||
2586 | 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): |
2587 | 335 | """Drag a launcher icon to a new position. | 349 | """Drag a launcher icon to a new position. |
2588 | 336 | 350 | ||
2589 | 337 | 'icon' is the icon to move. It must be either a ApplicationLauncherIcon or an | 351 | 'icon' is the icon to move. It must be either a ApplicationLauncherIcon or an |
2590 | @@ -345,9 +359,14 @@ | |||
2591 | 345 | 359 | ||
2592 | 346 | 'drag_type' must be one of IconDragType.INSIDE or IconDragType.OUTSIDE. | 360 | 'drag_type' must be one of IconDragType.INSIDE or IconDragType.OUTSIDE. |
2593 | 347 | This specifies whether the icon is gragged inside the launcher, or to the | 361 | This specifies whether the icon is gragged inside the launcher, or to the |
2595 | 348 | right of it. The default is to drag inside the launcher. If it is | 362 | right/top of it. The default is to drag inside the launcher. If it is |
2596 | 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. |
2597 | 350 | 364 | ||
2598 | 365 | 'launcher_position' must be one of LauncherPosition.LEFT or LauncherPosition.BOTTOM. | ||
2599 | 366 | This specifies the launcher position when dragging the icon. The default launcher | ||
2600 | 367 | position is at left. If it is specified, and not one of the allowed values, a | ||
2601 | 368 | ValueError will be raised. | ||
2602 | 369 | |||
2603 | 351 | For example: | 370 | For example: |
2604 | 352 | 371 | ||
2605 | 353 | >>> drag_icon_to_position(calc_icon, IconDragType.BEFORE, switcher_icon) | 372 | >>> drag_icon_to_position(calc_icon, IconDragType.BEFORE, switcher_icon) |
2606 | @@ -374,29 +393,41 @@ | |||
2607 | 374 | if drag_type not in (IconDragType.INSIDE, IconDragType.OUTSIDE): | 393 | if drag_type not in (IconDragType.INSIDE, IconDragType.OUTSIDE): |
2608 | 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") |
2609 | 376 | 395 | ||
2611 | 377 | icon_height = get_compiz_option("unityshell", "icon_size") | 396 | icon_size = get_compiz_option("unityshell", "icon_size") |
2612 | 378 | 397 | ||
2613 | 379 | self.move_mouse_to_icon(icon) | 398 | self.move_mouse_to_icon(icon) |
2614 | 380 | self._mouse.press() | 399 | self._mouse.press() |
2615 | 381 | sleep(1) | 400 | sleep(1) |
2616 | 382 | 401 | ||
2617 | 383 | if drag_type == IconDragType.OUTSIDE: | 402 | if drag_type == IconDragType.OUTSIDE: |
2620 | 384 | shift_over = self._mouse.x + (icon_height * 2) | 403 | if launcher_position == LauncherPosition.LEFT: |
2621 | 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) |
2622 | 405 | self._mouse.move(shift_over, self._mouse.y, rate=20, time_between_events=0.005) | ||
2623 | 406 | else: | ||
2624 | 407 | shift_over = self._mouse.y - (icon_size * 3) | ||
2625 | 408 | self._mouse.move(self._mouse.x, shift_over, rate=20, time_between_events=0.005) | ||
2626 | 386 | sleep(0.5) | 409 | sleep(0.5) |
2627 | 387 | 410 | ||
2628 | 388 | self.move_mouse_to_icon(target) | 411 | self.move_mouse_to_icon(target) |
2629 | 389 | 412 | ||
2635 | 390 | target_y = target.center.y | 413 | if launcher_position == LauncherPosition.LEFT: |
2636 | 391 | if target_y < icon.center.y: | 414 | target_y = target.center.y |
2637 | 392 | target_y += icon_height | 415 | if target_y < icon.center.y: |
2638 | 393 | if pos == IconDragType.BEFORE: | 416 | target_y += icon_size |
2639 | 394 | target_y -= icon_height + (icon_height / 2) | 417 | if pos == IconDragType.BEFORE: |
2640 | 418 | target_y -= icon_size + (icon_size / 2) | ||
2641 | 419 | self._mouse.move(self._mouse.x, target_y, rate=20, time_between_events=0.005) | ||
2642 | 420 | else: | ||
2643 | 421 | target_x = target.center.x | ||
2644 | 422 | if target_x < icon.center.x: | ||
2645 | 423 | target_x += icon_size | ||
2646 | 424 | if pos == IconDragType.BEFORE: | ||
2647 | 425 | target_x -= icon_size + (icon_size / 2) | ||
2648 | 426 | self._mouse.move(target_x, self._mouse.y, rate=20, time_between_events=0.005) | ||
2649 | 395 | 427 | ||
2650 | 396 | self._mouse.move(self._mouse.x, target_y, rate=20, time_between_events=0.005) | ||
2651 | 397 | sleep(1) | 428 | sleep(1) |
2652 | 398 | self._mouse.release() | 429 | self._mouse.release() |
2654 | 399 | self.move_mouse_to_right_of_launcher() | 430 | self.move_mouse_beside_launcher() |
2655 | 400 | 431 | ||
2656 | 401 | def lock_to_launcher(self, icon): | 432 | def lock_to_launcher(self, icon): |
2657 | 402 | """lock 'icon' to the launcher, if it's not already. | 433 | """lock 'icon' to the launcher, if it's not already. |
2658 | 403 | 434 | ||
2659 | === modified file 'tests/autopilot/unity/tests/launcher/__init__.py' | |||
2660 | --- tests/autopilot/unity/tests/launcher/__init__.py 2014-01-23 15:51:46 +0000 | |||
2661 | +++ tests/autopilot/unity/tests/launcher/__init__.py 2016-03-18 01:19:20 +0000 | |||
2662 | @@ -13,6 +13,7 @@ | |||
2663 | 13 | 13 | ||
2664 | 14 | from unity.tests import UnityTestCase | 14 | from unity.tests import UnityTestCase |
2665 | 15 | from unity.emulators.X11 import set_primary_monitor | 15 | from unity.emulators.X11 import set_primary_monitor |
2666 | 16 | from unity.emulators.launcher import LauncherPosition | ||
2667 | 16 | 17 | ||
2668 | 17 | 18 | ||
2669 | 18 | def _make_scenarios(): | 19 | def _make_scenarios(): |
2670 | @@ -35,7 +36,11 @@ | |||
2671 | 35 | """A base class for all launcher tests that uses scenarios to run on | 36 | """A base class for all launcher tests that uses scenarios to run on |
2672 | 36 | each launcher (for multi-monitor setups). | 37 | each launcher (for multi-monitor setups). |
2673 | 37 | """ | 38 | """ |
2675 | 38 | scenarios = _make_scenarios() | 39 | scenarios = multiply_scenarios(_make_scenarios(), |
2676 | 40 | [ | ||
2677 | 41 | ('left', {'launcher_position': LauncherPosition.LEFT}), | ||
2678 | 42 | ('bottom', {'launcher_position': LauncherPosition.BOTTOM}), | ||
2679 | 43 | ]) | ||
2680 | 39 | 44 | ||
2681 | 40 | def setUp(self): | 45 | def setUp(self): |
2682 | 41 | super(LauncherTestCase, self).setUp() | 46 | super(LauncherTestCase, self).setUp() |
2683 | @@ -45,6 +50,10 @@ | |||
2684 | 45 | self.set_unity_option('num_launchers', int(self.only_primary)) | 50 | self.set_unity_option('num_launchers', int(self.only_primary)) |
2685 | 46 | self.launcher_instance = self.get_launcher() | 51 | self.launcher_instance = self.get_launcher() |
2686 | 47 | 52 | ||
2687 | 53 | old_pos = self.call_gsettings_cmd('get', 'com.canonical.Unity.Launcher', 'launcher-position') | ||
2688 | 54 | self.call_gsettings_cmd('set', 'com.canonical.Unity.Launcher', 'launcher-position', '"%s"' % self.launcher_position) | ||
2689 | 55 | self.addCleanup(self.call_gsettings_cmd, 'set', 'com.canonical.Unity.Launcher', 'launcher-position', old_pos) | ||
2690 | 56 | |||
2691 | 48 | if not self.launcher_instance: | 57 | if not self.launcher_instance: |
2692 | 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) |
2693 | 50 | 59 | ||
2694 | 51 | 60 | ||
2695 | === modified file 'tests/autopilot/unity/tests/launcher/test_icon_behavior.py' | |||
2696 | --- tests/autopilot/unity/tests/launcher/test_icon_behavior.py 2015-09-10 13:23:47 +0000 | |||
2697 | +++ tests/autopilot/unity/tests/launcher/test_icon_behavior.py 2016-03-18 01:19:20 +0000 | |||
2698 | @@ -17,6 +17,7 @@ | |||
2699 | 17 | 17 | ||
2700 | 18 | from unity.emulators.icons import ApplicationLauncherIcon, ExpoLauncherIcon | 18 | from unity.emulators.icons import ApplicationLauncherIcon, ExpoLauncherIcon |
2701 | 19 | from unity.emulators.launcher import IconDragType | 19 | from unity.emulators.launcher import IconDragType |
2702 | 20 | from unity.emulators.launcher import LauncherPosition | ||
2703 | 20 | from unity.tests.launcher import LauncherTestCase, _make_scenarios | 21 | from unity.tests.launcher import LauncherTestCase, _make_scenarios |
2704 | 21 | 22 | ||
2705 | 22 | from Xlib import Xutil | 23 | from Xlib import Xutil |
2706 | @@ -196,7 +197,8 @@ | |||
2707 | 196 | self.launcher_instance.drag_icon_to_position( | 197 | self.launcher_instance.drag_icon_to_position( |
2708 | 197 | calc_icon, | 198 | calc_icon, |
2709 | 198 | IconDragType.AFTER, | 199 | IconDragType.AFTER, |
2711 | 199 | bfb_icon) | 200 | bfb_icon, |
2712 | 201 | launcher_position = self.launcher_position) | ||
2713 | 200 | 202 | ||
2714 | 201 | self.launcher_instance.keyboard_reveal_launcher() | 203 | self.launcher_instance.keyboard_reveal_launcher() |
2715 | 202 | self.addCleanup(self.launcher_instance.keyboard_unreveal_launcher) | 204 | self.addCleanup(self.launcher_instance.keyboard_unreveal_launcher) |
2716 | @@ -354,6 +356,10 @@ | |||
2717 | 354 | [ | 356 | [ |
2718 | 355 | ('inside', {'drag_type': IconDragType.INSIDE}), | 357 | ('inside', {'drag_type': IconDragType.INSIDE}), |
2719 | 356 | ('outside', {'drag_type': IconDragType.OUTSIDE}), | 358 | ('outside', {'drag_type': IconDragType.OUTSIDE}), |
2720 | 359 | ], | ||
2721 | 360 | [ | ||
2722 | 361 | ('left', {'launcher_position': LauncherPosition.LEFT}), | ||
2723 | 362 | ('bottom', {'launcher_position': LauncherPosition.BOTTOM}), | ||
2724 | 357 | ]) | 363 | ]) |
2725 | 358 | 364 | ||
2726 | 359 | def setUp(self): | 365 | def setUp(self): |
2727 | @@ -386,7 +392,8 @@ | |||
2728 | 386 | calc_icon, | 392 | calc_icon, |
2729 | 387 | IconDragType.AFTER, | 393 | IconDragType.AFTER, |
2730 | 388 | bfb_icon, | 394 | bfb_icon, |
2732 | 389 | self.drag_type) | 395 | self.drag_type, |
2733 | 396 | self.launcher_position) | ||
2734 | 390 | moved_icon = self.unity.launcher.model.\ | 397 | moved_icon = self.unity.launcher.model.\ |
2735 | 391 | get_launcher_icons_for_monitor(self.launcher_monitor)[1] | 398 | get_launcher_icons_for_monitor(self.launcher_monitor)[1] |
2736 | 392 | self.assertThat(moved_icon, Equals(calc_icon)) | 399 | self.assertThat(moved_icon, Equals(calc_icon)) |
2737 | @@ -406,14 +413,16 @@ | |||
2738 | 406 | calc_icon, | 413 | calc_icon, |
2739 | 407 | IconDragType.AFTER, | 414 | IconDragType.AFTER, |
2740 | 408 | bfb_icon, | 415 | bfb_icon, |
2742 | 409 | self.drag_type) | 416 | self.drag_type, |
2743 | 417 | self.launcher_position) | ||
2744 | 410 | 418 | ||
2745 | 411 | sleep(1) | 419 | sleep(1) |
2746 | 412 | self.launcher_instance.drag_icon_to_position( | 420 | self.launcher_instance.drag_icon_to_position( |
2747 | 413 | calc_icon, | 421 | calc_icon, |
2748 | 414 | IconDragType.BEFORE, | 422 | IconDragType.BEFORE, |
2749 | 415 | trash_icon, | 423 | trash_icon, |
2751 | 416 | self.drag_type) | 424 | self.drag_type, |
2752 | 425 | self.launcher_position) | ||
2753 | 417 | 426 | ||
2754 | 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. |
2755 | 419 | expected_pos = -2 if self.workspace.num_workspaces < 2 else -1 | 428 | expected_pos = -2 if self.workspace.num_workspaces < 2 else -1 |
2756 | 420 | 429 | ||
2757 | === modified file 'tests/autopilot/unity/tests/launcher/test_keynav.py' | |||
2758 | --- tests/autopilot/unity/tests/launcher/test_keynav.py 2015-03-26 12:58:00 +0000 | |||
2759 | +++ tests/autopilot/unity/tests/launcher/test_keynav.py 2016-03-18 01:19:20 +0000 | |||
2760 | @@ -68,7 +68,7 @@ | |||
2761 | 68 | def test_launcher_keynav_forward(self): | 68 | def test_launcher_keynav_forward(self): |
2762 | 69 | """Must be able to move forwards while in keynav mode.""" | 69 | """Must be able to move forwards while in keynav mode.""" |
2763 | 70 | self.start_keynav_with_cleanup_cancel() | 70 | self.start_keynav_with_cleanup_cancel() |
2765 | 71 | self.launcher_instance.key_nav_next() | 71 | self.launcher_instance.key_nav_next(self.launcher_position) |
2766 | 72 | # The launcher model has hidden items, so the keynav indexes do not | 72 | # The launcher model has hidden items, so the keynav indexes do not |
2767 | 73 | # increase by 1 each time. This test was failing because the 2nd icon | 73 | # increase by 1 each time. This test was failing because the 2nd icon |
2768 | 74 | # had an index of 2, not 1 as expected. The best we can do here is to | 74 | # had an index of 2, not 1 as expected. The best we can do here is to |
2769 | @@ -80,9 +80,9 @@ | |||
2770 | 80 | def test_launcher_keynav_prev_works(self): | 80 | def test_launcher_keynav_prev_works(self): |
2771 | 81 | """Must be able to move backwards while in keynav mode.""" | 81 | """Must be able to move backwards while in keynav mode.""" |
2772 | 82 | self.start_keynav_with_cleanup_cancel() | 82 | self.start_keynav_with_cleanup_cancel() |
2774 | 83 | self.launcher_instance.key_nav_next() | 83 | self.launcher_instance.key_nav_next(self.launcher_position) |
2775 | 84 | self.assertThat(self.unity.launcher.key_nav_selection, Eventually(GreaterThan(0))) | 84 | self.assertThat(self.unity.launcher.key_nav_selection, Eventually(GreaterThan(0))) |
2777 | 85 | self.launcher_instance.key_nav_prev() | 85 | self.launcher_instance.key_nav_prev(self.launcher_position) |
2778 | 86 | self.assertThat(self.unity.launcher.key_nav_selection, Eventually(Equals(0))) | 86 | self.assertThat(self.unity.launcher.key_nav_selection, Eventually(Equals(0))) |
2779 | 87 | 87 | ||
2780 | 88 | def test_launcher_keynav_cycling_forward(self): | 88 | def test_launcher_keynav_cycling_forward(self): |
2781 | @@ -90,29 +90,29 @@ | |||
2782 | 90 | self.start_keynav_with_cleanup_cancel() | 90 | self.start_keynav_with_cleanup_cancel() |
2783 | 91 | prev_icon = 0 | 91 | prev_icon = 0 |
2784 | 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()): |
2786 | 93 | self.launcher_instance.key_nav_next() | 93 | self.launcher_instance.key_nav_next(self.launcher_position) |
2787 | 94 | # FIXME We can't directly check for selection/icon number equalty | 94 | # FIXME We can't directly check for selection/icon number equalty |
2788 | 95 | # since the launcher model also contains "hidden" icons that aren't | 95 | # since the launcher model also contains "hidden" icons that aren't |
2789 | 96 | # shown, so the selection index can increment by more than 1. | 96 | # shown, so the selection index can increment by more than 1. |
2790 | 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))) |
2791 | 98 | prev_icon = self.unity.launcher.key_nav_selection | 98 | prev_icon = self.unity.launcher.key_nav_selection |
2792 | 99 | 99 | ||
2794 | 100 | self.launcher_instance.key_nav_next() | 100 | self.launcher_instance.key_nav_next(self.launcher_position) |
2795 | 101 | self.assertThat(self.unity.launcher.key_nav_selection, Eventually(Equals(0))) | 101 | self.assertThat(self.unity.launcher.key_nav_selection, Eventually(Equals(0))) |
2796 | 102 | 102 | ||
2797 | 103 | def test_launcher_keynav_cycling_backward(self): | 103 | def test_launcher_keynav_cycling_backward(self): |
2798 | 104 | """Launcher keynav must loop through icons when cycling backwards""" | 104 | """Launcher keynav must loop through icons when cycling backwards""" |
2799 | 105 | self.start_keynav_with_cleanup_cancel() | 105 | self.start_keynav_with_cleanup_cancel() |
2801 | 106 | self.launcher_instance.key_nav_prev() | 106 | self.launcher_instance.key_nav_prev(self.launcher_position) |
2802 | 107 | # FIXME We can't directly check for self.unity.launcher.num_launcher_icons - 1 | 107 | # FIXME We can't directly check for self.unity.launcher.num_launcher_icons - 1 |
2803 | 108 | self.assertThat(self.unity.launcher.key_nav_selection, Eventually(GreaterThan(1))) | 108 | self.assertThat(self.unity.launcher.key_nav_selection, Eventually(GreaterThan(1))) |
2804 | 109 | 109 | ||
2805 | 110 | def test_launcher_keynav_can_open_and_close_quicklist(self): | 110 | def test_launcher_keynav_can_open_and_close_quicklist(self): |
2806 | 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.""" |
2807 | 112 | self.start_keynav_with_cleanup_cancel() | 112 | self.start_keynav_with_cleanup_cancel() |
2809 | 113 | self.launcher_instance.key_nav_next() | 113 | self.launcher_instance.key_nav_next(self.launcher_position) |
2810 | 114 | self.addCleanup(self.keyboard.press_and_release, "Escape") | 114 | self.addCleanup(self.keyboard.press_and_release, "Escape") |
2812 | 115 | self.launcher_instance.key_nav_enter_quicklist() | 115 | self.launcher_instance.key_nav_enter_quicklist(self.launcher_position) |
2813 | 116 | self.assertThat(self.launcher_instance.quicklist_open, Eventually(Equals(True))) | 116 | self.assertThat(self.launcher_instance.quicklist_open, Eventually(Equals(True))) |
2814 | 117 | self.launcher_instance.key_nav_exit_quicklist() | 117 | self.launcher_instance.key_nav_exit_quicklist() |
2815 | 118 | self.assertThat(self.launcher_instance.quicklist_open, Eventually(Equals(False))) | 118 | self.assertThat(self.launcher_instance.quicklist_open, Eventually(Equals(False))) |
2816 | @@ -135,7 +135,7 @@ | |||
2817 | 135 | 135 | ||
2818 | 136 | self.start_keynav_with_cleanup_cancel() | 136 | self.start_keynav_with_cleanup_cancel() |
2819 | 137 | 137 | ||
2821 | 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) |
2822 | 139 | self.launcher_instance.key_nav_activate() | 139 | self.launcher_instance.key_nav_activate() |
2823 | 140 | 140 | ||
2824 | 141 | self.assertTrue(calc.is_active) | 141 | self.assertTrue(calc.is_active) |
2825 | @@ -148,7 +148,7 @@ | |||
2826 | 148 | 148 | ||
2827 | 149 | self.start_keynav_with_cleanup_cancel() | 149 | self.start_keynav_with_cleanup_cancel() |
2828 | 150 | 150 | ||
2830 | 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") |
2831 | 152 | self.launcher_instance.key_nav_activate() | 152 | self.launcher_instance.key_nav_activate() |
2832 | 153 | self.addCleanup(self.keybinding, "expo/cancel") | 153 | self.addCleanup(self.keybinding, "expo/cancel") |
2833 | 154 | 154 | ||
2834 | @@ -160,7 +160,7 @@ | |||
2835 | 160 | self.skipTest("This test requires enabled more than one workspace.") | 160 | self.skipTest("This test requires enabled more than one workspace.") |
2836 | 161 | self.start_keynav_with_cleanup_cancel() | 161 | self.start_keynav_with_cleanup_cancel() |
2837 | 162 | 162 | ||
2839 | 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") |
2840 | 164 | self.launcher_instance.key_nav_activate() | 164 | self.launcher_instance.key_nav_activate() |
2841 | 165 | 165 | ||
2842 | 166 | self.keyboard.press_and_release("Escape") | 166 | self.keyboard.press_and_release("Escape") |
2843 | @@ -209,7 +209,7 @@ | |||
2844 | 209 | """A single click outside of launcher must cancel keynav.""" | 209 | """A single click outside of launcher must cancel keynav.""" |
2845 | 210 | self.start_keynav_with_cleanup_cancel() | 210 | self.start_keynav_with_cleanup_cancel() |
2846 | 211 | 211 | ||
2848 | 212 | self.launcher_instance.move_mouse_to_right_of_launcher() | 212 | self.launcher_instance.move_mouse_beside_launcher() |
2849 | 213 | self.mouse.click() | 213 | self.mouse.click() |
2850 | 214 | 214 | ||
2851 | 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))) |
2852 | @@ -229,7 +229,7 @@ | |||
2853 | 229 | def test_launcher_keynav_cancel_on_quicklist_activate(self): | 229 | def test_launcher_keynav_cancel_on_quicklist_activate(self): |
2854 | 230 | """A single click on a quicklist item must cancel keynav.""" | 230 | """A single click on a quicklist item must cancel keynav.""" |
2855 | 231 | self.start_keynav_with_cleanup_cancel() | 231 | self.start_keynav_with_cleanup_cancel() |
2857 | 232 | self.launcher_instance.key_nav_enter_quicklist() | 232 | self.launcher_instance.key_nav_enter_quicklist(self.launcher_position) |
2858 | 233 | 233 | ||
2859 | 234 | bfb_icon = self.unity.launcher.model.get_bfb_icon() | 234 | bfb_icon = self.unity.launcher.model.get_bfb_icon() |
2860 | 235 | bfb_ql = bfb_icon.get_quicklist() | 235 | bfb_ql = bfb_icon.get_quicklist() |
2861 | 236 | 236 | ||
2862 | === modified file 'tests/autopilot/unity/tests/launcher/test_reveal.py' | |||
2863 | --- tests/autopilot/unity/tests/launcher/test_reveal.py 2014-01-23 15:51:46 +0000 | |||
2864 | +++ tests/autopilot/unity/tests/launcher/test_reveal.py 2016-03-18 01:19:20 +0000 | |||
2865 | @@ -39,7 +39,7 @@ | |||
2866 | 39 | 39 | ||
2867 | 40 | def test_reveal_on_mouse_to_edge(self): | 40 | def test_reveal_on_mouse_to_edge(self): |
2868 | 41 | """Tests reveal of launchers by mouse pressure.""" | 41 | """Tests reveal of launchers by mouse pressure.""" |
2870 | 42 | self.launcher_instance.move_mouse_to_right_of_launcher() | 42 | self.launcher_instance.move_mouse_beside_launcher() |
2871 | 43 | self.launcher_instance.mouse_reveal_launcher() | 43 | self.launcher_instance.mouse_reveal_launcher() |
2872 | 44 | self.assertThat(self.launcher_instance.is_showing, Eventually(Equals(True))) | 44 | self.assertThat(self.launcher_instance.is_showing, Eventually(Equals(True))) |
2873 | 45 | 45 | ||
2874 | @@ -58,7 +58,7 @@ | |||
2875 | 58 | """Tests reveal of launchers by mouse pressure to ensure it doesn't | 58 | """Tests reveal of launchers by mouse pressure to ensure it doesn't |
2876 | 59 | automatically hide again. | 59 | automatically hide again. |
2877 | 60 | """ | 60 | """ |
2879 | 61 | self.launcher_instance.move_mouse_to_right_of_launcher() | 61 | self.launcher_instance.move_mouse_beside_launcher() |
2880 | 62 | self.launcher_instance.mouse_reveal_launcher() | 62 | self.launcher_instance.mouse_reveal_launcher() |
2881 | 63 | self.assertThat(self.launcher_instance.is_showing, Eventually(Equals(True))) | 63 | self.assertThat(self.launcher_instance.is_showing, Eventually(Equals(True))) |
2882 | 64 | 64 | ||
2883 | 65 | 65 | ||
2884 | === modified file 'tests/autopilot/unity/tests/launcher/test_scroll.py' | |||
2885 | --- tests/autopilot/unity/tests/launcher/test_scroll.py 2014-12-15 15:17:36 +0000 | |||
2886 | +++ tests/autopilot/unity/tests/launcher/test_scroll.py 2016-03-18 01:19:20 +0000 | |||
2887 | @@ -88,8 +88,9 @@ | |||
2888 | 88 | launcher_instance.move_mouse_to_icon(last_icon) | 88 | launcher_instance.move_mouse_to_icon(last_icon) |
2889 | 89 | 89 | ||
2890 | 90 | # Make sure the first icon is off the screen or else there is no | 90 | # Make sure the first icon is off the screen or else there is no |
2893 | 91 | # scrolling. | 91 | # scrolling when launcher at left |
2894 | 92 | self.assertThat(first_icon.center.y, LessThan(y)) | 92 | if w < h: |
2895 | 93 | self.assertThat(first_icon.center.y, LessThan(y)) | ||
2896 | 93 | 94 | ||
2897 | 94 | # Autoscroll to the first icon | 95 | # Autoscroll to the first icon |
2898 | 95 | launcher_instance.move_mouse_to_icon(first_icon, autoscroll_offset) | 96 | launcher_instance.move_mouse_to_icon(first_icon, autoscroll_offset) |
2899 | 96 | 97 | ||
2900 | === modified file 'tests/autopilot/unity/tests/launcher/test_switcher.py' | |||
2901 | --- tests/autopilot/unity/tests/launcher/test_switcher.py 2014-01-23 15:51:46 +0000 | |||
2902 | +++ tests/autopilot/unity/tests/launcher/test_switcher.py 2016-03-18 01:19:20 +0000 | |||
2903 | @@ -152,7 +152,7 @@ | |||
2904 | 152 | 152 | ||
2905 | 153 | self.start_switcher_with_cleanup_cancel() | 153 | self.start_switcher_with_cleanup_cancel() |
2906 | 154 | 154 | ||
2908 | 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) |
2909 | 156 | self.launcher_instance.switcher_activate() | 156 | self.launcher_instance.switcher_activate() |
2910 | 157 | 157 | ||
2911 | 158 | self.assertThat(lambda: calc.is_active, Eventually(Equals(True))) | 158 | self.assertThat(lambda: calc.is_active, Eventually(Equals(True))) |
2912 | 159 | 159 | ||
2913 | === modified file 'tests/autopilot/unity/tests/launcher/test_tooltips.py' | |||
2914 | --- tests/autopilot/unity/tests/launcher/test_tooltips.py 2014-03-04 22:50:22 +0000 | |||
2915 | +++ tests/autopilot/unity/tests/launcher/test_tooltips.py 2016-03-18 01:19:20 +0000 | |||
2916 | @@ -18,7 +18,7 @@ | |||
2917 | 18 | def setUp(self): | 18 | def setUp(self): |
2918 | 19 | super(LauncherTooltipTests, self).setUp() | 19 | super(LauncherTooltipTests, self).setUp() |
2919 | 20 | self.set_unity_option('launcher_hide_mode', 0) | 20 | self.set_unity_option('launcher_hide_mode', 0) |
2921 | 21 | self.launcher_instance.move_mouse_to_right_of_launcher() | 21 | self.launcher_instance.move_mouse_beside_launcher() |
2922 | 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) |
2923 | 23 | 23 | ||
2924 | 24 | def test_launcher_tooltip_show(self): | 24 | def test_launcher_tooltip_show(self): |
2925 | @@ -49,7 +49,7 @@ | |||
2926 | 49 | b -= 1 | 49 | b -= 1 |
2927 | 50 | 50 | ||
2928 | 51 | # leaving launcher clears tooltips, and instant reveal | 51 | # leaving launcher clears tooltips, and instant reveal |
2930 | 52 | self.launcher_instance.move_mouse_to_right_of_launcher() | 52 | self.launcher_instance.move_mouse_beside_launcher() |
2931 | 53 | self.assertEqual(self.get_reveal_behavior(self.icons[b]), self.DELAYED) | 53 | self.assertEqual(self.get_reveal_behavior(self.icons[b]), self.DELAYED) |
2932 | 54 | 54 | ||
2933 | 55 | def test_launcher_tooltip_disabling(self): | 55 | def test_launcher_tooltip_disabling(self): |
2934 | 56 | 56 | ||
2935 | === modified file 'tests/autopilot/unity/tests/test_dash.py' | |||
2936 | --- tests/autopilot/unity/tests/test_dash.py 2016-02-17 18:40:53 +0000 | |||
2937 | +++ tests/autopilot/unity/tests/test_dash.py 2016-03-18 01:19:20 +0000 | |||
2938 | @@ -148,10 +148,10 @@ | |||
2939 | 148 | 148 | ||
2940 | 149 | self.unity.dash.ensure_visible() | 149 | self.unity.dash.ensure_visible() |
2941 | 150 | 150 | ||
2943 | 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 - |
2944 | 152 | # we do not want to click on it as it focuses the wrong window | 152 | # we do not want to click on it as it focuses the wrong window |
2945 | 153 | w = self.display.get_screen_width() - 1 | 153 | w = self.display.get_screen_width() - 1 |
2947 | 154 | h = self.display.get_screen_height() - 1 | 154 | h = self.display.get_screen_height() / 2 |
2948 | 155 | 155 | ||
2949 | 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. |
2950 | 157 | (calc_x, calc_y, calc_w, calc_h) = calc_win.get_windows()[0].geometry | 157 | (calc_x, calc_y, calc_w, calc_h) = calc_win.get_windows()[0].geometry |
2951 | @@ -689,8 +689,10 @@ | |||
2952 | 689 | 689 | ||
2953 | 690 | self.unity.dash.ensure_visible() | 690 | self.unity.dash.ensure_visible() |
2954 | 691 | 691 | ||
2957 | 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: |
2958 | 693 | 693 | self.assertThat(self.unity.dash.view.x, Eventually(Equals(launcher.geometry.x + launcher.geometry.width - 1))) | |
2959 | 694 | else: | ||
2960 | 695 | self.assertThat(self.unity.dash.view.x, Eventually(Equals(0))) | ||
2961 | 694 | 696 | ||
2962 | 695 | def test_see_more_result_alignment(self): | 697 | def test_see_more_result_alignment(self): |
2963 | 696 | """The see more results label should be baseline aligned | 698 | """The see more results label should be baseline aligned |
2964 | 697 | 699 | ||
2965 | === modified file 'tests/autopilot/unity/tests/test_hud.py' | |||
2966 | --- tests/autopilot/unity/tests/test_hud.py 2015-02-19 19:23:39 +0000 | |||
2967 | +++ tests/autopilot/unity/tests/test_hud.py 2016-03-18 01:19:20 +0000 | |||
2968 | @@ -27,6 +27,8 @@ | |||
2969 | 27 | from time import sleep | 27 | from time import sleep |
2970 | 28 | 28 | ||
2971 | 29 | from unity.emulators.icons import HudLauncherIcon | 29 | from unity.emulators.icons import HudLauncherIcon |
2972 | 30 | from unity.emulators.icons import BFBLauncherIcon | ||
2973 | 31 | from unity.emulators.launcher import LauncherPosition | ||
2974 | 30 | from unity.tests import UnityTestCase | 32 | from unity.tests import UnityTestCase |
2975 | 31 | 33 | ||
2976 | 32 | 34 | ||
2977 | @@ -471,10 +473,10 @@ | |||
2978 | 471 | 473 | ||
2979 | 472 | self.unity.hud.ensure_visible() | 474 | self.unity.hud.ensure_visible() |
2980 | 473 | 475 | ||
2982 | 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 - |
2983 | 475 | # we do not want to click on it as it focuses the wrong window | 477 | # we do not want to click on it as it focuses the wrong window |
2984 | 476 | w = self.display.get_screen_width() - 1 | 478 | w = self.display.get_screen_width() - 1 |
2986 | 477 | h = self.display.get_screen_height() - 1 | 479 | h = (self.display.get_screen_height() - 1) / 2 |
2987 | 478 | 480 | ||
2988 | 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. |
2989 | 480 | (calc_x, calc_y, calc_w, calc_h) = calc_win.get_windows()[0].geometry | 482 | (calc_x, calc_y, calc_w, calc_h) = calc_win.get_windows()[0].geometry |
2990 | @@ -585,7 +587,10 @@ | |||
2991 | 585 | 587 | ||
2992 | 586 | class HudLockedLauncherInteractionsTests(HudTestsBase): | 588 | class HudLockedLauncherInteractionsTests(HudTestsBase): |
2993 | 587 | 589 | ||
2995 | 588 | scenarios = _make_monitor_scenarios() | 590 | launcher_position = [('Launcher on the left', {'launcher_position': LauncherPosition.LEFT}), |
2996 | 591 | ('Launcher on the bottom', {'launcher_position': LauncherPosition.BOTTOM})] | ||
2997 | 592 | |||
2998 | 593 | scenarios = multiply_scenarios(_make_monitor_scenarios(), launcher_position) | ||
2999 | 589 | 594 | ||
3000 | 590 | def setUp(self): | 595 | def setUp(self): |
3001 | 591 | super(HudLockedLauncherInteractionsTests, self).setUp() | 596 | super(HudLockedLauncherInteractionsTests, self).setUp() |
3002 | @@ -593,6 +598,10 @@ | |||
3003 | 593 | self.set_unity_option('num_launchers', 0) | 598 | self.set_unity_option('num_launchers', 0) |
3004 | 594 | self.set_unity_option('launcher_hide_mode', 0) | 599 | self.set_unity_option('launcher_hide_mode', 0) |
3005 | 595 | 600 | ||
3006 | 601 | old_pos = self.call_gsettings_cmd('get', 'com.canonical.Unity.Launcher', 'launcher-position') | ||
3007 | 602 | self.call_gsettings_cmd('set', 'com.canonical.Unity.Launcher', 'launcher-position', '"%s"' % self.launcher_position) | ||
3008 | 603 | self.addCleanup(self.call_gsettings_cmd, 'set', 'com.canonical.Unity.Launcher', 'launcher-position', old_pos) | ||
3009 | 604 | |||
3010 | 596 | move_mouse_to_screen(self.hud_monitor) | 605 | move_mouse_to_screen(self.hud_monitor) |
3011 | 597 | sleep(0.5) | 606 | sleep(0.5) |
3012 | 598 | 607 | ||
3013 | @@ -608,8 +617,9 @@ | |||
3014 | 608 | 617 | ||
3015 | 609 | self.unity.hud.ensure_visible() | 618 | self.unity.hud.ensure_visible() |
3016 | 610 | 619 | ||
3019 | 611 | self.assertTrue(hud_icon.monitors_visibility[self.hud_monitor]) | 620 | if self.launcher_position == LauncherPosition.LEFT: |
3020 | 612 | self.assertTrue(hud_icon.is_on_monitor(self.hud_monitor)) | 621 | self.assertTrue(hud_icon.monitors_visibility[self.hud_monitor]) |
3021 | 622 | self.assertTrue(hud_icon.is_on_monitor(self.hud_monitor)) | ||
3022 | 613 | # For some reason the BFB icon is always visible :-/ | 623 | # For some reason the BFB icon is always visible :-/ |
3023 | 614 | #bfb_icon.visible, Eventually(Equals(False) | 624 | #bfb_icon.visible, Eventually(Equals(False) |
3024 | 615 | 625 | ||
3025 | @@ -622,6 +632,8 @@ | |||
3026 | 622 | if isinstance(icon, HudLauncherIcon): | 632 | if isinstance(icon, HudLauncherIcon): |
3027 | 623 | self.assertFalse(icon.monitors_desaturated[self.hud_monitor]) | 633 | self.assertFalse(icon.monitors_desaturated[self.hud_monitor]) |
3028 | 624 | else: | 634 | else: |
3029 | 635 | if isinstance(icon, BFBLauncherIcon) and self.launcher_position == LauncherPosition.BOTTOM: | ||
3030 | 636 | continue | ||
3031 | 625 | self.assertTrue(icon.monitors_desaturated[self.hud_monitor]) | 637 | self.assertTrue(icon.monitors_desaturated[self.hud_monitor]) |
3032 | 626 | 638 | ||
3033 | 627 | def test_hud_launcher_icon_click_hides_hud(self): | 639 | def test_hud_launcher_icon_click_hides_hud(self): |
3034 | @@ -645,15 +657,24 @@ | |||
3035 | 645 | launcher_screen = [('Launcher on all monitors', {'launcher_primary_only': False}), | 657 | launcher_screen = [('Launcher on all monitors', {'launcher_primary_only': False}), |
3036 | 646 | ('Launcher on primary monitor', {'launcher_primary_only': True})] | 658 | ('Launcher on primary monitor', {'launcher_primary_only': True})] |
3037 | 647 | 659 | ||
3039 | 648 | scenarios = multiply_scenarios(_make_monitor_scenarios(), launcher_modes, launcher_screen) | 660 | launcher_position = [('Launcher on the left', {'launcher_position': LauncherPosition.LEFT}), |
3040 | 661 | ('Launcher on the bottom', {'launcher_position': LauncherPosition.BOTTOM})] | ||
3041 | 662 | |||
3042 | 663 | scenarios = multiply_scenarios(_make_monitor_scenarios(), launcher_modes, launcher_screen, launcher_position) | ||
3043 | 649 | 664 | ||
3044 | 650 | def setUp(self): | 665 | def setUp(self): |
3045 | 651 | super(HudVisualTests, self).setUp() | 666 | super(HudVisualTests, self).setUp() |
3046 | 652 | move_mouse_to_screen(self.hud_monitor) | 667 | move_mouse_to_screen(self.hud_monitor) |
3047 | 653 | self.set_unity_option('launcher_hide_mode', int(self.launcher_autohide)) | 668 | self.set_unity_option('launcher_hide_mode', int(self.launcher_autohide)) |
3048 | 654 | self.set_unity_option('num_launchers', int(self.launcher_primary_only)) | 669 | self.set_unity_option('num_launchers', int(self.launcher_primary_only)) |
3049 | 670 | |||
3050 | 671 | old_pos = self.call_gsettings_cmd('get', 'com.canonical.Unity.Launcher', 'launcher-position') | ||
3051 | 672 | self.call_gsettings_cmd('set', 'com.canonical.Unity.Launcher', 'launcher-position', '"%s"' % self.launcher_position) | ||
3052 | 673 | self.addCleanup(self.call_gsettings_cmd, 'set', 'com.canonical.Unity.Launcher', 'launcher-position', old_pos) | ||
3053 | 674 | |||
3054 | 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) |
3056 | 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) |
3057 | 677 | and self.launcher_position != LauncherPosition.BOTTOM) | ||
3058 | 657 | sleep(0.5) | 678 | sleep(0.5) |
3059 | 658 | 679 | ||
3060 | 659 | def test_initially_hidden(self): | 680 | def test_initially_hidden(self): |
3061 | @@ -671,10 +692,11 @@ | |||
3062 | 671 | monitor_geo = self.display.get_screen_geometry(self.hud_monitor) | 692 | monitor_geo = self.display.get_screen_geometry(self.hud_monitor) |
3063 | 672 | monitor_x = monitor_geo[0] | 693 | monitor_x = monitor_geo[0] |
3064 | 673 | monitor_w = monitor_geo[2] | 694 | monitor_w = monitor_geo[2] |
3065 | 695 | launcher = self.unity.launcher.get_launcher_for_monitor(self.hud_monitor) | ||
3066 | 674 | hud_x = self.unity.hud.geometry[0] | 696 | hud_x = self.unity.hud.geometry[0] |
3067 | 675 | hud_w = self.unity.hud.geometry[2] | 697 | hud_w = self.unity.hud.geometry[2] |
3068 | 676 | 698 | ||
3070 | 677 | if self.hud_locked: | 699 | if self.hud_locked and launcher.geometry.w < launcher.geometry.h: |
3071 | 678 | self.assertThat(hud_x, GreaterThan(monitor_x)) | 700 | self.assertThat(hud_x, GreaterThan(monitor_x)) |
3072 | 679 | self.assertThat(hud_x, LessThan(monitor_x + monitor_w)) | 701 | self.assertThat(hud_x, LessThan(monitor_x + monitor_w)) |
3073 | 680 | self.assertThat(hud_w, Equals(monitor_x + monitor_w - hud_x)) | 702 | self.assertThat(hud_w, Equals(monitor_x + monitor_w - hud_x)) |
3074 | 681 | 703 | ||
3075 | === modified file 'tests/autopilot/unity/tests/test_quicklist.py' | |||
3076 | --- tests/autopilot/unity/tests/test_quicklist.py 2015-08-18 10:08:57 +0000 | |||
3077 | +++ tests/autopilot/unity/tests/test_quicklist.py 2016-03-18 01:19:20 +0000 | |||
3078 | @@ -17,7 +17,9 @@ | |||
3079 | 17 | from time import sleep | 17 | from time import sleep |
3080 | 18 | from xdg.DesktopEntry import DesktopEntry | 18 | from xdg.DesktopEntry import DesktopEntry |
3081 | 19 | 19 | ||
3082 | 20 | from unity.emulators import keys | ||
3083 | 20 | from unity.emulators.quicklist import QuicklistMenuItemLabel | 21 | from unity.emulators.quicklist import QuicklistMenuItemLabel |
3084 | 22 | from unity.emulators.launcher import LauncherPosition | ||
3085 | 21 | from unity.tests import UnityTestCase | 23 | from unity.tests import UnityTestCase |
3086 | 22 | 24 | ||
3087 | 23 | 25 | ||
3088 | @@ -193,12 +195,12 @@ | |||
3089 | 193 | 195 | ||
3090 | 194 | icons = self.unity.launcher.model.get_launcher_icons() | 196 | icons = self.unity.launcher.model.get_launcher_icons() |
3091 | 195 | 197 | ||
3092 | 198 | icon1_ql = self.open_quicklist_for_icon(icons[1]) | ||
3093 | 199 | self.assertThat(icon1_ql.active, Eventually(Equals(True))) | ||
3094 | 200 | |||
3095 | 196 | icon0_ql = self.open_quicklist_for_icon(icons[0]) | 201 | icon0_ql = self.open_quicklist_for_icon(icons[0]) |
3096 | 197 | self.assertThat(icon0_ql.active, Eventually(Equals(True))) | 202 | self.assertThat(icon0_ql.active, Eventually(Equals(True))) |
3101 | 198 | 203 | self.assertThat(icon1_ql.wait_until_destroyed, Not(Raises())) | |
3098 | 199 | icon1_ql = self.open_quicklist_for_icon(icons[1]) | ||
3099 | 200 | self.assertThat(icon1_ql.active, Eventually(Equals(True))) | ||
3100 | 201 | self.assertThat(icon0_ql.wait_until_destroyed, Not(Raises())) | ||
3102 | 202 | 204 | ||
3103 | 203 | def test_right_clicking_same_icon_doesnt_reopen_ql(self): | 205 | def test_right_clicking_same_icon_doesnt_reopen_ql(self): |
3104 | 204 | """A right click to the same icon in the launcher must | 206 | """A right click to the same icon in the launcher must |
3105 | @@ -224,6 +226,10 @@ | |||
3106 | 224 | 226 | ||
3107 | 225 | class QuicklistKeyNavigationTests(UnityTestCase): | 227 | class QuicklistKeyNavigationTests(UnityTestCase): |
3108 | 226 | """Tests for the quicklist key navigation.""" | 228 | """Tests for the quicklist key navigation.""" |
3109 | 229 | scenarios = [ | ||
3110 | 230 | ('left', {'launcher_position': LauncherPosition.LEFT}), | ||
3111 | 231 | ('bottom', {'launcher_position': LauncherPosition.BOTTOM}), | ||
3112 | 232 | ] | ||
3113 | 227 | 233 | ||
3114 | 228 | def setUp(self): | 234 | def setUp(self): |
3115 | 229 | super(QuicklistKeyNavigationTests, self).setUp() | 235 | super(QuicklistKeyNavigationTests, self).setUp() |
3116 | @@ -239,6 +245,10 @@ | |||
3117 | 239 | 245 | ||
3118 | 240 | self.ql_launcher = self.unity.launcher.get_launcher_for_monitor(0) | 246 | self.ql_launcher = self.unity.launcher.get_launcher_for_monitor(0) |
3119 | 241 | 247 | ||
3120 | 248 | old_pos = self.call_gsettings_cmd('get', 'com.canonical.Unity.Launcher', 'launcher-position') | ||
3121 | 249 | self.call_gsettings_cmd('set', 'com.canonical.Unity.Launcher', 'launcher-position', '"%s"' % self.launcher_position) | ||
3122 | 250 | self.addCleanup(self.call_gsettings_cmd, 'set', 'com.canonical.Unity.Launcher', 'launcher-position', old_pos) | ||
3123 | 251 | |||
3124 | 242 | def open_quicklist_with_mouse(self): | 252 | def open_quicklist_with_mouse(self): |
3125 | 243 | """Opens a quicklist with the mouse.""" | 253 | """Opens a quicklist with the mouse.""" |
3126 | 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) |
3127 | @@ -256,8 +266,8 @@ | |||
3128 | 256 | self.ql_launcher.key_nav_start() | 266 | self.ql_launcher.key_nav_start() |
3129 | 257 | self.addCleanup(self.ql_launcher.key_nav_cancel) | 267 | self.addCleanup(self.ql_launcher.key_nav_cancel) |
3130 | 258 | 268 | ||
3133 | 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) |
3134 | 260 | self.keybinding("launcher/keynav/open-quicklist") | 270 | self.keybinding(keys[self.launcher_position + "/launcher/keynav/open-quicklist"]) |
3135 | 261 | self.addCleanup(self.keybinding, "launcher/keynav/close-quicklist") | 271 | self.addCleanup(self.keybinding, "launcher/keynav/close-quicklist") |
3136 | 262 | 272 | ||
3137 | 263 | self.assertThat(self.ql_launcher_icon.get_quicklist, | 273 | self.assertThat(self.ql_launcher_icon.get_quicklist, |
3138 | 264 | 274 | ||
3139 | === modified file 'tests/autopilot/unity/tests/test_spread.py' | |||
3140 | --- tests/autopilot/unity/tests/test_spread.py 2015-08-19 09:14:22 +0000 | |||
3141 | +++ tests/autopilot/unity/tests/test_spread.py 2016-03-18 01:19:20 +0000 | |||
3142 | @@ -150,7 +150,7 @@ | |||
3143 | 150 | """Test that the screen spread desaturates the launcher icons""" | 150 | """Test that the screen spread desaturates the launcher icons""" |
3144 | 151 | self.start_test_application_windows("Calculator", 1) | 151 | self.start_test_application_windows("Calculator", 1) |
3145 | 152 | self.initiate_spread_for_screen() | 152 | self.initiate_spread_for_screen() |
3147 | 153 | self.launcher.move_mouse_to_right_of_launcher() | 153 | self.launcher.move_mouse_beside_launcher() |
3148 | 154 | self.assertLauncherIconsDesaturated() | 154 | self.assertLauncherIconsDesaturated() |
3149 | 155 | 155 | ||
3150 | 156 | def test_spread_saturate_launcher_icons_on_mouse_over(self): | 156 | def test_spread_saturate_launcher_icons_on_mouse_over(self): |
3151 | 157 | 157 | ||
3152 | === modified file 'tests/autopilot/unity/tests/test_wm_keybindings.py' | |||
3153 | --- tests/autopilot/unity/tests/test_wm_keybindings.py 2015-04-10 21:27:19 +0000 | |||
3154 | +++ tests/autopilot/unity/tests/test_wm_keybindings.py 2016-03-18 01:19:20 +0000 | |||
3155 | @@ -99,10 +99,16 @@ | |||
3156 | 99 | monitor = self.bamf_win.monitor | 99 | monitor = self.bamf_win.monitor |
3157 | 100 | monitor_geo = self.display.get_screen_geometry(monitor) | 100 | monitor_geo = self.display.get_screen_geometry(monitor) |
3158 | 101 | launcher = self.unity.launcher.get_launcher_for_monitor(monitor) | 101 | launcher = self.unity.launcher.get_launcher_for_monitor(monitor) |
3160 | 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 |
3161 | 103 | if launcher.geometry[2] < launcher.geometry[3]: | ||
3162 | 104 | launcher_h = 0 | ||
3163 | 105 | launcher_w = 0 if launcher.hidemode else launcher.geometry[2] | ||
3164 | 106 | else: | ||
3165 | 107 | launcher_h = 0 if launcher.hidemode else launcher.geometry[3] | ||
3166 | 108 | launcher_w = 0 | ||
3167 | 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] |
3168 | 104 | return (monitor_geo[0] + launcher_w, monitor_geo[1] + panel_h, | 110 | return (monitor_geo[0] + launcher_w, monitor_geo[1] + panel_h, |
3170 | 105 | monitor_geo[2] - launcher_w, monitor_geo[3] - panel_h) | 111 | monitor_geo[2] - launcher_w, monitor_geo[3] - panel_h - launcher_h) |
3171 | 106 | 112 | ||
3172 | 107 | def test_maximize_window(self): | 113 | def test_maximize_window(self): |
3173 | 108 | if self.start_restored: | 114 | if self.start_restored: |
3174 | 109 | 115 | ||
3175 | === modified file 'tests/test_bfb_launcher_icon.cpp' | |||
3176 | --- tests/test_bfb_launcher_icon.cpp 2014-03-21 04:40:12 +0000 | |||
3177 | +++ tests/test_bfb_launcher_icon.cpp 2016-03-18 01:19:20 +0000 | |||
3178 | @@ -31,7 +31,7 @@ | |||
3179 | 31 | { | 31 | { |
3180 | 32 | public: | 32 | public: |
3181 | 33 | MockBFBLauncherIcon() | 33 | MockBFBLauncherIcon() |
3183 | 34 | : BFBLauncherIcon(LauncherHideMode::LAUNCHER_HIDE_NEVER) | 34 | : BFBLauncherIcon() |
3184 | 35 | {} | 35 | {} |
3185 | 36 | }; | 36 | }; |
3186 | 37 | 37 | ||
3187 | 38 | 38 | ||
3188 | === modified file 'tests/test_hud_launcher_icon.cpp' | |||
3189 | --- tests/test_hud_launcher_icon.cpp 2014-03-21 04:40:12 +0000 | |||
3190 | +++ tests/test_hud_launcher_icon.cpp 2016-03-18 01:19:20 +0000 | |||
3191 | @@ -32,7 +32,7 @@ | |||
3192 | 32 | { | 32 | { |
3193 | 33 | public: | 33 | public: |
3194 | 34 | MockHudLauncherIcon() | 34 | MockHudLauncherIcon() |
3196 | 35 | : HudLauncherIcon(LauncherHideMode::LAUNCHER_HIDE_NEVER) | 35 | : HudLauncherIcon() |
3197 | 36 | {} | 36 | {} |
3198 | 37 | }; | 37 | }; |
3199 | 38 | 38 | ||
3200 | 39 | 39 | ||
3201 | === modified file 'tests/test_launcher.cpp' | |||
3202 | --- tests/test_launcher.cpp 2015-10-14 10:34:03 +0000 | |||
3203 | +++ tests/test_launcher.cpp 2016-03-18 01:19:20 +0000 | |||
3204 | @@ -31,6 +31,7 @@ | |||
3205 | 31 | #include "unity-shared/PanelStyle.h" | 31 | #include "unity-shared/PanelStyle.h" |
3206 | 32 | #include "unity-shared/IconRenderer.h" | 32 | #include "unity-shared/IconRenderer.h" |
3207 | 33 | #include "unity-shared/UBusMessages.h" | 33 | #include "unity-shared/UBusMessages.h" |
3208 | 34 | #include "unity-shared/UnitySettings.h" | ||
3209 | 34 | #include "test_standalone_wm.h" | 35 | #include "test_standalone_wm.h" |
3210 | 35 | #include "test_utils.h" | 36 | #include "test_utils.h" |
3211 | 36 | 37 | ||
3212 | @@ -537,11 +538,13 @@ | |||
3213 | 537 | 538 | ||
3214 | 538 | TEST_F(TestLauncher, EdgeBarriersHandlesEvent) | 539 | TEST_F(TestLauncher, EdgeBarriersHandlesEvent) |
3215 | 539 | { | 540 | { |
3217 | 540 | auto const& launcher_geo = launcher_->GetAbsoluteGeometry(); | 541 | glib::Object<GSettings> gsettings(g_settings_new("com.canonical.Unity.Launcher")); |
3218 | 542 | auto launcher_geo = launcher_->GetAbsoluteGeometry(); | ||
3219 | 541 | auto barrier = std::make_shared<ui::PointerBarrierWrapper>(); | 543 | auto barrier = std::make_shared<ui::PointerBarrierWrapper>(); |
3220 | 542 | auto event = std::make_shared<ui::BarrierEvent>(0, 0, 0, 100); | 544 | auto event = std::make_shared<ui::BarrierEvent>(0, 0, 0, 100); |
3221 | 543 | launcher_->SetHidden(true); | 545 | launcher_->SetHidden(true); |
3222 | 544 | 546 | ||
3223 | 547 | g_settings_set_enum(gsettings, "launcher-position", static_cast<int>(LauncherPosition::LEFT)); | ||
3224 | 545 | options_->reveal_trigger = RevealTrigger::EDGE; | 548 | options_->reveal_trigger = RevealTrigger::EDGE; |
3225 | 546 | 549 | ||
3226 | 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) |
3227 | @@ -567,6 +570,37 @@ | |||
3228 | 567 | ui::EdgeBarrierSubscriber::Result::HANDLED); | 570 | ui::EdgeBarrierSubscriber::Result::HANDLED); |
3229 | 568 | } | 571 | } |
3230 | 569 | } | 572 | } |
3231 | 573 | |||
3232 | 574 | g_settings_set_enum(gsettings, "launcher-position", static_cast<int>(LauncherPosition::BOTTOM)); | ||
3233 | 575 | launcher_geo = launcher_->GetAbsoluteGeometry(); | ||
3234 | 576 | options_->reveal_trigger = RevealTrigger::EDGE; | ||
3235 | 577 | int panel_height = panel::Style::Instance().PanelHeight(launcher_->monitor()); | ||
3236 | 578 | |||
3237 | 579 | for (int y = launcher_geo.y; y < launcher_geo.y+launcher_geo.height; ++y) | ||
3238 | 580 | { | ||
3239 | 581 | for (int x = launcher_geo.x + panel_height; x < launcher_geo.x+launcher_geo.width; ++x) | ||
3240 | 582 | { | ||
3241 | 583 | event->x = x; | ||
3242 | 584 | event->y = y; | ||
3243 | 585 | ASSERT_EQ(launcher_->HandleBarrierEvent(barrier, event), | ||
3244 | 586 | ui::EdgeBarrierSubscriber::Result::HANDLED); | ||
3245 | 587 | } | ||
3246 | 588 | } | ||
3247 | 589 | |||
3248 | 590 | options_->reveal_trigger = RevealTrigger::CORNER; | ||
3249 | 591 | |||
3250 | 592 | for (int y = launcher_geo.y; y < launcher_geo.y+launcher_geo.height; ++y) | ||
3251 | 593 | { | ||
3252 | 594 | for (int x = launcher_geo.x; x < launcher_geo.x + panel_height; ++x) | ||
3253 | 595 | { | ||
3254 | 596 | event->x = x; | ||
3255 | 597 | event->y = y; | ||
3256 | 598 | ASSERT_EQ(launcher_->HandleBarrierEvent(barrier, event), | ||
3257 | 599 | ui::EdgeBarrierSubscriber::Result::HANDLED); | ||
3258 | 600 | } | ||
3259 | 601 | } | ||
3260 | 602 | |||
3261 | 603 | g_settings_reset(gsettings, "launcher-position"); | ||
3262 | 570 | } | 604 | } |
3263 | 571 | 605 | ||
3264 | 572 | TEST_F(TestLauncher, DndIsSpecialRequest) | 606 | TEST_F(TestLauncher, DndIsSpecialRequest) |
3265 | 573 | 607 | ||
3266 | === modified file 'tests/test_launcher_controller.cpp' | |||
3267 | --- tests/test_launcher_controller.cpp 2016-03-08 01:05:08 +0000 | |||
3268 | +++ tests/test_launcher_controller.cpp 2016-03-18 01:19:20 +0000 | |||
3269 | @@ -42,6 +42,7 @@ | |||
3270 | 42 | #include "mock-application.h" | 42 | #include "mock-application.h" |
3271 | 43 | #include "BamfApplicationManager.h" | 43 | #include "BamfApplicationManager.h" |
3272 | 44 | #include "bamf-mock-application.h" | 44 | #include "bamf-mock-application.h" |
3273 | 45 | #include "unity-shared/UnitySettings.h" | ||
3274 | 45 | 46 | ||
3275 | 46 | using namespace testmocks; | 47 | using namespace testmocks; |
3276 | 47 | using namespace unity::launcher; | 48 | using namespace unity::launcher; |
3277 | @@ -490,6 +491,25 @@ | |||
3278 | 490 | ASSERT_EQ(launcher_geo.height, monitor_geo.height - panel_style.PanelHeight()); | 491 | ASSERT_EQ(launcher_geo.height, monitor_geo.height - panel_style.PanelHeight()); |
3279 | 491 | } | 492 | } |
3280 | 492 | 493 | ||
3281 | 494 | TEST_F(TestLauncherController, LauncherPositionResetsOnGsettingsUpdated) | ||
3282 | 495 | { | ||
3283 | 496 | glib::Object<GSettings> gsettings(g_settings_new("com.canonical.Unity.Launcher")); | ||
3284 | 497 | g_settings_set_enum(gsettings, "launcher-position", static_cast<int>(LauncherPosition::LEFT)); | ||
3285 | 498 | nux::Geometry const& monitor_geo = uscreen.GetMonitorGeometry(0); | ||
3286 | 499 | nux::Geometry launcher_geo = lc.launcher().GetAbsoluteGeometry(); | ||
3287 | 500 | ASSERT_EQ(launcher_geo.x, monitor_geo.x); | ||
3288 | 501 | ASSERT_EQ(launcher_geo.y, monitor_geo.y + panel_style.PanelHeight(0)); | ||
3289 | 502 | ASSERT_EQ(launcher_geo.height, monitor_geo.height - panel_style.PanelHeight(0)); | ||
3290 | 503 | |||
3291 | 504 | g_settings_set_enum(gsettings, "launcher-position", static_cast<int>(LauncherPosition::BOTTOM)); | ||
3292 | 505 | launcher_geo = lc.launcher().GetAbsoluteGeometry(); | ||
3293 | 506 | ASSERT_EQ(launcher_geo.x, monitor_geo.x); | ||
3294 | 507 | ASSERT_EQ(launcher_geo.y, monitor_geo.y + monitor_geo.height - launcher_geo.height + 1); | ||
3295 | 508 | ASSERT_EQ(launcher_geo.width, monitor_geo.width); | ||
3296 | 509 | |||
3297 | 510 | g_settings_reset(gsettings, "launcher-position"); | ||
3298 | 511 | } | ||
3299 | 512 | |||
3300 | 493 | TEST_F(TestLauncherController, IconCentersResetsOnMonitorsUpdated) | 513 | TEST_F(TestLauncherController, IconCentersResetsOnMonitorsUpdated) |
3301 | 494 | { | 514 | { |
3302 | 495 | uscreen.SetupFakeMultiMonitor(); | 515 | uscreen.SetupFakeMultiMonitor(); |
3303 | 496 | 516 | ||
3304 | === modified file 'unity-shared/IconRenderer.cpp' | |||
3305 | --- unity-shared/IconRenderer.cpp 2016-02-09 18:16:51 +0000 | |||
3306 | +++ unity-shared/IconRenderer.cpp 2016-03-18 01:19:20 +0000 | |||
3307 | @@ -285,8 +285,12 @@ | |||
3308 | 285 | {&icon_shine, "launcher_icon_shine_"+tile_sufix, icon_size}, | 285 | {&icon_shine, "launcher_icon_shine_"+tile_sufix, icon_size}, |
3309 | 286 | {&arrow_ltr, "launcher_arrow_ltr_"+marker_sufix, marker_size}, | 286 | {&arrow_ltr, "launcher_arrow_ltr_"+marker_sufix, marker_size}, |
3310 | 287 | {&arrow_rtl, "launcher_arrow_rtl_"+marker_sufix, marker_size}, | 287 | {&arrow_rtl, "launcher_arrow_rtl_"+marker_sufix, marker_size}, |
3311 | 288 | {&arrow_btt, "launcher_arrow_btt_"+marker_sufix, marker_size}, | ||
3312 | 289 | {&arrow_ttb, "launcher_arrow_ttb_"+marker_sufix, marker_size}, | ||
3313 | 288 | {&arrow_empty_ltr, "launcher_arrow_outline_ltr_"+marker_sufix, marker_size}, | 290 | {&arrow_empty_ltr, "launcher_arrow_outline_ltr_"+marker_sufix, marker_size}, |
3314 | 291 | {&arrow_empty_btt, "launcher_arrow_outline_btt_"+marker_sufix, marker_size}, | ||
3315 | 289 | {&pip_ltr, "launcher_pip_ltr_"+marker_sufix, marker_size}, | 292 | {&pip_ltr, "launcher_pip_ltr_"+marker_sufix, marker_size}, |
3316 | 293 | {&pip_btt, "launcher_pip_btt_"+marker_sufix, marker_size}, | ||
3317 | 290 | {&progress_bar_trough, "progress_bar_trough", icon_size}, | 294 | {&progress_bar_trough, "progress_bar_trough", icon_size}, |
3318 | 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)}, |
3319 | 292 | }; | 296 | }; |
3320 | @@ -327,8 +331,12 @@ | |||
3321 | 327 | BaseTexturePtr icon_shine; | 331 | BaseTexturePtr icon_shine; |
3322 | 328 | BaseTexturePtr arrow_ltr; | 332 | BaseTexturePtr arrow_ltr; |
3323 | 329 | BaseTexturePtr arrow_rtl; | 333 | BaseTexturePtr arrow_rtl; |
3324 | 334 | BaseTexturePtr arrow_btt; | ||
3325 | 335 | BaseTexturePtr arrow_ttb; | ||
3326 | 330 | BaseTexturePtr arrow_empty_ltr; | 336 | BaseTexturePtr arrow_empty_ltr; |
3327 | 337 | BaseTexturePtr arrow_empty_btt; | ||
3328 | 331 | BaseTexturePtr pip_ltr; | 338 | BaseTexturePtr pip_ltr; |
3329 | 339 | BaseTexturePtr pip_btt; | ||
3330 | 332 | BaseTexturePtr progress_bar_trough; | 340 | BaseTexturePtr progress_bar_trough; |
3331 | 333 | BaseTexturePtr progress_bar_fill; | 341 | BaseTexturePtr progress_bar_fill; |
3332 | 334 | 342 | ||
3333 | @@ -439,10 +447,20 @@ | |||
3334 | 439 | 447 | ||
3335 | 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); |
3336 | 441 | 449 | ||
3341 | 442 | w = geo.width + 2; | 450 | if (Settings::Instance().launcher_position() == LauncherPosition::LEFT) |
3342 | 443 | h = icon_size + spacing; | 451 | { |
3343 | 444 | if (i == (int) args.size() - 1) | 452 | w = geo.width + 2; |
3344 | 445 | h += 4; | 453 | h = icon_size + spacing; |
3345 | 454 | if (i == (int) args.size() - 1) | ||
3346 | 455 | h += 4; | ||
3347 | 456 | } | ||
3348 | 457 | else | ||
3349 | 458 | { | ||
3350 | 459 | h = geo.height + 2; | ||
3351 | 460 | w = icon_size + spacing; | ||
3352 | 461 | if (i == (int) args.size() - 1) | ||
3353 | 462 | w += 4; | ||
3354 | 463 | } | ||
3355 | 446 | x = it->logical_center.x - w / 2.0f; | 464 | x = it->logical_center.x - w / 2.0f; |
3356 | 447 | y = it->logical_center.y - h / 2.0f; | 465 | y = it->logical_center.y - h / 2.0f; |
3357 | 448 | z = it->logical_center.z; | 466 | z = it->logical_center.z; |
3358 | @@ -1023,23 +1041,38 @@ | |||
3359 | 1023 | float alpha, | 1041 | float alpha, |
3360 | 1024 | nux::Geometry const& geo) | 1042 | nux::Geometry const& geo) |
3361 | 1025 | { | 1043 | { |
3364 | 1026 | int markerCenter = (int) arg.render_center.y; | 1044 | int markerCenter = 0; |
3365 | 1027 | markerCenter -= (int)(arg.rotation.x / (2 * M_PI) * icon_size); | 1045 | bool switcher_mode = (pip_style != OUTSIDE_TILE); |
3366 | 1046 | bool left_markers = (switcher_mode || Settings::Instance().launcher_position() == LauncherPosition::LEFT); | ||
3367 | 1047 | |||
3368 | 1048 | if (left_markers) | ||
3369 | 1049 | { | ||
3370 | 1050 | markerCenter = (int) arg.render_center.y; | ||
3371 | 1051 | markerCenter -= (int)(arg.rotation.x / (2 * M_PI) * icon_size); | ||
3372 | 1052 | } | ||
3373 | 1053 | else | ||
3374 | 1054 | { | ||
3375 | 1055 | markerCenter = (int) arg.render_center.x; | ||
3376 | 1056 | |||
3377 | 1057 | if (pip_style == OUTSIDE_TILE) | ||
3378 | 1058 | markerCenter += (int)(arg.rotation.y / (2 * M_PI) * icon_size); | ||
3379 | 1059 | } | ||
3380 | 1028 | 1060 | ||
3381 | 1029 | if (running > 0) | 1061 | if (running > 0) |
3382 | 1030 | { | 1062 | { |
3395 | 1031 | int markerX; | 1063 | int markerX = 0; |
3396 | 1032 | 1064 | if (left_markers) | |
3397 | 1033 | if (pip_style == OUTSIDE_TILE) | 1065 | { |
3398 | 1034 | { | 1066 | if (pip_style == OUTSIDE_TILE) |
3399 | 1035 | markerX = geo.x; | 1067 | { |
3400 | 1036 | } | 1068 | markerX = geo.x; |
3401 | 1037 | else | 1069 | } |
3402 | 1038 | { | 1070 | else |
3403 | 1039 | auto const& bounds = arg.icon->GetTransform(ui::IconTextureSource::TRANSFORM_TILE, monitor); | 1071 | { |
3404 | 1040 | markerX = bounds[0].x + 1; | 1072 | auto const& bounds = arg.icon->GetTransform(ui::IconTextureSource::TRANSFORM_TILE, monitor); |
3405 | 1041 | } | 1073 | markerX = bounds[0].x + 1; |
3406 | 1042 | 1074 | } | |
3407 | 1075 | } | ||
3408 | 1043 | nux::TexCoordXForm texxform; | 1076 | nux::TexCoordXForm texxform; |
3409 | 1044 | nux::Color color = nux::color::LightGrey; | 1077 | nux::Color color = nux::color::LightGrey; |
3410 | 1045 | 1078 | ||
3411 | @@ -1059,41 +1092,87 @@ | |||
3412 | 1059 | if (!arg.running_on_viewport) | 1092 | if (!arg.running_on_viewport) |
3413 | 1060 | { | 1093 | { |
3414 | 1061 | markers[0] = markerCenter; | 1094 | markers[0] = markerCenter; |
3416 | 1062 | texture = local_textures_->arrow_empty_ltr; | 1095 | if (left_markers) |
3417 | 1096 | texture = local_textures_->arrow_empty_ltr; | ||
3418 | 1097 | else | ||
3419 | 1098 | texture = local_textures_->arrow_empty_btt; | ||
3420 | 1063 | } | 1099 | } |
3421 | 1064 | else if (running == 1) | 1100 | else if (running == 1) |
3422 | 1065 | { | 1101 | { |
3423 | 1066 | markers[0] = markerCenter; | 1102 | markers[0] = markerCenter; |
3425 | 1067 | texture = local_textures_->arrow_ltr; | 1103 | if (left_markers) |
3426 | 1104 | texture = local_textures_->arrow_ltr; | ||
3427 | 1105 | else | ||
3428 | 1106 | texture = local_textures_->arrow_btt; | ||
3429 | 1068 | } | 1107 | } |
3430 | 1069 | else if (running == 2) | 1108 | else if (running == 2) |
3431 | 1070 | { | 1109 | { |
3433 | 1071 | texture = local_textures_->pip_ltr; | 1110 | int texture_size = 0; |
3434 | 1111 | if (left_markers) | ||
3435 | 1112 | { | ||
3436 | 1113 | texture = local_textures_->pip_ltr; | ||
3437 | 1114 | texture_size = texture->GetHeight(); | ||
3438 | 1115 | } | ||
3439 | 1116 | else | ||
3440 | 1117 | { | ||
3441 | 1118 | texture = local_textures_->pip_btt; | ||
3442 | 1119 | texture_size = texture->GetWidth(); | ||
3443 | 1120 | } | ||
3444 | 1072 | 1121 | ||
3447 | 1073 | double default_tex_height = local::MARKER_SIZES[local::IconSize::SMALL]; | 1122 | double default_tex_size = local::MARKER_SIZES[local::IconSize::SMALL]; |
3448 | 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)); |
3449 | 1075 | markers[0] = markerCenter - offset; | 1124 | markers[0] = markerCenter - offset; |
3450 | 1076 | markers[1] = markerCenter + offset; | 1125 | markers[1] = markerCenter + offset; |
3451 | 1077 | } | 1126 | } |
3452 | 1078 | else | 1127 | else |
3453 | 1079 | { | 1128 | { |
3455 | 1080 | texture = local_textures_->pip_ltr; | 1129 | int texture_size = 0; |
3456 | 1130 | if (left_markers) | ||
3457 | 1131 | { | ||
3458 | 1132 | texture = local_textures_->pip_ltr; | ||
3459 | 1133 | texture_size = texture->GetHeight(); | ||
3460 | 1134 | } | ||
3461 | 1135 | else | ||
3462 | 1136 | { | ||
3463 | 1137 | texture = local_textures_->pip_btt; | ||
3464 | 1138 | texture_size = texture->GetWidth(); | ||
3465 | 1139 | } | ||
3466 | 1081 | 1140 | ||
3469 | 1082 | double default_tex_height = local::MARKER_SIZES[local::IconSize::SMALL]; | 1141 | double default_tex_size = local::MARKER_SIZES[local::IconSize::SMALL]; |
3470 | 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)); |
3471 | 1084 | markers[0] = markerCenter - offset; | 1143 | markers[0] = markerCenter - offset; |
3472 | 1085 | markers[1] = markerCenter; | 1144 | markers[1] = markerCenter; |
3473 | 1086 | markers[2] = markerCenter + offset; | 1145 | markers[2] = markerCenter + offset; |
3474 | 1087 | } | 1146 | } |
3475 | 1088 | 1147 | ||
3476 | 1148 | int markerY = 0; | ||
3477 | 1149 | if (!left_markers) | ||
3478 | 1150 | { | ||
3479 | 1151 | if (pip_style == OUTSIDE_TILE) | ||
3480 | 1152 | { | ||
3481 | 1153 | markerY = (geo.y + geo.height) - texture->GetHeight(); | ||
3482 | 1154 | } | ||
3483 | 1155 | else | ||
3484 | 1156 | { | ||
3485 | 1157 | auto const& bounds = arg.icon->GetTransform(ui::IconTextureSource::TRANSFORM_TILE, monitor); | ||
3486 | 1158 | |||
3487 | 1159 | markerY = (bounds[2].y - (texture->GetHeight()*scale)); | ||
3488 | 1160 | } | ||
3489 | 1161 | } | ||
3490 | 1162 | |||
3491 | 1089 | for (int i = 0; i < 3; i++) | 1163 | for (int i = 0; i < 3; i++) |
3492 | 1090 | { | 1164 | { |
3493 | 1091 | int center = markers[i]; | 1165 | int center = markers[i]; |
3494 | 1092 | if (center == -100) | 1166 | if (center == -100) |
3495 | 1093 | break; | 1167 | break; |
3496 | 1094 | 1168 | ||
3497 | 1169 | if (left_markers) | ||
3498 | 1170 | markerY = center - std::round(texture->GetHeight() / 2.0f); | ||
3499 | 1171 | else | ||
3500 | 1172 | markerX = center - std::round(texture->GetWidth() / 2.0f); | ||
3501 | 1173 | |||
3502 | 1095 | GfxContext.QRP_1Tex(markerX, | 1174 | GfxContext.QRP_1Tex(markerX, |
3504 | 1096 | center - std::round(texture->GetHeight() / 2.0f), | 1175 | markerY, |
3505 | 1097 | texture->GetWidth(), | 1176 | texture->GetWidth(), |
3506 | 1098 | texture->GetHeight(), | 1177 | texture->GetHeight(), |
3507 | 1099 | texture->GetDeviceTexture(), | 1178 | texture->GetDeviceTexture(), |
3508 | @@ -1106,15 +1185,29 @@ | |||
3509 | 1106 | { | 1185 | { |
3510 | 1107 | nux::TexCoordXForm texxform; | 1186 | nux::TexCoordXForm texxform; |
3511 | 1108 | 1187 | ||
3512 | 1109 | auto const& arrow_rtl = local_textures_->arrow_rtl; | ||
3513 | 1110 | nux::Color color = nux::color::LightGrey * alpha; | 1188 | nux::Color color = nux::color::LightGrey * alpha; |
3521 | 1111 | GfxContext.QRP_1Tex((geo.x + geo.width) - arrow_rtl->GetWidth(), | 1189 | if (left_markers) |
3522 | 1112 | markerCenter - std::round(arrow_rtl->GetHeight() / 2.0f), | 1190 | { |
3523 | 1113 | arrow_rtl->GetWidth(), | 1191 | auto const& arrow_rtl = local_textures_->arrow_rtl; |
3524 | 1114 | arrow_rtl->GetHeight(), | 1192 | GfxContext.QRP_1Tex((geo.x + geo.width) - arrow_rtl->GetWidth(), |
3525 | 1115 | arrow_rtl->GetDeviceTexture(), | 1193 | markerCenter - std::round(arrow_rtl->GetHeight() / 2.0f), |
3526 | 1116 | texxform, | 1194 | arrow_rtl->GetWidth(), |
3527 | 1117 | color); | 1195 | arrow_rtl->GetHeight(), |
3528 | 1196 | arrow_rtl->GetDeviceTexture(), | ||
3529 | 1197 | texxform, | ||
3530 | 1198 | color); | ||
3531 | 1199 | } | ||
3532 | 1200 | else | ||
3533 | 1201 | { | ||
3534 | 1202 | auto const& arrow_ttb = local_textures_->arrow_ttb; | ||
3535 | 1203 | GfxContext.QRP_1Tex(markerCenter - std::round(arrow_ttb->GetWidth() / 2.0f), | ||
3536 | 1204 | geo.y, | ||
3537 | 1205 | arrow_ttb->GetWidth(), | ||
3538 | 1206 | arrow_ttb->GetHeight(), | ||
3539 | 1207 | arrow_ttb->GetDeviceTexture(), | ||
3540 | 1208 | texxform, | ||
3541 | 1209 | color); | ||
3542 | 1210 | } | ||
3543 | 1118 | } | 1211 | } |
3544 | 1119 | } | 1212 | } |
3545 | 1120 | 1213 | ||
3546 | @@ -1267,8 +1360,12 @@ | |||
3547 | 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*/); |
3548 | 1268 | float x_cs = y_cs * AspectRatio; | 1361 | float x_cs = y_cs * AspectRatio; |
3549 | 1269 | 1362 | ||
3552 | 1270 | ViewMatrix = nux::Matrix4::TRANSLATE(-x_cs, y_cs, CameraToScreenDistance) * | 1363 | if (Settings::Instance().launcher_position() == LauncherPosition::LEFT) |
3553 | 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) * |
3554 | 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*/); | ||
3555 | 1366 | else | ||
3556 | 1367 | ViewMatrix = nux::Matrix4::TRANSLATE(-x_cs, y_cs, CameraToScreenDistance) * | ||
3557 | 1368 | nux::Matrix4::SCALE(2.0f * x_cs / ViewportWidth, -2.0f * y_cs / ViewportHeight, -2.0f * x_cs / ViewportWidth); | ||
3558 | 1272 | 1369 | ||
3559 | 1273 | PerspectiveMatrix.Perspective(Fovy, AspectRatio, NearClipPlane, FarClipPlane); | 1370 | PerspectiveMatrix.Perspective(Fovy, AspectRatio, NearClipPlane, FarClipPlane); |
3560 | 1274 | } | 1371 | } |
3561 | 1275 | 1372 | ||
3562 | === modified file 'unity-shared/SpreadFilter.cpp' | |||
3563 | --- unity-shared/SpreadFilter.cpp 2015-11-18 15:43:33 +0000 | |||
3564 | +++ unity-shared/SpreadFilter.cpp 2016-03-18 01:19:20 +0000 | |||
3565 | @@ -55,7 +55,7 @@ | |||
3566 | 55 | auto& settings = Settings::Instance(); | 55 | auto& settings = Settings::Instance(); |
3567 | 56 | auto const& work_area = wm.GetWorkAreaGeometry(0); | 56 | auto const& work_area = wm.GetWorkAreaGeometry(0); |
3568 | 57 | int monitor = wm.MonitorGeometryIn(work_area); | 57 | int monitor = wm.MonitorGeometryIn(work_area); |
3570 | 58 | int launcher_width = settings.LauncherWidth(monitor); | 58 | int launcher_width = settings.LauncherSize(monitor); |
3571 | 59 | auto const& cv = settings.em(monitor); | 59 | auto const& cv = settings.em(monitor); |
3572 | 60 | 60 | ||
3573 | 61 | search_bar_ = SearchBar::Ptr(new SearchBar()); | 61 | search_bar_ = SearchBar::Ptr(new SearchBar()); |
3574 | @@ -81,7 +81,10 @@ | |||
3575 | 81 | view_window_->SetOpacity(0.0f); | 81 | view_window_->SetOpacity(0.0f); |
3576 | 82 | view_window_->SetEnterFocusInputArea(search_bar_.GetPointer()); | 82 | view_window_->SetEnterFocusInputArea(search_bar_.GetPointer()); |
3577 | 83 | view_window_->SetInputFocus(); | 83 | view_window_->SetInputFocus(); |
3579 | 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) |
3580 | 85 | view_window_->SetXY(OFFSET_X.CP(cv) + std::max(work_area.x, launcher_width), OFFSET_Y.CP(cv) + work_area.y); | ||
3581 | 86 | else | ||
3582 | 87 | view_window_->SetXY(OFFSET_X.CP(cv) + work_area.x, OFFSET_Y.CP(cv) + work_area.y); | ||
3583 | 85 | fade_animator_.updated.connect([this] (double opacity) { view_window_->SetOpacity(opacity); }); | 88 | fade_animator_.updated.connect([this] (double opacity) { view_window_->SetOpacity(opacity); }); |
3584 | 86 | 89 | ||
3585 | 87 | nux::GetWindowCompositor().SetKeyFocusArea(search_bar_->text_entry()); | 90 | nux::GetWindowCompositor().SetKeyFocusArea(search_bar_->text_entry()); |
3586 | 88 | 91 | ||
3587 | === modified file 'unity-shared/UnitySettings.cpp' | |||
3588 | --- unity-shared/UnitySettings.cpp 2015-12-03 05:57:00 +0000 | |||
3589 | +++ unity-shared/UnitySettings.cpp 2016-03-18 01:19:20 +0000 | |||
3590 | @@ -40,6 +40,9 @@ | |||
3591 | 40 | const std::string DOUBLE_CLICK_ACTIVATE = "double-click-activate"; | 40 | const std::string DOUBLE_CLICK_ACTIVATE = "double-click-activate"; |
3592 | 41 | const std::string DESKTOP_TYPE = "desktop-type"; | 41 | const std::string DESKTOP_TYPE = "desktop-type"; |
3593 | 42 | 42 | ||
3594 | 43 | const std::string LAUNCHER_SETTINGS = "com.canonical.Unity.Launcher"; | ||
3595 | 44 | const std::string LAUNCHER_POSITION = "launcher-position"; | ||
3596 | 45 | |||
3597 | 43 | const std::string LIM_SETTINGS = "com.canonical.Unity.IntegratedMenus"; | 46 | const std::string LIM_SETTINGS = "com.canonical.Unity.IntegratedMenus"; |
3598 | 44 | const std::string CLICK_MOVEMENT_THRESHOLD = "click-movement-threshold"; | 47 | const std::string CLICK_MOVEMENT_THRESHOLD = "click-movement-threshold"; |
3599 | 45 | const std::string DOUBLE_CLICK_WAIT = "double-click-wait"; | 48 | const std::string DOUBLE_CLICK_WAIT = "double-click-wait"; |
3600 | @@ -63,7 +66,7 @@ | |||
3601 | 63 | const std::string REMOTE_CONTENT_SETTINGS = "com.canonical.Unity.Lenses"; | 66 | const std::string REMOTE_CONTENT_SETTINGS = "com.canonical.Unity.Lenses"; |
3602 | 64 | const std::string REMOTE_CONTENT_KEY = "remote-content-search"; | 67 | const std::string REMOTE_CONTENT_KEY = "remote-content-search"; |
3603 | 65 | 68 | ||
3605 | 66 | const int DEFAULT_LAUNCHER_WIDTH = 64; | 69 | const int DEFAULT_LAUNCHER_SIZE = 64; |
3606 | 67 | const int MINIMUM_DESKTOP_HEIGHT = 800; | 70 | const int MINIMUM_DESKTOP_HEIGHT = 800; |
3607 | 68 | const int GNOME_SETTINGS_CHANGED_WAIT_SECONDS = 1; | 71 | const int GNOME_SETTINGS_CHANGED_WAIT_SECONDS = 1; |
3608 | 69 | const double DEFAULT_DPI = 96.0f; | 72 | const double DEFAULT_DPI = 96.0f; |
3609 | @@ -78,12 +81,14 @@ | |||
3610 | 78 | Impl(Settings* owner) | 81 | Impl(Settings* owner) |
3611 | 79 | : parent_(owner) | 82 | : parent_(owner) |
3612 | 80 | , usettings_(g_settings_new(SETTINGS_NAME.c_str())) | 83 | , usettings_(g_settings_new(SETTINGS_NAME.c_str())) |
3613 | 84 | , launcher_settings_(g_settings_new(LAUNCHER_SETTINGS.c_str())) | ||
3614 | 81 | , lim_settings_(g_settings_new(LIM_SETTINGS.c_str())) | 85 | , lim_settings_(g_settings_new(LIM_SETTINGS.c_str())) |
3615 | 82 | , ui_settings_(g_settings_new(UI_SETTINGS.c_str())) | 86 | , ui_settings_(g_settings_new(UI_SETTINGS.c_str())) |
3616 | 83 | , ubuntu_ui_settings_(g_settings_new(UBUNTU_UI_SETTINGS.c_str())) | 87 | , ubuntu_ui_settings_(g_settings_new(UBUNTU_UI_SETTINGS.c_str())) |
3617 | 84 | , gnome_ui_settings_(g_settings_new(GNOME_UI_SETTINGS.c_str())) | 88 | , gnome_ui_settings_(g_settings_new(GNOME_UI_SETTINGS.c_str())) |
3618 | 85 | , remote_content_settings_(g_settings_new(REMOTE_CONTENT_SETTINGS.c_str())) | 89 | , remote_content_settings_(g_settings_new(REMOTE_CONTENT_SETTINGS.c_str())) |
3620 | 86 | , launcher_widths_(monitors::MAX, DEFAULT_LAUNCHER_WIDTH) | 90 | , launcher_sizes_(monitors::MAX, DEFAULT_LAUNCHER_SIZE) |
3621 | 91 | , cached_launcher_position_(LauncherPosition::LEFT) | ||
3622 | 87 | , cached_form_factor_(FormFactor::DESKTOP) | 92 | , cached_form_factor_(FormFactor::DESKTOP) |
3623 | 88 | , cursor_scale_(1.0) | 93 | , cursor_scale_(1.0) |
3624 | 89 | , cached_double_click_activate_(true) | 94 | , cached_double_click_activate_(true) |
3625 | @@ -95,6 +100,8 @@ | |||
3626 | 95 | parent_->form_factor.SetSetterFunction(sigc::mem_fun(this, &Impl::SetFormFactor)); | 100 | parent_->form_factor.SetSetterFunction(sigc::mem_fun(this, &Impl::SetFormFactor)); |
3627 | 96 | parent_->double_click_activate.SetGetterFunction(sigc::mem_fun(this, &Impl::GetDoubleClickActivate)); | 101 | parent_->double_click_activate.SetGetterFunction(sigc::mem_fun(this, &Impl::GetDoubleClickActivate)); |
3628 | 97 | parent_->remote_content.SetGetterFunction(sigc::mem_fun(this, &Impl::GetRemoteContentEnabled)); | 102 | parent_->remote_content.SetGetterFunction(sigc::mem_fun(this, &Impl::GetRemoteContentEnabled)); |
3629 | 103 | parent_->launcher_position.SetGetterFunction(sigc::mem_fun(this, &Impl::GetLauncherPosition)); | ||
3630 | 104 | parent_->launcher_position.SetSetterFunction(sigc::mem_fun(this, &Impl::SetLauncherPosition)); | ||
3631 | 98 | parent_->desktop_type.SetGetterFunction(sigc::mem_fun(this, &Impl::GetDesktopType)); | 105 | parent_->desktop_type.SetGetterFunction(sigc::mem_fun(this, &Impl::GetDesktopType)); |
3632 | 99 | 106 | ||
3633 | 100 | for (unsigned i = 0; i < monitors::MAX; ++i) | 107 | for (unsigned i = 0; i < monitors::MAX; ++i) |
3634 | @@ -109,6 +116,11 @@ | |||
3635 | 109 | parent_->double_click_activate.changed.emit(cached_double_click_activate_); | 116 | parent_->double_click_activate.changed.emit(cached_double_click_activate_); |
3636 | 110 | }); | 117 | }); |
3637 | 111 | 118 | ||
3638 | 119 | signals_.Add<void, GSettings*, const gchar*>(launcher_settings_, "changed::" + LAUNCHER_POSITION, [this] (GSettings*, const gchar*) { | ||
3639 | 120 | CacheLauncherPosition(); | ||
3640 | 121 | parent_->launcher_position.changed.emit(cached_launcher_position_); | ||
3641 | 122 | }); | ||
3642 | 123 | |||
3643 | 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) { |
3644 | 113 | UpdateDPI(); | 125 | UpdateDPI(); |
3645 | 114 | }); | 126 | }); |
3646 | @@ -164,6 +176,7 @@ | |||
3647 | 164 | CacheFormFactor(); | 176 | CacheFormFactor(); |
3648 | 165 | CacheDoubleClickActivate(); | 177 | CacheDoubleClickActivate(); |
3649 | 166 | UpdateRemoteContentSearch(); | 178 | UpdateRemoteContentSearch(); |
3650 | 179 | CacheLauncherPosition(); | ||
3651 | 167 | } | 180 | } |
3652 | 168 | 181 | ||
3653 | 169 | void CacheFormFactor() | 182 | void CacheFormFactor() |
3654 | @@ -197,6 +210,11 @@ | |||
3655 | 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()); |
3656 | 198 | } | 211 | } |
3657 | 199 | 212 | ||
3658 | 213 | void CacheLauncherPosition() | ||
3659 | 214 | { | ||
3660 | 215 | cached_launcher_position_ = static_cast<LauncherPosition>(g_settings_get_enum(launcher_settings_, LAUNCHER_POSITION.c_str())); | ||
3661 | 216 | } | ||
3662 | 217 | |||
3663 | 200 | void UpdateLimSetting() | 218 | void UpdateLimSetting() |
3664 | 201 | { | 219 | { |
3665 | 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()); |
3666 | @@ -220,6 +238,17 @@ | |||
3667 | 220 | return cached_double_click_activate_; | 238 | return cached_double_click_activate_; |
3668 | 221 | } | 239 | } |
3669 | 222 | 240 | ||
3670 | 241 | LauncherPosition GetLauncherPosition() const | ||
3671 | 242 | { | ||
3672 | 243 | return cached_launcher_position_; | ||
3673 | 244 | } | ||
3674 | 245 | |||
3675 | 246 | bool SetLauncherPosition(LauncherPosition launcherPosition) | ||
3676 | 247 | { | ||
3677 | 248 | g_settings_set_enum(launcher_settings_, LAUNCHER_POSITION.c_str(), static_cast<int>(launcherPosition)); | ||
3678 | 249 | return false; | ||
3679 | 250 | } | ||
3680 | 251 | |||
3681 | 223 | DesktopType GetDesktopType() const | 252 | DesktopType GetDesktopType() const |
3682 | 224 | { | 253 | { |
3683 | 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())); |
3684 | @@ -353,6 +382,7 @@ | |||
3685 | 353 | 382 | ||
3686 | 354 | Settings* parent_; | 383 | Settings* parent_; |
3687 | 355 | glib::Object<GSettings> usettings_; | 384 | glib::Object<GSettings> usettings_; |
3688 | 385 | glib::Object<GSettings> launcher_settings_; | ||
3689 | 356 | glib::Object<GSettings> lim_settings_; | 386 | glib::Object<GSettings> lim_settings_; |
3690 | 357 | glib::Object<GSettings> ui_settings_; | 387 | glib::Object<GSettings> ui_settings_; |
3691 | 358 | glib::Object<GSettings> ubuntu_ui_settings_; | 388 | glib::Object<GSettings> ubuntu_ui_settings_; |
3692 | @@ -361,7 +391,8 @@ | |||
3693 | 361 | glib::Source::UniquePtr changing_gnome_settings_timeout_; | 391 | glib::Source::UniquePtr changing_gnome_settings_timeout_; |
3694 | 362 | glib::SignalManager signals_; | 392 | glib::SignalManager signals_; |
3695 | 363 | std::vector<EMConverter::Ptr> em_converters_; | 393 | std::vector<EMConverter::Ptr> em_converters_; |
3697 | 364 | std::vector<int> launcher_widths_; | 394 | std::vector<int> launcher_sizes_; |
3698 | 395 | LauncherPosition cached_launcher_position_; | ||
3699 | 365 | FormFactor cached_form_factor_; | 396 | FormFactor cached_form_factor_; |
3700 | 366 | double cursor_scale_; | 397 | double cursor_scale_; |
3701 | 367 | bool cached_double_click_activate_; | 398 | bool cached_double_click_activate_; |
3702 | @@ -423,19 +454,19 @@ | |||
3703 | 423 | return pimpl->em(monitor); | 454 | return pimpl->em(monitor); |
3704 | 424 | } | 455 | } |
3705 | 425 | 456 | ||
3707 | 426 | void Settings::SetLauncherWidth(int launcher_width, int monitor) | 457 | void Settings::SetLauncherSize(int launcher_size, int monitor) |
3708 | 427 | { | 458 | { |
3709 | 428 | if (monitor < 0 || monitor >= (int)monitors::MAX) | 459 | if (monitor < 0 || monitor >= (int)monitors::MAX) |
3710 | 429 | { | 460 | { |
3712 | 430 | LOG_ERROR(logger) << "Invalid monitor index: " << monitor << ". Not updating laucher width."; | 461 | LOG_ERROR(logger) << "Invalid monitor index: " << monitor << ". Not updating launcher size."; |
3713 | 431 | } | 462 | } |
3714 | 432 | else | 463 | else |
3715 | 433 | { | 464 | { |
3717 | 434 | pimpl->launcher_widths_[monitor] = launcher_width; | 465 | pimpl->launcher_sizes_[monitor] = launcher_size; |
3718 | 435 | } | 466 | } |
3719 | 436 | } | 467 | } |
3720 | 437 | 468 | ||
3722 | 438 | int Settings::LauncherWidth(int monitor) const | 469 | int Settings::LauncherSize(int monitor) const |
3723 | 439 | { | 470 | { |
3724 | 440 | if (monitor < 0 || monitor >= (int)monitors::MAX) | 471 | if (monitor < 0 || monitor >= (int)monitors::MAX) |
3725 | 441 | { | 472 | { |
3726 | @@ -443,7 +474,7 @@ | |||
3727 | 443 | return 0; | 474 | return 0; |
3728 | 444 | } | 475 | } |
3729 | 445 | 476 | ||
3731 | 446 | return pimpl->launcher_widths_[monitor]; | 477 | return pimpl->launcher_sizes_[monitor]; |
3732 | 447 | } | 478 | } |
3733 | 448 | 479 | ||
3734 | 449 | } // namespace unity | 480 | } // namespace unity |
3735 | 450 | 481 | ||
3736 | === modified file 'unity-shared/UnitySettings.h' | |||
3737 | --- unity-shared/UnitySettings.h 2015-11-23 09:24:10 +0000 | |||
3738 | +++ unity-shared/UnitySettings.h 2016-03-18 01:19:20 +0000 | |||
3739 | @@ -35,10 +35,16 @@ | |||
3740 | 35 | TV | 35 | TV |
3741 | 36 | }; | 36 | }; |
3742 | 37 | 37 | ||
3743 | 38 | enum class LauncherPosition | ||
3744 | 39 | { | ||
3745 | 40 | LEFT = 0, | ||
3746 | 41 | BOTTOM | ||
3747 | 42 | }; | ||
3748 | 43 | |||
3749 | 38 | enum class DesktopType | 44 | enum class DesktopType |
3750 | 39 | { | 45 | { |
3753 | 40 | UBUNTU, | 46 | UBUNTU, |
3754 | 41 | UBUNTUKYLIN | 47 | UBUNTUKYLIN |
3755 | 42 | }; | 48 | }; |
3756 | 43 | 49 | ||
3757 | 44 | class Settings | 50 | class Settings |
3758 | @@ -52,8 +58,8 @@ | |||
3759 | 52 | void SetLowGfxMode(const bool low_gfx); | 58 | void SetLowGfxMode(const bool low_gfx); |
3760 | 53 | EMConverter::Ptr const& em(int monitor = 0) const; | 59 | EMConverter::Ptr const& em(int monitor = 0) const; |
3761 | 54 | 60 | ||
3764 | 55 | void SetLauncherWidth(int launcher_width, int monitor); | 61 | void SetLauncherSize(int launcher_size, int monitor); |
3765 | 56 | int LauncherWidth(int monitor) const; | 62 | int LauncherSize(int mointor) const; |
3766 | 57 | 63 | ||
3767 | 58 | nux::RWProperty<FormFactor> form_factor; | 64 | nux::RWProperty<FormFactor> form_factor; |
3768 | 59 | nux::Property<bool> is_standalone; | 65 | nux::Property<bool> is_standalone; |
3769 | @@ -64,6 +70,7 @@ | |||
3770 | 64 | nux::Property<bool> lim_unfocused_popup; | 70 | nux::Property<bool> lim_unfocused_popup; |
3771 | 65 | nux::Property<double> font_scaling; | 71 | nux::Property<double> font_scaling; |
3772 | 66 | nux::ROProperty<bool> remote_content; | 72 | nux::ROProperty<bool> remote_content; |
3773 | 73 | nux::RWProperty<LauncherPosition> launcher_position; | ||
3774 | 67 | 74 | ||
3775 | 68 | sigc::signal<void> dpi_changed; | 75 | sigc::signal<void> dpi_changed; |
3776 | 69 | sigc::signal<void> low_gfx_changed; | 76 | sigc::signal<void> low_gfx_changed; |
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: pastebin. ubuntu. com/14138663/
- http://
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.