Merge lp:~3v1n0/unity/scale-layout-windows into lp:unity
- scale-layout-windows
- Merge into trunk
Proposed by
Marco Trevisan (Treviño)
Status: | Merged | ||||||||
---|---|---|---|---|---|---|---|---|---|
Approved by: | Christopher Townsend | ||||||||
Approved revision: | no longer in the source branch. | ||||||||
Merged at revision: | 3714 | ||||||||
Proposed branch: | lp:~3v1n0/unity/scale-layout-windows | ||||||||
Merge into: | lp:unity | ||||||||
Diff against target: |
417 lines (+188/-22) 10 files modified
decorations/DecoratedWindow.cpp (+1/-1) panel/PanelMenuView.cpp (+22/-14) plugins/unityshell/src/unityshell.cpp (+113/-3) plugins/unityshell/src/unityshell.h (+6/-0) shortcuts/ShortcutController.cpp (+5/-1) shortcuts/ShortcutController.h (+2/-0) tests/test_layout_system.cpp (+1/-0) tests/test_shortcut_controller.cpp (+33/-0) unity-shared/LayoutSystem.cpp (+4/-3) unity-shared/LayoutSystem.h (+1/-0) |
||||||||
To merge this branch: | bzr merge lp:~3v1n0/unity/scale-layout-windows | ||||||||
Related bugs: |
|
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Christopher Townsend | Approve | ||
PS Jenkins bot (community) | continuous-integration | Approve | |
Review via email: mp+210234@code.launchpad.net |
Commit message
UnityScreen: use switcher's LayoutSystem to compute the scaled windows geometries
Thanks to this, both the Alt+Tab and Spread will use the same codepath to define the positioning of the scaled windows.
Description of the change
JohnLea approved it.
To post a comment you must log in.
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote : | # |
review:
Approve
(continuous-integration)
Revision history for this message
Christopher Townsend (townsend) wrote : | # |
Looks good
review:
Approve
Preview Diff
[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1 | === modified file 'decorations/DecoratedWindow.cpp' | |||
2 | --- decorations/DecoratedWindow.cpp 2014-02-27 05:30:25 +0000 | |||
3 | +++ decorations/DecoratedWindow.cpp 2014-03-12 23:00:55 +0000 | |||
4 | @@ -129,7 +129,7 @@ | |||
5 | 129 | if (win_->hasUnmapReference()) | 129 | if (win_->hasUnmapReference()) |
6 | 130 | return; | 130 | return; |
7 | 131 | 131 | ||
9 | 132 | CompWindowExtents empty(0, 0, 0, 0); | 132 | CompWindowExtents empty; |
10 | 133 | 133 | ||
11 | 134 | if (win_->border() != empty || win_->input() != empty) | 134 | if (win_->border() != empty || win_->input() != empty) |
12 | 135 | win_->setWindowFrameExtents(&empty, &empty); | 135 | win_->setWindowFrameExtents(&empty, &empty); |
13 | 136 | 136 | ||
14 | === modified file 'panel/PanelMenuView.cpp' | |||
15 | --- panel/PanelMenuView.cpp 2014-03-06 09:26:03 +0000 | |||
16 | +++ panel/PanelMenuView.cpp 2014-03-12 23:00:55 +0000 | |||
17 | @@ -693,22 +693,30 @@ | |||
18 | 693 | if (BAMF_IS_WINDOW(window)) | 693 | if (BAMF_IS_WINDOW(window)) |
19 | 694 | { | 694 | { |
20 | 695 | BamfView *view = reinterpret_cast<BamfView*>(window); | 695 | BamfView *view = reinterpret_cast<BamfView*>(window); |
21 | 696 | std::vector<Window> const& our_xids = nux::XInputWindow::NativeHandleList(); | ||
22 | 697 | Window window_xid = bamf_window_get_xid(window); | 696 | Window window_xid = bamf_window_get_xid(window); |
23 | 698 | 697 | ||
25 | 699 | if (std::find(our_xids.begin(), our_xids.end(), window_xid) != our_xids.end()) | 698 | if (bamf_window_get_window_type(window) == BAMF_WINDOW_DOCK) |
26 | 700 | { | 699 | { |
38 | 701 | /* If the active window is an unity window, we need to fallback to the | 700 | auto panel = const_cast<PanelMenuView*>(this)->GetTopLevelViewWindow(); |
39 | 702 | * top one, anyway we should always avoid to focus unity internal windows */ | 701 | if (static_cast<nux::BaseWindow*>(panel)->GetInputWindowId() == window_xid) |
40 | 703 | BamfWindow* top_win = GetBamfWindowForXid(GetTopWindow()); | 702 | return desktop_name_; |
41 | 704 | 703 | ||
42 | 705 | if (top_win && top_win != window) | 704 | std::vector<Window> const& our_xids = nux::XInputWindow::NativeHandleList(); |
43 | 706 | { | 705 | |
44 | 707 | window = top_win; | 706 | if (std::find(our_xids.begin(), our_xids.end(), window_xid) != our_xids.end()) |
45 | 708 | } | 707 | { |
46 | 709 | else | 708 | /* If the active window is an unity window, we need to fallback to the |
47 | 710 | { | 709 | * top one, anyway we should always avoid to focus unity internal windows */ |
48 | 711 | return ""; | 710 | BamfWindow* top_win = GetBamfWindowForXid(GetTopWindow()); |
49 | 711 | |||
50 | 712 | if (top_win && top_win != window) | ||
51 | 713 | { | ||
52 | 714 | window = top_win; | ||
53 | 715 | } | ||
54 | 716 | else | ||
55 | 717 | { | ||
56 | 718 | return ""; | ||
57 | 719 | } | ||
58 | 712 | } | 720 | } |
59 | 713 | } | 721 | } |
60 | 714 | 722 | ||
61 | @@ -718,7 +726,7 @@ | |||
62 | 718 | } | 726 | } |
63 | 719 | else if (!IsValidWindow(window_xid)) | 727 | else if (!IsValidWindow(window_xid)) |
64 | 720 | { | 728 | { |
66 | 721 | return ""; | 729 | return ""; |
67 | 722 | } | 730 | } |
68 | 723 | 731 | ||
69 | 724 | if (WindowManager::Default().IsWindowMaximized(window_xid) && !use_appname) | 732 | if (WindowManager::Default().IsWindowMaximized(window_xid) && !use_appname) |
70 | 725 | 733 | ||
71 | === modified file 'plugins/unityshell/src/unityshell.cpp' | |||
72 | --- plugins/unityshell/src/unityshell.cpp 2014-03-07 19:18:30 +0000 | |||
73 | +++ plugins/unityshell/src/unityshell.cpp 2014-03-12 23:00:55 +0000 | |||
74 | @@ -52,6 +52,7 @@ | |||
75 | 52 | #include "launcher/XdndStartStopNotifierImp.h" | 52 | #include "launcher/XdndStartStopNotifierImp.h" |
76 | 53 | #include "CompizShortcutModeller.h" | 53 | #include "CompizShortcutModeller.h" |
77 | 54 | #include "GnomeKeyGrabber.h" | 54 | #include "GnomeKeyGrabber.h" |
78 | 55 | #include "RawPixel.h" | ||
79 | 55 | 56 | ||
80 | 56 | #include "decorations/DecorationsDataPool.h" | 57 | #include "decorations/DecorationsDataPool.h" |
81 | 57 | #include "decorations/DecorationsManager.h" | 58 | #include "decorations/DecorationsManager.h" |
82 | @@ -137,7 +138,10 @@ | |||
83 | 137 | const unsigned int SCROLL_UP_BUTTON = 7; | 138 | const unsigned int SCROLL_UP_BUTTON = 7; |
84 | 138 | const int MAX_BUFFER_AGE = 11; | 139 | const int MAX_BUFFER_AGE = 11; |
85 | 139 | const int FRAMES_TO_REDRAW_ON_RESUME = 10; | 140 | const int FRAMES_TO_REDRAW_ON_RESUME = 10; |
86 | 141 | const RawPixel SCALE_PADDING = 40_em; | ||
87 | 142 | const RawPixel SCALE_SPACING = 20_em; | ||
88 | 140 | const std::string RELAYOUT_TIMEOUT = "relayout-timeout"; | 143 | const std::string RELAYOUT_TIMEOUT = "relayout-timeout"; |
89 | 144 | const std::string FIRST_RUN_STAMP = "first_run.stamp"; | ||
90 | 141 | } // namespace local | 145 | } // namespace local |
91 | 142 | } // anon namespace | 146 | } // anon namespace |
92 | 143 | 147 | ||
93 | @@ -267,6 +271,7 @@ | |||
94 | 267 | ScreenInterface::setHandler(screen); | 271 | ScreenInterface::setHandler(screen); |
95 | 268 | CompositeScreenInterface::setHandler(cScreen); | 272 | CompositeScreenInterface::setHandler(cScreen); |
96 | 269 | GLScreenInterface::setHandler(gScreen); | 273 | GLScreenInterface::setHandler(gScreen); |
97 | 274 | ScaleScreenInterface::setHandler(sScreen); | ||
98 | 270 | 275 | ||
99 | 271 | PluginAdapter::Initialize(screen); | 276 | PluginAdapter::Initialize(screen); |
100 | 272 | AddChild(&WindowManager::Default()); | 277 | AddChild(&WindowManager::Default()); |
101 | @@ -878,9 +883,8 @@ | |||
102 | 878 | if (CompWindow* window = screen->findWindow(target->xid)) | 883 | if (CompWindow* window = screen->findWindow(target->xid)) |
103 | 879 | { | 884 | { |
104 | 880 | UnityWindow *unity_window = UnityWindow::get(window); | 885 | UnityWindow *unity_window = UnityWindow::get(window); |
105 | 881 | double scale = target->result.width / static_cast<double>(target->geo.width); | ||
106 | 882 | double parent_alpha = switcher_controller_->Opacity(); | 886 | double parent_alpha = switcher_controller_->Opacity(); |
108 | 883 | unity_window->paintThumbnail(target->result, target->alpha, parent_alpha, scale, | 887 | unity_window->paintThumbnail(target->result, target->alpha, parent_alpha, target->scale, |
109 | 884 | target->decoration_height, target->selected); | 888 | target->decoration_height, target->selected); |
110 | 885 | } | 889 | } |
111 | 886 | } | 890 | } |
112 | @@ -3603,7 +3607,77 @@ | |||
113 | 3603 | ScheduleRelayout(500); | 3607 | ScheduleRelayout(500); |
114 | 3604 | } | 3608 | } |
115 | 3605 | 3609 | ||
117 | 3606 | void UnityScreen::OnDashRealized () | 3610 | bool UnityScreen::layoutSlotsAndAssignWindows() |
118 | 3611 | { | ||
119 | 3612 | auto const& scaled_windows = sScreen->getWindows(); | ||
120 | 3613 | |||
121 | 3614 | for (auto const& output : screen->outputDevs()) | ||
122 | 3615 | { | ||
123 | 3616 | ui::LayoutWindow::Vector layout_windows; | ||
124 | 3617 | int monitor = UScreen::GetDefault()->GetMonitorAtPosition(output.centerX(), output.centerY()); | ||
125 | 3618 | double monitor_scale = unity_settings_.em(monitor)->DPIScale(); | ||
126 | 3619 | |||
127 | 3620 | for (ScaleWindow *sw : scaled_windows) | ||
128 | 3621 | { | ||
129 | 3622 | if (sw->window->outputDevice() == static_cast<int>(output.id())) | ||
130 | 3623 | { | ||
131 | 3624 | UnityWindow::get(sw->window)->deco_win_->scaled = true; | ||
132 | 3625 | layout_windows.emplace_back(std::make_shared<LayoutWindow>(sw->window->id())); | ||
133 | 3626 | } | ||
134 | 3627 | } | ||
135 | 3628 | |||
136 | 3629 | auto max_bounds = NuxGeometryFromCompRect(output.workArea()); | ||
137 | 3630 | |||
138 | 3631 | if (launcher_controller_->options()->hide_mode != LAUNCHER_HIDE_NEVER) | ||
139 | 3632 | { | ||
140 | 3633 | int monitor_width = unity_settings_.LauncherWidth(monitor); | ||
141 | 3634 | max_bounds.x += monitor_width; | ||
142 | 3635 | max_bounds.width -= monitor_width; | ||
143 | 3636 | } | ||
144 | 3637 | |||
145 | 3638 | nux::Geometry final_bounds; | ||
146 | 3639 | ui::LayoutSystem layout; | ||
147 | 3640 | layout.max_row_height = max_bounds.height; | ||
148 | 3641 | layout.spacing = local::SCALE_SPACING.CP(monitor_scale); | ||
149 | 3642 | int padding = local::SCALE_PADDING.CP(monitor_scale); | ||
150 | 3643 | max_bounds.Expand(-padding, -padding); | ||
151 | 3644 | layout.LayoutWindows(layout_windows, max_bounds, final_bounds); | ||
152 | 3645 | |||
153 | 3646 | auto lw_it = layout_windows.begin(); | ||
154 | 3647 | for (auto const& sw : scaled_windows) | ||
155 | 3648 | { | ||
156 | 3649 | if (lw_it == layout_windows.end()) | ||
157 | 3650 | break; | ||
158 | 3651 | |||
159 | 3652 | LayoutWindow::Ptr const& lw = *lw_it; | ||
160 | 3653 | |||
161 | 3654 | if (sw->window->id() != lw->xid) | ||
162 | 3655 | continue; | ||
163 | 3656 | |||
164 | 3657 | ScaleSlot slot(CompRectFromNuxGeo(lw->result)); | ||
165 | 3658 | slot.scale = lw->scale; | ||
166 | 3659 | |||
167 | 3660 | float sx = lw->geo.width * slot.scale; | ||
168 | 3661 | float sy = lw->geo.height * slot.scale; | ||
169 | 3662 | float cx = (slot.x1() + slot.x2()) / 2; | ||
170 | 3663 | float cy = (slot.y1() + slot.y2()) / 2; | ||
171 | 3664 | |||
172 | 3665 | CompWindow *w = sw->window; | ||
173 | 3666 | cx += w->input().left * slot.scale; | ||
174 | 3667 | cy += w->input().top * slot.scale; | ||
175 | 3668 | |||
176 | 3669 | slot.setGeometry(cx - sx / 2, cy - sy / 2, sx, sy); | ||
177 | 3670 | slot.filled = true; | ||
178 | 3671 | |||
179 | 3672 | sw->setSlot(slot); | ||
180 | 3673 | ++lw_it; | ||
181 | 3674 | } | ||
182 | 3675 | } | ||
183 | 3676 | |||
184 | 3677 | return true; | ||
185 | 3678 | } | ||
186 | 3679 | |||
187 | 3680 | void UnityScreen::OnDashRealized() | ||
188 | 3607 | { | 3681 | { |
189 | 3608 | /* stack any windows named "onboard" above us */ | 3682 | /* stack any windows named "onboard" above us */ |
190 | 3609 | for (CompWindow *w : screen->windows ()) | 3683 | for (CompWindow *w : screen->windows ()) |
191 | @@ -3663,6 +3737,7 @@ | |||
192 | 3663 | auto shortcuts_modeller = std::make_shared<shortcut::CompizModeller>(); | 3737 | auto shortcuts_modeller = std::make_shared<shortcut::CompizModeller>(); |
193 | 3664 | shortcut_controller_ = std::make_shared<shortcut::Controller>(base_window_raiser, shortcuts_modeller); | 3738 | shortcut_controller_ = std::make_shared<shortcut::Controller>(base_window_raiser, shortcuts_modeller); |
194 | 3665 | AddChild(shortcut_controller_.get()); | 3739 | AddChild(shortcut_controller_.get()); |
195 | 3740 | ShowFirstRunHints(); | ||
196 | 3666 | 3741 | ||
197 | 3667 | // Setup Session Controller | 3742 | // Setup Session Controller |
198 | 3668 | auto manager = std::make_shared<session::GnomeManager>(); | 3743 | auto manager = std::make_shared<session::GnomeManager>(); |
199 | @@ -3742,6 +3817,41 @@ | |||
200 | 3742 | return menus_->KeyGrabber()->GetActions(); | 3817 | return menus_->KeyGrabber()->GetActions(); |
201 | 3743 | } | 3818 | } |
202 | 3744 | 3819 | ||
203 | 3820 | void UnityScreen::ShowFirstRunHints() | ||
204 | 3821 | { | ||
205 | 3822 | sources_.AddTimeoutSeconds(1, [this] { | ||
206 | 3823 | auto const& cache_dir = glib::gchar_to_string(g_get_user_cache_dir())+"/unity/"; | ||
207 | 3824 | if (!g_file_test((cache_dir+local::FIRST_RUN_STAMP).c_str(), G_FILE_TEST_EXISTS)) | ||
208 | 3825 | { | ||
209 | 3826 | // We focus the panel, so the shortcut hint will be hidden at first user input | ||
210 | 3827 | auto const& panels = panel_controller_->panels(); | ||
211 | 3828 | if (!panels.empty()) | ||
212 | 3829 | { | ||
213 | 3830 | auto panel_win = static_cast<nux::BaseWindow*>(panels.front()->GetTopLevelViewWindow()); | ||
214 | 3831 | SaveInputThenFocus(panel_win->GetInputWindowId()); | ||
215 | 3832 | } | ||
216 | 3833 | shortcut_controller_->first_run = true; | ||
217 | 3834 | shortcut_controller_->Show(); | ||
218 | 3835 | |||
219 | 3836 | if (g_mkdir_with_parents(cache_dir.c_str(), 0700) >= 0) | ||
220 | 3837 | { | ||
221 | 3838 | glib::Error error; | ||
222 | 3839 | g_file_set_contents((cache_dir+local::FIRST_RUN_STAMP).c_str(), "", 0, &error); | ||
223 | 3840 | |||
224 | 3841 | if (error) | ||
225 | 3842 | { | ||
226 | 3843 | LOG_ERROR(logger) << "Impossible to save the unity stamp file: " << error; | ||
227 | 3844 | } | ||
228 | 3845 | } | ||
229 | 3846 | else | ||
230 | 3847 | { | ||
231 | 3848 | LOG_ERROR(logger) << "Impossible to create unity cache folder!"; | ||
232 | 3849 | } | ||
233 | 3850 | } | ||
234 | 3851 | return false; | ||
235 | 3852 | }); | ||
236 | 3853 | } | ||
237 | 3854 | |||
238 | 3745 | /* Window init */ | 3855 | /* Window init */ |
239 | 3746 | 3856 | ||
240 | 3747 | namespace | 3857 | namespace |
241 | 3748 | 3858 | ||
242 | === modified file 'plugins/unityshell/src/unityshell.h' | |||
243 | --- plugins/unityshell/src/unityshell.h 2014-03-07 03:37:43 +0000 | |||
244 | +++ plugins/unityshell/src/unityshell.h 2014-03-12 23:00:55 +0000 | |||
245 | @@ -109,6 +109,7 @@ | |||
246 | 109 | public ScreenInterface, | 109 | public ScreenInterface, |
247 | 110 | public CompositeScreenInterface, | 110 | public CompositeScreenInterface, |
248 | 111 | public GLScreenInterface, | 111 | public GLScreenInterface, |
249 | 112 | public ScaleScreenInterface, | ||
250 | 112 | public BaseSwitchScreen, | 113 | public BaseSwitchScreen, |
251 | 113 | public PluginClassHandler <UnityScreen, CompScreen>, | 114 | public PluginClassHandler <UnityScreen, CompScreen>, |
252 | 114 | public CompAction::Container, | 115 | public CompAction::Container, |
253 | @@ -172,6 +173,9 @@ | |||
254 | 172 | void enterShowDesktopMode (); | 173 | void enterShowDesktopMode (); |
255 | 173 | void leaveShowDesktopMode (CompWindow *w); | 174 | void leaveShowDesktopMode (CompWindow *w); |
256 | 174 | 175 | ||
257 | 176 | /* window scaling */ | ||
258 | 177 | bool layoutSlotsAndAssignWindows(); | ||
259 | 178 | |||
260 | 175 | bool showMenuBarInitiate(CompAction* action, CompAction::State state, CompOption::Vector& options); | 179 | bool showMenuBarInitiate(CompAction* action, CompAction::State state, CompOption::Vector& options); |
261 | 176 | bool showMenuBarTerminate(CompAction* action, CompAction::State state, CompOption::Vector& options); | 180 | bool showMenuBarTerminate(CompAction* action, CompAction::State state, CompOption::Vector& options); |
262 | 177 | bool showLauncherKeyInitiate(CompAction* action, CompAction::State state, CompOption::Vector& options); | 181 | bool showLauncherKeyInitiate(CompAction* action, CompAction::State state, CompOption::Vector& options); |
263 | @@ -306,6 +310,8 @@ | |||
264 | 306 | 310 | ||
265 | 307 | void DamageBlurUpdateRegion(nux::Geometry const&); | 311 | void DamageBlurUpdateRegion(nux::Geometry const&); |
266 | 308 | 312 | ||
267 | 313 | void ShowFirstRunHints(); | ||
268 | 314 | |||
269 | 309 | std::unique_ptr<na::TickSource> tick_source_; | 315 | std::unique_ptr<na::TickSource> tick_source_; |
270 | 310 | std::unique_ptr<na::AnimationController> animation_controller_; | 316 | std::unique_ptr<na::AnimationController> animation_controller_; |
271 | 311 | 317 | ||
272 | 312 | 318 | ||
273 | === modified file 'shortcuts/ShortcutController.cpp' | |||
274 | --- shortcuts/ShortcutController.cpp 2013-11-20 21:39:40 +0000 | |||
275 | +++ shortcuts/ShortcutController.cpp 2014-03-12 23:00:55 +0000 | |||
276 | @@ -37,7 +37,8 @@ | |||
277 | 37 | 37 | ||
278 | 38 | Controller::Controller(BaseWindowRaiser::Ptr const& base_window_raiser, | 38 | Controller::Controller(BaseWindowRaiser::Ptr const& base_window_raiser, |
279 | 39 | AbstractModeller::Ptr const& modeller) | 39 | AbstractModeller::Ptr const& modeller) |
281 | 40 | : modeller_(modeller) | 40 | : first_run(false) |
282 | 41 | , modeller_(modeller) | ||
283 | 41 | , base_window_raiser_(base_window_raiser) | 42 | , base_window_raiser_(base_window_raiser) |
284 | 42 | , visible_(false) | 43 | , visible_(false) |
285 | 43 | , enabled_(true) | 44 | , enabled_(true) |
286 | @@ -155,6 +156,7 @@ | |||
287 | 155 | AddChild(view_.GetPointer()); | 156 | AddChild(view_.GetPointer()); |
288 | 156 | view_->SetModel(modeller_->GetCurrentModel()); | 157 | view_->SetModel(modeller_->GetCurrentModel()); |
289 | 157 | view_->background_color = WindowManager::Default().average_color(); | 158 | view_->background_color = WindowManager::Default().average_color(); |
290 | 159 | view_->closable = first_run(); | ||
291 | 158 | 160 | ||
292 | 159 | if (!view_window_) | 161 | if (!view_window_) |
293 | 160 | { | 162 | { |
294 | @@ -197,6 +199,8 @@ | |||
295 | 197 | if (view_window_ && view_window_->GetOpacity() > 0.0f) | 199 | if (view_window_ && view_window_->GetOpacity() > 0.0f) |
296 | 198 | { | 200 | { |
297 | 199 | view_->live_background = false; | 201 | view_->live_background = false; |
298 | 202 | view_->closable = false; | ||
299 | 203 | first_run = false; | ||
300 | 200 | animation::StartOrReverse(fade_animator_, animation::Direction::BACKWARD); | 204 | animation::StartOrReverse(fade_animator_, animation::Direction::BACKWARD); |
301 | 201 | } | 205 | } |
302 | 202 | } | 206 | } |
303 | 203 | 207 | ||
304 | === modified file 'shortcuts/ShortcutController.h' | |||
305 | --- shortcuts/ShortcutController.h 2013-11-14 00:17:19 +0000 | |||
306 | +++ shortcuts/ShortcutController.h 2014-03-12 23:00:55 +0000 | |||
307 | @@ -47,6 +47,8 @@ | |||
308 | 47 | Controller(BaseWindowRaiser::Ptr const& raiser, AbstractModeller::Ptr const& modeller); | 47 | Controller(BaseWindowRaiser::Ptr const& raiser, AbstractModeller::Ptr const& modeller); |
309 | 48 | virtual ~Controller(); | 48 | virtual ~Controller(); |
310 | 49 | 49 | ||
311 | 50 | nux::Property<bool> first_run; | ||
312 | 51 | |||
313 | 50 | bool Show(); | 52 | bool Show(); |
314 | 51 | void Hide(); | 53 | void Hide(); |
315 | 52 | 54 | ||
316 | 53 | 55 | ||
317 | === modified file 'tests/test_layout_system.cpp' | |||
318 | --- tests/test_layout_system.cpp 2013-10-14 17:36:51 +0000 | |||
319 | +++ tests/test_layout_system.cpp 2014-03-12 23:00:55 +0000 | |||
320 | @@ -57,6 +57,7 @@ | |||
321 | 57 | EXPECT_EQ(lwin.geo, fake_window->geo); | 57 | EXPECT_EQ(lwin.geo, fake_window->geo); |
322 | 58 | EXPECT_EQ(lwin.decoration_height, 0); | 58 | EXPECT_EQ(lwin.decoration_height, 0); |
323 | 59 | EXPECT_EQ(lwin.selected, false); | 59 | EXPECT_EQ(lwin.selected, false); |
324 | 60 | EXPECT_FLOAT_EQ(lwin.scale, 1.0f); | ||
325 | 60 | EXPECT_EQ(lwin.aspect_ratio, fake_window->geo().width / static_cast<float>(fake_window->geo().height)); | 61 | EXPECT_EQ(lwin.aspect_ratio, fake_window->geo().width / static_cast<float>(fake_window->geo().height)); |
326 | 61 | } | 62 | } |
327 | 62 | 63 | ||
328 | 63 | 64 | ||
329 | === modified file 'tests/test_shortcut_controller.cpp' | |||
330 | --- tests/test_shortcut_controller.cpp 2013-09-25 00:48:03 +0000 | |||
331 | +++ tests/test_shortcut_controller.cpp 2014-03-12 23:00:55 +0000 | |||
332 | @@ -68,6 +68,7 @@ | |||
333 | 68 | MOCK_METHOD1(SetOpacity, void(double)); | 68 | MOCK_METHOD1(SetOpacity, void(double)); |
334 | 69 | using Controller::GetOffsetPerMonitor; | 69 | using Controller::GetOffsetPerMonitor; |
335 | 70 | using Controller::ConstructView; | 70 | using Controller::ConstructView; |
336 | 71 | using Controller::OnShowTimer; | ||
337 | 71 | using Controller::view_; | 72 | using Controller::view_; |
338 | 72 | 73 | ||
339 | 73 | void RealSetOpacity(double value) | 74 | void RealSetOpacity(double value) |
340 | @@ -188,5 +189,37 @@ | |||
341 | 188 | color_property.changed.emit(nux::color::RandomColor()); | 189 | color_property.changed.emit(nux::color::RandomColor()); |
342 | 189 | } | 190 | } |
343 | 190 | 191 | ||
344 | 192 | TEST_F(TestShortcutController, FirstRunFalse) | ||
345 | 193 | { | ||
346 | 194 | ASSERT_FALSE(controller_.first_run()); | ||
347 | 195 | |||
348 | 196 | controller_.ConstructView(); | ||
349 | 197 | EXPECT_FALSE(controller_.view_->closable()); | ||
350 | 198 | } | ||
351 | 199 | |||
352 | 200 | TEST_F(TestShortcutController, FirstRunTrue) | ||
353 | 201 | { | ||
354 | 202 | ASSERT_FALSE(controller_.first_run()); | ||
355 | 203 | |||
356 | 204 | controller_.first_run = true; | ||
357 | 205 | controller_.ConstructView(); | ||
358 | 206 | EXPECT_TRUE(controller_.view_->closable()); | ||
359 | 207 | } | ||
360 | 208 | |||
361 | 209 | TEST_F(TestShortcutController, UnsetFirstRunOnHide) | ||
362 | 210 | { | ||
363 | 211 | controller_.first_run = true; | ||
364 | 212 | controller_.ConstructView(); | ||
365 | 213 | |||
366 | 214 | ASSERT_TRUE(controller_.view_->closable()); | ||
367 | 215 | controller_.Show(); | ||
368 | 216 | controller_.OnShowTimer(); | ||
369 | 217 | tick_source_.tick(100 * 1000); | ||
370 | 218 | controller_.Hide(); | ||
371 | 219 | |||
372 | 220 | EXPECT_FALSE(controller_.first_run()); | ||
373 | 221 | EXPECT_FALSE(controller_.view_->closable()); | ||
374 | 222 | } | ||
375 | 223 | |||
376 | 191 | } | 224 | } |
377 | 192 | } | 225 | } |
378 | 193 | 226 | ||
379 | === modified file 'unity-shared/LayoutSystem.cpp' | |||
380 | --- unity-shared/LayoutSystem.cpp 2013-09-19 16:44:03 +0000 | |||
381 | +++ unity-shared/LayoutSystem.cpp 2014-03-12 23:00:55 +0000 | |||
382 | @@ -125,12 +125,12 @@ | |||
383 | 125 | for (LayoutWindow::Ptr const& window : row) | 125 | for (LayoutWindow::Ptr const& window : row) |
384 | 126 | { | 126 | { |
385 | 127 | // we dont allow scaling up | 127 | // we dont allow scaling up |
387 | 128 | float final_scalar = std::min(1.0f, (unpadded_bounds.height / (float)window->geo.height) * global_scalar); | 128 | window->scale = std::min(1.0f, (unpadded_bounds.height / (float)window->geo.height) * global_scalar); |
388 | 129 | 129 | ||
389 | 130 | window->result.x = x; | 130 | window->result.x = x; |
390 | 131 | window->result.y = y; | 131 | window->result.y = y; |
393 | 132 | window->result.width = window->geo.width * final_scalar; | 132 | window->result.width = window->geo.width * window->scale; |
394 | 133 | window->result.height = window->geo.height * final_scalar; | 133 | window->result.height = window->geo.height * window->scale; |
395 | 134 | 134 | ||
396 | 135 | x += window->result.width; | 135 | x += window->result.width; |
397 | 136 | } | 136 | } |
398 | @@ -275,6 +275,7 @@ | |||
399 | 275 | , decoration_height(0) | 275 | , decoration_height(0) |
400 | 276 | , selected(false) | 276 | , selected(false) |
401 | 277 | , aspect_ratio(geo.width / static_cast<float>(geo.height)) | 277 | , aspect_ratio(geo.width / static_cast<float>(geo.height)) |
402 | 278 | , scale(1.0f) | ||
403 | 278 | , alpha(0.0f) | 279 | , alpha(0.0f) |
404 | 279 | { | 280 | { |
405 | 280 | auto& wm = WindowManager::Default(); | 281 | auto& wm = WindowManager::Default(); |
406 | 281 | 282 | ||
407 | === modified file 'unity-shared/LayoutSystem.h' | |||
408 | --- unity-shared/LayoutSystem.h 2013-09-19 16:44:03 +0000 | |||
409 | +++ unity-shared/LayoutSystem.h 2014-03-12 23:00:55 +0000 | |||
410 | @@ -46,6 +46,7 @@ | |||
411 | 46 | 46 | ||
412 | 47 | bool selected; | 47 | bool selected; |
413 | 48 | float aspect_ratio; | 48 | float aspect_ratio; |
414 | 49 | float scale; | ||
415 | 49 | float alpha; | 50 | float alpha; |
416 | 50 | 51 | ||
417 | 51 | protected: | 52 | protected: |
PASSED: Continuous integration, rev:3704 jenkins. qa.ubuntu. com/job/ unity-ci/ 779/ jenkins. qa.ubuntu. com/job/ unity-trusty- amd64-ci/ 315 jenkins. qa.ubuntu. com/job/ unity-trusty- armhf-ci/ 311 jenkins. qa.ubuntu. com/job/ unity-trusty- i386-ci/ 313
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
Click here to trigger a rebuild: s-jenkins. ubuntu- ci:8080/ job/unity- ci/779/ rebuild
http://