Merge lp:~3v1n0/unity/launchers-resize-new into lp:unity
- launchers-resize-new
- Merge into trunk
Status: | Merged |
---|---|
Approved by: | Marco Trevisan (Treviño) |
Approved revision: | no longer in the source branch. |
Merged at revision: | 3051 |
Proposed branch: | lp:~3v1n0/unity/launchers-resize-new |
Merge into: | lp:unity |
Prerequisite: | lp:~3v1n0/unity/new-launcher-assets |
Diff against target: |
539 lines (+146/-75) 10 files modified
launcher/EdgeBarrierController.h (+1/-2) launcher/Launcher.cpp (+26/-34) launcher/Launcher.h (+2/-2) launcher/LauncherController.cpp (+24/-10) launcher/LauncherControllerPrivate.h (+1/-1) launcher/LauncherOptions.cpp (+3/-1) launcher/LauncherOptions.h (+2/-1) launcher/StandaloneLauncher.cpp (+58/-18) tests/test_launcher_controller.cpp (+24/-2) tests/test_uscreen_mock.h (+5/-4) |
To merge this branch: | bzr merge lp:~3v1n0/unity/launchers-resize-new |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
PS Jenkins bot (community) | continuous-integration | Needs Fixing | |
Andrea Azzarone (community) | Approve | ||
Review via email: mp+135816@code.launchpad.net |
Commit message
Launcher: improve the monitor resizing and background color management, tune the standalone version.
Description of the change
Misc cleanup in Launcher, added a single property in options to manage the launcher background color, using the monitor property to handle monitor changes.
Improved the launcher standalone, so that the view now matches the window size.
Added new tests.
Andrea Azzarone (azzar1) wrote : | # |
*regressions :)
MC Return (mc-return) wrote : | # |
Approved on 2012-11-29.
Will this ever land ?
I guess something's wrong here :)
Martin Mrazik (mrazik) wrote : | # |
This is weird as I have a watchdog which is looking for approved but unmerged MPs. The watchdog noticed this MP only after you made the comment so I assume there was something wrong on the launchpad side.
Martin Mrazik (mrazik) wrote : | # |
Oh, now I actually see it. It didn't merge previously because the prerequisite was merged only a while ago.
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Autolanding.
More details in the following jenkins job:
http://
Executed test runs:
FAILURE: http://
FAILURE: http://
Łukasz Zemczak (sil2100) wrote : | # |
This branch needs re-merging with trunk.
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Autolanding.
More details in the following jenkins job:
http://
Executed test runs:
FAILURE: http://
SUCCESS: http://
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Autolanding.
More details in the following jenkins job:
http://
Executed test runs:
FAILURE: http://
SUCCESS: http://
Preview Diff
1 | === modified file 'launcher/EdgeBarrierController.h' | |||
2 | --- launcher/EdgeBarrierController.h 2012-07-25 23:18:17 +0000 | |||
3 | +++ launcher/EdgeBarrierController.h 2013-01-18 18:26:28 +0000 | |||
4 | @@ -26,9 +26,8 @@ | |||
5 | 26 | namespace unity { | 26 | namespace unity { |
6 | 27 | namespace ui { | 27 | namespace ui { |
7 | 28 | 28 | ||
9 | 29 | class EdgeBarrierSubscriber | 29 | struct EdgeBarrierSubscriber |
10 | 30 | { | 30 | { |
11 | 31 | public: | ||
12 | 32 | virtual bool HandleBarrierEvent(PointerBarrierWrapper* owner, BarrierEvent::Ptr event) = 0; | 31 | virtual bool HandleBarrierEvent(PointerBarrierWrapper* owner, BarrierEvent::Ptr event) = 0; |
13 | 33 | }; | 32 | }; |
14 | 34 | 33 | ||
15 | 35 | 34 | ||
16 | === modified file 'launcher/Launcher.cpp' | |||
17 | --- launcher/Launcher.cpp 2013-01-17 23:44:13 +0000 | |||
18 | +++ launcher/Launcher.cpp 2013-01-18 18:26:28 +0000 | |||
19 | @@ -144,7 +144,7 @@ | |||
20 | 144 | , _drag_gesture_ongoing(false) | 144 | , _drag_gesture_ongoing(false) |
21 | 145 | , _last_reveal_progress(0.0f) | 145 | , _last_reveal_progress(0.0f) |
22 | 146 | , _selection_atom(0) | 146 | , _selection_atom(0) |
24 | 147 | , _background_color(nux::color::DimGray) | 147 | , icon_renderer(std::make_shared<ui::IconRenderer>()) |
25 | 148 | { | 148 | { |
26 | 149 | m_Layout = new nux::HLayout(NUX_TRACKER_LOCATION); | 149 | m_Layout = new nux::HLayout(NUX_TRACKER_LOCATION); |
27 | 150 | 150 | ||
28 | @@ -190,13 +190,8 @@ | |||
29 | 190 | 190 | ||
30 | 191 | ubus_.RegisterInterest(UBUS_OVERLAY_SHOWN, sigc::mem_fun(this, &Launcher::OnOverlayShown)); | 191 | ubus_.RegisterInterest(UBUS_OVERLAY_SHOWN, sigc::mem_fun(this, &Launcher::OnOverlayShown)); |
31 | 192 | ubus_.RegisterInterest(UBUS_OVERLAY_HIDDEN, sigc::mem_fun(this, &Launcher::OnOverlayHidden)); | 192 | ubus_.RegisterInterest(UBUS_OVERLAY_HIDDEN, sigc::mem_fun(this, &Launcher::OnOverlayHidden)); |
32 | 193 | ubus_.RegisterInterest(UBUS_BACKGROUND_COLOR_CHANGED, sigc::mem_fun(this, &Launcher::OnBGColorChanged)); | ||
33 | 194 | ubus_.RegisterInterest(UBUS_LAUNCHER_LOCK_HIDE, sigc::mem_fun(this, &Launcher::OnLockHideChanged)); | 193 | ubus_.RegisterInterest(UBUS_LAUNCHER_LOCK_HIDE, sigc::mem_fun(this, &Launcher::OnLockHideChanged)); |
34 | 195 | 194 | ||
35 | 196 | // request the latest colour from bghash | ||
36 | 197 | ubus_.SendMessage(UBUS_BACKGROUND_REQUEST_COLOUR_EMIT); | ||
37 | 198 | |||
38 | 199 | icon_renderer = ui::AbstractIconRenderer::Ptr(new ui::IconRenderer()); | ||
39 | 200 | icon_renderer->SetTargetSize(_icon_size, _icon_image_size, _space_between_icons); | 195 | icon_renderer->SetTargetSize(_icon_size, _icon_image_size, _space_between_icons); |
40 | 201 | 196 | ||
41 | 202 | TextureCache& cache = TextureCache::GetDefault(); | 197 | TextureCache& cache = TextureCache::GetDefault(); |
42 | @@ -208,6 +203,7 @@ | |||
43 | 208 | launcher_pressure_effect_ = cache.FindTexture("launcher_pressure_effect", 0, 0, cb); | 203 | launcher_pressure_effect_ = cache.FindTexture("launcher_pressure_effect", 0, 0, cb); |
44 | 209 | 204 | ||
45 | 210 | options.changed.connect(sigc::mem_fun(this, &Launcher::OnOptionsChanged)); | 205 | options.changed.connect(sigc::mem_fun(this, &Launcher::OnOptionsChanged)); |
46 | 206 | monitor.changed.connect(sigc::mem_fun(this, &Launcher::OnMonitorChanged)); | ||
47 | 211 | } | 207 | } |
48 | 212 | 208 | ||
49 | 213 | /* Introspection */ | 209 | /* Introspection */ |
50 | @@ -989,7 +985,7 @@ | |||
51 | 989 | struct timespec current; | 985 | struct timespec current; |
52 | 990 | clock_gettime(CLOCK_MONOTONIC, ¤t); | 986 | clock_gettime(CLOCK_MONOTONIC, ¤t); |
53 | 991 | 987 | ||
55 | 992 | nux::Color colorify = FullySaturateColor(_background_color); | 988 | nux::Color const& colorify = FullySaturateColor(options()->background_color); |
56 | 993 | 989 | ||
57 | 994 | float hover_progress = GetHoverProgress(current); | 990 | float hover_progress = GetHoverProgress(current); |
58 | 995 | float folded_z_distance = _folded_z_distance * (1.0f - hover_progress); | 991 | float folded_z_distance = _folded_z_distance * (1.0f - hover_progress); |
59 | @@ -1171,17 +1167,6 @@ | |||
60 | 1171 | EnsureAnimation(); | 1167 | EnsureAnimation(); |
61 | 1172 | } | 1168 | } |
62 | 1173 | 1169 | ||
63 | 1174 | void Launcher::OnBGColorChanged(GVariant *data) | ||
64 | 1175 | { | ||
65 | 1176 | ui::IconRenderer::DestroyShortcutTextures(); | ||
66 | 1177 | |||
67 | 1178 | double red = 0.0f, green = 0.0f, blue = 0.0f, alpha = 0.0f; | ||
68 | 1179 | |||
69 | 1180 | g_variant_get(data, "(dddd)", &red, &green, &blue, &alpha); | ||
70 | 1181 | _background_color = nux::Color(red, green, blue, alpha); | ||
71 | 1182 | QueueDraw(); | ||
72 | 1183 | } | ||
73 | 1184 | |||
74 | 1185 | void Launcher::OnLockHideChanged(GVariant *data) | 1170 | void Launcher::OnLockHideChanged(GVariant *data) |
75 | 1186 | { | 1171 | { |
76 | 1187 | gboolean enable_lock = FALSE; | 1172 | gboolean enable_lock = FALSE; |
77 | @@ -1390,6 +1375,16 @@ | |||
78 | 1390 | UpdateOptions(options()); | 1375 | UpdateOptions(options()); |
79 | 1391 | } | 1376 | } |
80 | 1392 | 1377 | ||
81 | 1378 | void Launcher::OnMonitorChanged(int new_monitor) | ||
82 | 1379 | { | ||
83 | 1380 | UScreen* uscreen = UScreen::GetDefault(); | ||
84 | 1381 | auto monitor_geo = uscreen->GetMonitorGeometry(new_monitor); | ||
85 | 1382 | unity::panel::Style &panel_style = panel::Style::Instance(); | ||
86 | 1383 | |||
87 | 1384 | Resize(nux::Point(monitor_geo.x, monitor_geo.y + panel_style.panel_height), | ||
88 | 1385 | monitor_geo.height - panel_style.panel_height); | ||
89 | 1386 | } | ||
90 | 1387 | |||
91 | 1393 | void Launcher::UpdateOptions(Options::Ptr options) | 1388 | void Launcher::UpdateOptions(Options::Ptr options) |
92 | 1394 | { | 1389 | { |
93 | 1395 | SetIconSize(options->tile_size, options->icon_size); | 1390 | SetIconSize(options->tile_size, options->icon_size); |
94 | @@ -1574,24 +1569,21 @@ | |||
95 | 1574 | 1569 | ||
96 | 1575 | icon_renderer->SetTargetSize(_icon_size, _icon_image_size, _space_between_icons); | 1570 | icon_renderer->SetTargetSize(_icon_size, _icon_image_size, _space_between_icons); |
97 | 1576 | 1571 | ||
99 | 1577 | Resize(); | 1572 | nux::Geometry const& parent_geo = _parent->GetGeometry(); |
100 | 1573 | Resize(nux::Point(parent_geo.x, parent_geo.y), parent_geo.height); | ||
101 | 1578 | } | 1574 | } |
102 | 1579 | 1575 | ||
103 | 1580 | int Launcher::GetIconSize() const | 1576 | int Launcher::GetIconSize() const |
104 | 1581 | { | 1577 | { |
106 | 1582 | return _icon_size; | 1578 | return _icon_size; |
107 | 1583 | } | 1579 | } |
108 | 1584 | 1580 | ||
110 | 1585 | void Launcher::Resize() | 1581 | void Launcher::Resize(nux::Point const& offset, int height) |
111 | 1586 | { | 1582 | { |
120 | 1587 | UScreen* uscreen = UScreen::GetDefault(); | 1583 | unsigned width = _icon_size + ICON_PADDING * 2 + RIGHT_LINE_WIDTH - 2; |
121 | 1588 | auto geo = uscreen->GetMonitorGeometry(monitor()); | 1584 | _parent->SetGeometry(nux::Geometry(offset.x, offset.y, width, height)); |
122 | 1589 | unity::panel::Style &panel_style = panel::Style::Instance(); | 1585 | SetGeometry(nux::Geometry(0, 0, width, height)); |
123 | 1590 | int width = _icon_size + ICON_PADDING*2 + RIGHT_LINE_WIDTH - 2; | 1586 | SetMaximumHeight(height); |
116 | 1591 | nux::Geometry new_geometry(geo.x, geo.y + panel_style.panel_height, width, geo.height - panel_style.panel_height); | ||
117 | 1592 | SetMaximumHeight(new_geometry.height); | ||
118 | 1593 | _parent->SetGeometry(new_geometry); | ||
119 | 1594 | SetGeometry(nux::Geometry(0, 0, new_geometry.width, new_geometry.height)); | ||
124 | 1595 | 1587 | ||
125 | 1596 | ConfigureBarrier(); | 1588 | ConfigureBarrier(); |
126 | 1597 | } | 1589 | } |
127 | @@ -1722,7 +1714,7 @@ | |||
128 | 1722 | 1714 | ||
129 | 1723 | if (Settings::Instance().GetLowGfxMode()) | 1715 | if (Settings::Instance().GetLowGfxMode()) |
130 | 1724 | { | 1716 | { |
132 | 1725 | clear_colour = _background_color; | 1717 | clear_colour = options()->background_color; |
133 | 1726 | clear_colour.alpha = 1.0f; | 1718 | clear_colour.alpha = 1.0f; |
134 | 1727 | } | 1719 | } |
135 | 1728 | 1720 | ||
136 | @@ -1796,7 +1788,7 @@ | |||
137 | 1796 | blur_texture, | 1788 | blur_texture, |
138 | 1797 | texxform_blur_bg, | 1789 | texxform_blur_bg, |
139 | 1798 | nux::color::White, | 1790 | nux::color::White, |
141 | 1799 | _background_color, nux::LAYER_BLEND_MODE_OVERLAY, | 1791 | options()->background_color, nux::LAYER_BLEND_MODE_OVERLAY, |
142 | 1800 | true, ROP); | 1792 | true, ROP); |
143 | 1801 | else | 1793 | else |
144 | 1802 | gPainter.PushDrawTextureLayer(GfxContext, base, | 1794 | gPainter.PushDrawTextureLayer(GfxContext, base, |
145 | @@ -1810,7 +1802,7 @@ | |||
146 | 1810 | blur_texture, | 1802 | blur_texture, |
147 | 1811 | texxform_blur_bg, | 1803 | texxform_blur_bg, |
148 | 1812 | nux::color::White, | 1804 | nux::color::White, |
150 | 1813 | _background_color, nux::LAYER_BLEND_MODE_OVERLAY, | 1805 | options()->background_color, nux::LAYER_BLEND_MODE_OVERLAY, |
151 | 1814 | true, ROP); | 1806 | true, ROP); |
152 | 1815 | #endif | 1807 | #endif |
153 | 1816 | GfxContext.PopClippingRectangle(); | 1808 | GfxContext.PopClippingRectangle(); |
154 | @@ -1829,7 +1821,7 @@ | |||
155 | 1829 | // apply the bg colour | 1821 | // apply the bg colour |
156 | 1830 | #ifndef NUX_OPENGLES_20 | 1822 | #ifndef NUX_OPENGLES_20 |
157 | 1831 | if (GfxContext.UsingGLSLCodePath() == false) | 1823 | if (GfxContext.UsingGLSLCodePath() == false) |
159 | 1832 | gPainter.Paint2DQuadColor(GfxContext, bkg_box, _background_color); | 1824 | gPainter.Paint2DQuadColor(GfxContext, bkg_box, options()->background_color); |
160 | 1833 | #endif | 1825 | #endif |
161 | 1834 | 1826 | ||
162 | 1835 | // apply the shine | 1827 | // apply the shine |
163 | @@ -1849,7 +1841,7 @@ | |||
164 | 1849 | } | 1841 | } |
165 | 1850 | else | 1842 | else |
166 | 1851 | { | 1843 | { |
168 | 1852 | nux::Color color = _background_color; | 1844 | nux::Color color = options()->background_color; |
169 | 1853 | color.alpha = options()->background_alpha; | 1845 | color.alpha = options()->background_alpha; |
170 | 1854 | gPainter.Paint2DQuadColor(GfxContext, bkg_box, color); | 1846 | gPainter.Paint2DQuadColor(GfxContext, bkg_box, color); |
171 | 1855 | } | 1847 | } |
172 | 1856 | 1848 | ||
173 | === modified file 'launcher/Launcher.h' | |||
174 | --- launcher/Launcher.h 2012-11-15 19:46:04 +0000 | |||
175 | +++ launcher/Launcher.h 2013-01-18 18:26:28 +0000 | |||
176 | @@ -121,7 +121,7 @@ | |||
177 | 121 | int GetMouseX() const; | 121 | int GetMouseX() const; |
178 | 122 | int GetMouseY() const; | 122 | int GetMouseY() const; |
179 | 123 | 123 | ||
181 | 124 | void Resize(); | 124 | void Resize(nux::Point const& offset, int height); |
182 | 125 | 125 | ||
183 | 126 | int GetDragDelta() const; | 126 | int GetDragDelta() const; |
184 | 127 | void SetHover(bool hovered); | 127 | void SetHover(bool hovered); |
185 | @@ -196,6 +196,7 @@ | |||
186 | 196 | 196 | ||
187 | 197 | void ConfigureBarrier(); | 197 | void ConfigureBarrier(); |
188 | 198 | 198 | ||
189 | 199 | void OnMonitorChanged(int monitor); | ||
190 | 199 | void OnOptionsChanged(Options::Ptr options); | 200 | void OnOptionsChanged(Options::Ptr options); |
191 | 200 | void OnOptionChanged(); | 201 | void OnOptionChanged(); |
192 | 201 | void UpdateOptions(Options::Ptr options); | 202 | void UpdateOptions(Options::Ptr options); |
193 | @@ -392,7 +393,6 @@ | |||
194 | 392 | 393 | ||
195 | 393 | struct timespec _times[TIME_LAST]; | 394 | struct timespec _times[TIME_LAST]; |
196 | 394 | 395 | ||
197 | 395 | nux::Color _background_color; | ||
198 | 396 | BaseTexturePtr launcher_sheen_; | 396 | BaseTexturePtr launcher_sheen_; |
199 | 397 | BaseTexturePtr launcher_pressure_effect_; | 397 | BaseTexturePtr launcher_pressure_effect_; |
200 | 398 | 398 | ||
201 | 399 | 399 | ||
202 | === modified file 'launcher/LauncherController.cpp' | |||
203 | --- launcher/LauncherController.cpp 2013-01-08 11:47:00 +0000 | |||
204 | +++ launcher/LauncherController.cpp 2013-01-18 18:26:28 +0000 | |||
205 | @@ -40,6 +40,7 @@ | |||
206 | 40 | #include "ExpoLauncherIcon.h" | 40 | #include "ExpoLauncherIcon.h" |
207 | 41 | #include "TrashLauncherIcon.h" | 41 | #include "TrashLauncherIcon.h" |
208 | 42 | #include "BFBLauncherIcon.h" | 42 | #include "BFBLauncherIcon.h" |
209 | 43 | #include "unity-shared/IconRenderer.h" | ||
210 | 43 | #include "unity-shared/UScreen.h" | 44 | #include "unity-shared/UScreen.h" |
211 | 44 | #include "unity-shared/UBusMessages.h" | 45 | #include "unity-shared/UBusMessages.h" |
212 | 45 | #include "unity-shared/TimeUtil.h" | 46 | #include "unity-shared/TimeUtil.h" |
213 | @@ -119,6 +120,17 @@ | |||
214 | 119 | edge_barriers_.options = parent_->options(); | 120 | edge_barriers_.options = parent_->options(); |
215 | 120 | #endif | 121 | #endif |
216 | 121 | 122 | ||
217 | 123 | ubus.RegisterInterest(UBUS_BACKGROUND_COLOR_CHANGED, [this](GVariant * data) { | ||
218 | 124 | ui::IconRenderer::DestroyShortcutTextures(); | ||
219 | 125 | |||
220 | 126 | double red = 0.0f, green = 0.0f, blue = 0.0f, alpha = 0.0f; | ||
221 | 127 | g_variant_get(data, "(dddd)", &red, &green, &blue, &alpha); | ||
222 | 128 | parent_->options()->background_color = nux::Color(red, green, blue, alpha); | ||
223 | 129 | }); | ||
224 | 130 | |||
225 | 131 | // request the latest color from bghash | ||
226 | 132 | ubus.SendMessage(UBUS_BACKGROUND_REQUEST_COLOUR_EMIT); | ||
227 | 133 | |||
228 | 122 | UScreen* uscreen = UScreen::GetDefault(); | 134 | UScreen* uscreen = UScreen::GetDefault(); |
229 | 123 | EnsureLaunchers(uscreen->GetPrimaryMonitor(), uscreen->GetMonitors()); | 135 | EnsureLaunchers(uscreen->GetPrimaryMonitor(), uscreen->GetMonitors()); |
230 | 124 | 136 | ||
231 | @@ -148,7 +160,7 @@ | |||
232 | 148 | wm.window_focus_changed.connect(sigc::mem_fun(this, &Controller::Impl::OnWindowFocusChanged)); | 160 | wm.window_focus_changed.connect(sigc::mem_fun(this, &Controller::Impl::OnWindowFocusChanged)); |
233 | 149 | wm.viewport_layout_changed.connect(sigc::group(sigc::mem_fun(this, &Controller::Impl::UpdateNumWorkspaces), sigc::_1 * sigc::_2)); | 161 | wm.viewport_layout_changed.connect(sigc::group(sigc::mem_fun(this, &Controller::Impl::UpdateNumWorkspaces), sigc::_1 * sigc::_2)); |
234 | 150 | 162 | ||
236 | 151 | ubus.RegisterInterest(UBUS_QUICKLIST_END_KEY_NAV, [&](GVariant * args) { | 163 | ubus.RegisterInterest(UBUS_QUICKLIST_END_KEY_NAV, [this](GVariant * args) { |
237 | 152 | if (reactivate_keynav) | 164 | if (reactivate_keynav) |
238 | 153 | parent_->KeyNavGrab(); | 165 | parent_->KeyNavGrab(); |
239 | 154 | 166 | ||
240 | @@ -197,24 +209,27 @@ | |||
241 | 197 | { | 209 | { |
242 | 198 | if (i >= launchers_size) | 210 | if (i >= launchers_size) |
243 | 199 | { | 211 | { |
245 | 200 | launchers.push_back(nux::ObjectPtr<Launcher>(CreateLauncher(i))); | 212 | launchers.push_back(nux::ObjectPtr<Launcher>(CreateLauncher())); |
246 | 201 | } | 213 | } |
247 | 202 | else if (!launchers[i]) | 214 | else if (!launchers[i]) |
248 | 203 | { | 215 | { |
250 | 204 | launchers[i] = nux::ObjectPtr<Launcher>(CreateLauncher(i)); | 216 | launchers[i] = nux::ObjectPtr<Launcher>(CreateLauncher()); |
251 | 205 | } | 217 | } |
252 | 206 | 218 | ||
253 | 207 | int monitor = (num_launchers == 1) ? primary : i; | 219 | int monitor = (num_launchers == 1) ? primary : i; |
254 | 208 | 220 | ||
255 | 209 | #ifdef USE_X11 | ||
256 | 210 | if (launchers[i]->monitor() != monitor) | 221 | if (launchers[i]->monitor() != monitor) |
257 | 211 | { | 222 | { |
258 | 223 | #ifdef USE_X11 | ||
259 | 212 | edge_barriers_.Unsubscribe(launchers[i].GetPointer(), launchers[i]->monitor); | 224 | edge_barriers_.Unsubscribe(launchers[i].GetPointer(), launchers[i]->monitor); |
260 | 213 | } | ||
261 | 214 | #endif | 225 | #endif |
262 | 226 | launchers[i]->monitor = monitor; | ||
263 | 227 | } | ||
264 | 228 | else | ||
265 | 229 | { | ||
266 | 230 | launchers[i]->monitor.changed(monitor); | ||
267 | 231 | } | ||
268 | 215 | 232 | ||
269 | 216 | launchers[i]->monitor(monitor); | ||
270 | 217 | launchers[i]->Resize(); | ||
271 | 218 | #ifdef USE_X11 | 233 | #ifdef USE_X11 |
272 | 219 | edge_barriers_.Subscribe(launchers[i].GetPointer(), launchers[i]->monitor); | 234 | edge_barriers_.Subscribe(launchers[i].GetPointer(), launchers[i]->monitor); |
273 | 220 | #endif | 235 | #endif |
274 | @@ -222,7 +237,7 @@ | |||
275 | 222 | 237 | ||
276 | 223 | for (unsigned int i = last_launcher; i < launchers_size; ++i) | 238 | for (unsigned int i = last_launcher; i < launchers_size; ++i) |
277 | 224 | { | 239 | { |
279 | 225 | auto launcher = launchers[i]; | 240 | auto const& launcher = launchers[i]; |
280 | 226 | if (launcher) | 241 | if (launcher) |
281 | 227 | { | 242 | { |
282 | 228 | parent_->RemoveChild(launcher.GetPointer()); | 243 | parent_->RemoveChild(launcher.GetPointer()); |
283 | @@ -297,12 +312,11 @@ | |||
284 | 297 | } | 312 | } |
285 | 298 | } | 313 | } |
286 | 299 | 314 | ||
288 | 300 | Launcher* Controller::Impl::CreateLauncher(int monitor) | 315 | Launcher* Controller::Impl::CreateLauncher() |
289 | 301 | { | 316 | { |
290 | 302 | nux::BaseWindow* launcher_window = new nux::BaseWindow(TEXT("LauncherWindow")); | 317 | nux::BaseWindow* launcher_window = new nux::BaseWindow(TEXT("LauncherWindow")); |
291 | 303 | 318 | ||
292 | 304 | Launcher* launcher = new Launcher(launcher_window); | 319 | Launcher* launcher = new Launcher(launcher_window); |
293 | 305 | launcher->monitor = monitor; | ||
294 | 306 | launcher->options = parent_->options(); | 320 | launcher->options = parent_->options(); |
295 | 307 | launcher->SetModel(model_); | 321 | launcher->SetModel(model_); |
296 | 308 | 322 | ||
297 | 309 | 323 | ||
298 | === modified file 'launcher/LauncherControllerPrivate.h' | |||
299 | --- launcher/LauncherControllerPrivate.h 2012-12-07 04:21:35 +0000 | |||
300 | +++ launcher/LauncherControllerPrivate.h 2013-01-18 18:26:28 +0000 | |||
301 | @@ -54,7 +54,7 @@ | |||
302 | 54 | 54 | ||
303 | 55 | void UpdateNumWorkspaces(int workspaces); | 55 | void UpdateNumWorkspaces(int workspaces); |
304 | 56 | 56 | ||
306 | 57 | Launcher* CreateLauncher(int monitor); | 57 | Launcher* CreateLauncher(); |
307 | 58 | 58 | ||
308 | 59 | void SaveIconsOrder(); | 59 | void SaveIconsOrder(); |
309 | 60 | void SortAndUpdate(); | 60 | void SortAndUpdate(); |
310 | 61 | 61 | ||
311 | === modified file 'launcher/LauncherOptions.cpp' | |||
312 | --- launcher/LauncherOptions.cpp 2012-12-14 18:12:52 +0000 | |||
313 | +++ launcher/LauncherOptions.cpp 2013-01-18 18:26:28 +0000 | |||
314 | @@ -33,9 +33,10 @@ | |||
315 | 33 | , auto_hide_animation(FADE_AND_SLIDE) | 33 | , auto_hide_animation(FADE_AND_SLIDE) |
316 | 34 | , backlight_mode(BACKLIGHT_NORMAL) | 34 | , backlight_mode(BACKLIGHT_NORMAL) |
317 | 35 | , reveal_trigger(RevealTrigger::EDGE) | 35 | , reveal_trigger(RevealTrigger::EDGE) |
318 | 36 | , background_color(nux::Color(95, 18, 45)) | ||
319 | 37 | , background_alpha(0.6667) | ||
320 | 36 | , icon_size(48) | 38 | , icon_size(48) |
321 | 37 | , tile_size(54) | 39 | , tile_size(54) |
322 | 38 | , background_alpha(0.6667) | ||
323 | 39 | , edge_decay_rate(1500) | 40 | , edge_decay_rate(1500) |
324 | 40 | , edge_overcome_pressure(2000) | 41 | , edge_overcome_pressure(2000) |
325 | 41 | , edge_stop_velocity(6500) | 42 | , edge_stop_velocity(6500) |
326 | @@ -51,6 +52,7 @@ | |||
327 | 51 | 52 | ||
328 | 52 | auto_hide_animation.changed.connect(sigc::hide(changed_lambda)); | 53 | auto_hide_animation.changed.connect(sigc::hide(changed_lambda)); |
329 | 53 | background_alpha.changed.connect(sigc::hide(changed_lambda)); | 54 | background_alpha.changed.connect(sigc::hide(changed_lambda)); |
330 | 55 | background_color.changed.connect(sigc::hide(changed_lambda)); | ||
331 | 54 | backlight_mode.changed.connect(sigc::hide(changed_lambda)); | 56 | backlight_mode.changed.connect(sigc::hide(changed_lambda)); |
332 | 55 | edge_decay_rate.changed.connect(sigc::hide(changed_lambda)); | 57 | edge_decay_rate.changed.connect(sigc::hide(changed_lambda)); |
333 | 56 | edge_overcome_pressure.changed.connect(sigc::hide(changed_lambda)); | 58 | edge_overcome_pressure.changed.connect(sigc::hide(changed_lambda)); |
334 | 57 | 59 | ||
335 | === modified file 'launcher/LauncherOptions.h' | |||
336 | --- launcher/LauncherOptions.h 2012-12-14 18:12:52 +0000 | |||
337 | +++ launcher/LauncherOptions.h 2013-01-18 18:26:28 +0000 | |||
338 | @@ -89,9 +89,10 @@ | |||
339 | 89 | nux::Property<AutoHideAnimation> auto_hide_animation; | 89 | nux::Property<AutoHideAnimation> auto_hide_animation; |
340 | 90 | nux::Property<BacklightMode> backlight_mode; | 90 | nux::Property<BacklightMode> backlight_mode; |
341 | 91 | nux::Property<RevealTrigger> reveal_trigger; | 91 | nux::Property<RevealTrigger> reveal_trigger; |
342 | 92 | nux::Property<nux::Color> background_color; | ||
343 | 93 | nux::Property<float> background_alpha; | ||
344 | 92 | nux::Property<int> icon_size; | 94 | nux::Property<int> icon_size; |
345 | 93 | nux::Property<int> tile_size; | 95 | nux::Property<int> tile_size; |
346 | 94 | nux::Property<float> background_alpha; | ||
347 | 95 | nux::Property<int> edge_decay_rate; | 96 | nux::Property<int> edge_decay_rate; |
348 | 96 | nux::Property<int> edge_overcome_pressure; | 97 | nux::Property<int> edge_overcome_pressure; |
349 | 97 | nux::Property<int> edge_stop_velocity; | 98 | nux::Property<int> edge_stop_velocity; |
350 | 98 | 99 | ||
351 | === modified file 'launcher/StandaloneLauncher.cpp' | |||
352 | --- launcher/StandaloneLauncher.cpp 2013-01-17 14:09:35 +0000 | |||
353 | +++ launcher/StandaloneLauncher.cpp 2013-01-18 18:26:28 +0000 | |||
354 | @@ -27,35 +27,75 @@ | |||
355 | 27 | #include "Launcher.h" | 27 | #include "Launcher.h" |
356 | 28 | #include "unity-shared/IconRenderer.h" | 28 | #include "unity-shared/IconRenderer.h" |
357 | 29 | #include "unity-shared/PanelStyle.h" | 29 | #include "unity-shared/PanelStyle.h" |
358 | 30 | #include "unity-shared/UBusMessages.h" | ||
359 | 30 | #include "unity-shared/UnitySettings.h" | 31 | #include "unity-shared/UnitySettings.h" |
360 | 32 | #include "unity-shared/UScreen.h" | ||
361 | 31 | 33 | ||
362 | 32 | using namespace unity; | 34 | using namespace unity; |
363 | 33 | 35 | ||
367 | 34 | static launcher::Controller::Ptr controller; | 36 | namespace |
365 | 35 | |||
366 | 36 | void ThreadWidgetInit(nux::NThread* thread, void* InitData) | ||
368 | 37 | { | 37 | { |
371 | 38 | auto xdnd_manager = std::make_shared<XdndManager>(); | 38 | const nux::Size win_size(1024, 768); |
372 | 39 | controller = std::make_shared<launcher::Controller>(xdnd_manager); | 39 | const nux::Color bg_color(95/255.0f, 18/255.0f, 45/255.0f, 1.0f); |
373 | 40 | } | 40 | } |
374 | 41 | 41 | ||
375 | 42 | struct LauncherWindow | ||
376 | 43 | { | ||
377 | 44 | LauncherWindow() | ||
378 | 45 | : wt(nux::CreateGUIThread("Unity Launcher", win_size.width, win_size.height, 0, &LauncherWindow::ThreadWidgetInit, this)) | ||
379 | 46 | {} | ||
380 | 47 | |||
381 | 48 | void Show() | ||
382 | 49 | { | ||
383 | 50 | wt->Run(nullptr); | ||
384 | 51 | } | ||
385 | 52 | |||
386 | 53 | private: | ||
387 | 54 | void SetupBackground() | ||
388 | 55 | { | ||
389 | 56 | nux::ObjectPtr<nux::BaseTexture> background_tex; | ||
390 | 57 | background_tex.Adopt(nux::CreateTextureFromFile("/usr/share/backgrounds/warty-final-ubuntu.png")); | ||
391 | 58 | nux::TexCoordXForm texxform; | ||
392 | 59 | auto tex_layer = std::make_shared<nux::TextureLayer>(background_tex->GetDeviceTexture(), texxform, nux::color::White); | ||
393 | 60 | wt->SetWindowBackgroundPaintLayer(tex_layer.get()); | ||
394 | 61 | } | ||
395 | 62 | |||
396 | 63 | void Init() | ||
397 | 64 | { | ||
398 | 65 | SetupBackground(); | ||
399 | 66 | controller.reset(new launcher::Controller(std::make_shared<XdndManager>())); | ||
400 | 67 | controller->launcher().GetParent()->EnableInputWindow(false); | ||
401 | 68 | |||
402 | 69 | UScreen* uscreen = UScreen::GetDefault(); | ||
403 | 70 | std::vector<nux::Geometry> fake_monitor({nux::Geometry(0, 0, win_size.width, win_size.height)}); | ||
404 | 71 | uscreen->changed.emit(0, fake_monitor); | ||
405 | 72 | uscreen->changed.clear(); | ||
406 | 73 | controller->launcher().Resize(nux::Point(), win_size.height); | ||
407 | 74 | |||
408 | 75 | wt->window_configuration.connect([this] (int x, int y, int w, int h) { | ||
409 | 76 | controller->launcher().Resize(nux::Point(), h); | ||
410 | 77 | }); | ||
411 | 78 | } | ||
412 | 79 | |||
413 | 80 | static void ThreadWidgetInit(nux::NThread* thread, void* self) | ||
414 | 81 | { | ||
415 | 82 | static_cast<LauncherWindow*>(self)->Init(); | ||
416 | 83 | } | ||
417 | 84 | |||
418 | 85 | internal::FavoriteStoreGSettings favorite_store; | ||
419 | 86 | unity::Settings settings; | ||
420 | 87 | panel::Style panel_style; | ||
421 | 88 | std::shared_ptr<nux::WindowThread> wt; | ||
422 | 89 | launcher::Controller::Ptr controller; | ||
423 | 90 | }; | ||
424 | 91 | |||
425 | 42 | int main(int argc, char** argv) | 92 | int main(int argc, char** argv) |
426 | 43 | { | 93 | { |
427 | 44 | gtk_init(&argc, &argv); | 94 | gtk_init(&argc, &argv); |
428 | 45 | nux::NuxInitialize(0); | 95 | nux::NuxInitialize(0); |
429 | 46 | 96 | ||
443 | 47 | unity::Settings settings; | 97 | LauncherWindow lc; |
444 | 48 | panel::Style panel_style; | 98 | lc.Show(); |
445 | 49 | internal::FavoriteStoreGSettings favorite_store; | 99 | |
433 | 50 | |||
434 | 51 | BackgroundEffectHelper::blur_type = BLUR_NONE; | ||
435 | 52 | nux::WindowThread* wt = nux::CreateGUIThread(TEXT("Unity Switcher"), 300, 800, 0, &ThreadWidgetInit, 0); | ||
436 | 53 | |||
437 | 54 | wt->Run(NULL); | ||
438 | 55 | // Make sure the controller is destroyed before the window thread. | ||
439 | 56 | controller.reset(); | ||
440 | 57 | ::unity::ui::IconRenderer::DestroyTextures(); | ||
441 | 58 | |||
442 | 59 | delete wt; | ||
446 | 60 | return 0; | 100 | return 0; |
447 | 61 | } | 101 | } |
448 | 62 | 102 | ||
449 | === modified file 'tests/test_launcher_controller.cpp' | |||
450 | --- tests/test_launcher_controller.cpp 2013-01-14 23:11:05 +0000 | |||
451 | +++ tests/test_launcher_controller.cpp 2013-01-18 18:26:28 +0000 | |||
452 | @@ -327,7 +327,7 @@ | |||
453 | 327 | 327 | ||
454 | 328 | for (int i = 0; i < max_num_monitors; ++i) | 328 | for (int i = 0; i < max_num_monitors; ++i) |
455 | 329 | { | 329 | { |
457 | 330 | EXPECT_EQ(lc.launchers()[i]->monitor(), i); | 330 | ASSERT_EQ(lc.launchers()[i]->monitor(), i); |
458 | 331 | } | 331 | } |
459 | 332 | } | 332 | } |
460 | 333 | 333 | ||
461 | @@ -389,7 +389,7 @@ | |||
462 | 389 | ASSERT_EQ(lc.launchers().size(), max_num_monitors - 1); | 389 | ASSERT_EQ(lc.launchers().size(), max_num_monitors - 1); |
463 | 390 | 390 | ||
464 | 391 | for (int i = 0; i < max_num_monitors - 1; ++i) | 391 | for (int i = 0; i < max_num_monitors - 1; ++i) |
466 | 392 | EXPECT_EQ(lc.launchers()[i]->monitor(), i); | 392 | ASSERT_EQ(lc.launchers()[i]->monitor(), i); |
467 | 393 | } | 393 | } |
468 | 394 | 394 | ||
469 | 395 | TEST_F(TestLauncherController, SingleMonitorSwitchToMultimonitor) | 395 | TEST_F(TestLauncherController, SingleMonitorSwitchToMultimonitor) |
470 | @@ -436,6 +436,20 @@ | |||
471 | 436 | 436 | ||
472 | 437 | #endif | 437 | #endif |
473 | 438 | 438 | ||
474 | 439 | TEST_F(TestLauncherController, MultimonitorGeometries) | ||
475 | 440 | { | ||
476 | 441 | uscreen.SetupFakeMultiMonitor(); | ||
477 | 442 | |||
478 | 443 | for (int i = 0; i < max_num_monitors; ++i) | ||
479 | 444 | { | ||
480 | 445 | auto const& monitor_geo = uscreen.GetMonitorGeometry(i); | ||
481 | 446 | auto const& launcher_geo = lc.launchers()[i]->GetAbsoluteGeometry(); | ||
482 | 447 | ASSERT_EQ(launcher_geo.x, monitor_geo.x); | ||
483 | 448 | ASSERT_EQ(launcher_geo.y, monitor_geo.y + panel_style.panel_height); | ||
484 | 449 | ASSERT_EQ(launcher_geo.height, monitor_geo.height - panel_style.panel_height); | ||
485 | 450 | } | ||
486 | 451 | } | ||
487 | 452 | |||
488 | 439 | TEST_F(TestLauncherController, OnlyUnstickIconOnFavoriteRemoval) | 453 | TEST_F(TestLauncherController, OnlyUnstickIconOnFavoriteRemoval) |
489 | 440 | { | 454 | { |
490 | 441 | const std::string desktop = app::BZR_HANDLE_PATCH; | 455 | const std::string desktop = app::BZR_HANDLE_PATCH; |
491 | @@ -1555,6 +1569,14 @@ | |||
492 | 1555 | ASSERT_EQ(lc.Impl()->model_->Selection()->tooltip_text(), last_selection_change); | 1569 | ASSERT_EQ(lc.Impl()->model_->Selection()->tooltip_text(), last_selection_change); |
493 | 1556 | } | 1570 | } |
494 | 1557 | 1571 | ||
495 | 1572 | TEST_F(TestLauncherController, UpdateLaunchersBackgroundColor) | ||
496 | 1573 | { | ||
497 | 1574 | UBusManager().SendMessage(UBUS_BACKGROUND_COLOR_CHANGED, | ||
498 | 1575 | g_variant_new("(dddd)", 11/255.0f, 22/255.0f, 33/255.0f, 1.0f)); | ||
499 | 1576 | |||
500 | 1577 | Utils::WaitUntil([this] { return lc.options()->background_color == nux::Color(11, 22, 33); }); | ||
501 | 1578 | } | ||
502 | 1579 | |||
503 | 1558 | // thumper: 2012-11-28 disabling the drag and drop tests as they are taking over 20s | 1580 | // thumper: 2012-11-28 disabling the drag and drop tests as they are taking over 20s |
504 | 1559 | // each, and that is not acceptable for unit tests. These sound more like functional | 1581 | // each, and that is not acceptable for unit tests. These sound more like functional |
505 | 1560 | // tests. | 1582 | // tests. |
506 | 1561 | 1583 | ||
507 | === modified file 'tests/test_uscreen_mock.h' | |||
508 | --- tests/test_uscreen_mock.h 2012-07-24 20:22:08 +0000 | |||
509 | +++ tests/test_uscreen_mock.h 2013-01-18 18:26:28 +0000 | |||
510 | @@ -44,16 +44,17 @@ | |||
511 | 44 | default_screen_ = nullptr; | 44 | default_screen_ = nullptr; |
512 | 45 | } | 45 | } |
513 | 46 | 46 | ||
515 | 47 | void Reset(bool emit = true) | 47 | void Reset(bool emit_change = true) |
516 | 48 | { | 48 | { |
517 | 49 | default_screen_ = this; | 49 | default_screen_ = this; |
518 | 50 | primary_ = 0; | 50 | primary_ = 0; |
519 | 51 | monitors_ = {nux::Geometry(0, 0, MONITOR_WIDTH, MONITOR_HEIGHT)}; | 51 | monitors_ = {nux::Geometry(0, 0, MONITOR_WIDTH, MONITOR_HEIGHT)}; |
520 | 52 | 52 | ||
522 | 53 | changed.emit(primary_, monitors_); | 53 | if (emit_change) |
523 | 54 | changed.emit(primary_, monitors_); | ||
524 | 54 | } | 55 | } |
525 | 55 | 56 | ||
527 | 56 | void SetupFakeMultiMonitor(int primary = 0, bool emit_update = true) | 57 | void SetupFakeMultiMonitor(int primary = 0, bool emit_change = true) |
528 | 57 | { | 58 | { |
529 | 58 | SetPrimary(primary, false); | 59 | SetPrimary(primary, false); |
530 | 59 | monitors_.clear(); | 60 | monitors_.clear(); |
531 | @@ -63,7 +64,7 @@ | |||
532 | 63 | monitors_.push_back(nux::Geometry(MONITOR_WIDTH, MONITOR_HEIGHT, total_width, 0)); | 64 | monitors_.push_back(nux::Geometry(MONITOR_WIDTH, MONITOR_HEIGHT, total_width, 0)); |
533 | 64 | total_width += MONITOR_WIDTH; | 65 | total_width += MONITOR_WIDTH; |
534 | 65 | 66 | ||
536 | 66 | if (emit_update) | 67 | if (emit_change) |
537 | 67 | changed.emit(GetPrimaryMonitor(), GetMonitors()); | 68 | changed.emit(GetPrimaryMonitor(), GetMonitors()); |
538 | 68 | } | 69 | } |
539 | 69 | } | 70 | } |
LGTM. Can't see any regression here and all tests pass.