Merge lp:~unity-team/unity/trusty-1349281 into lp:unity/7.2

Proposed by Stephen M. Webb
Status: Rejected
Rejected by: Stephen M. Webb
Proposed branch: lp:~unity-team/unity/trusty-1349281
Merge into: lp:unity/7.2
Diff against target: 130 lines (+45/-16)
4 files modified
debian/changelog (+7/-0)
plugins/unityshell/src/unityshell.cpp (+8/-11)
unity-shared/LayoutSystem.cpp (+28/-4)
unity-shared/LayoutSystem.h (+2/-1)
To merge this branch: bzr merge lp:~unity-team/unity/trusty-1349281
Reviewer Review Type Date Requested Status
Unity Team Pending
Review via email: mp+244135@code.launchpad.net

Commit message

LayoutSystem: make sure the exposed open windows are displayed in the preserved order

Description of the change

LayoutSystem: make sure the exposed open windows are displayed in the "correct" order

In expose mode the windows were placed in z-order starting by the top-most window that was always put in the bottom right corner. After the change the windows are placed in a similar order to their initial one.

This change is cherry-picked from trunk for SRUing into Ubuntu 14.04 LTS.

To post a comment you must log in.

Unmerged revisions

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'debian/changelog'
2--- debian/changelog 2014-08-26 13:49:00 +0000
3+++ debian/changelog 2014-12-09 14:10:31 +0000
4@@ -1,3 +1,10 @@
5+unity (7.2.3+14.04.20140826-0ubuntu2) UNRELEASED; urgency=medium
6+
7+ * LayoutSystem: make sure the exposed open windows are displayed in the
8+ preserved order (lp: #1349281).
9+
10+ -- Eleni Maria Stea <elenimaria.stea@canonical.com> Tue, 09 Dec 2014 09:05:01 -0500
11+
12 unity (7.2.3+14.04.20140826-0ubuntu1) trusty; urgency=medium
13
14 [ Andrea Azzarone ]
15
16=== modified file 'plugins/unityshell/src/unityshell.cpp'
17--- plugins/unityshell/src/unityshell.cpp 2014-08-06 14:19:10 +0000
18+++ plugins/unityshell/src/unityshell.cpp 2014-12-09 14:10:31 +0000
19@@ -3715,7 +3715,6 @@
20 }
21
22 auto max_bounds = NuxGeometryFromCompRect(output.workArea());
23-
24 if (launcher_controller_->options()->hide_mode != LAUNCHER_HIDE_NEVER)
25 {
26 int monitor_width = unity_settings_.LauncherWidth(monitor);
27@@ -3729,19 +3728,18 @@
28 layout.spacing = local::SCALE_SPACING.CP(monitor_scale);
29 int padding = local::SCALE_PADDING.CP(monitor_scale);
30 max_bounds.Expand(-padding, -padding);
31- layout.LayoutWindows(layout_windows, max_bounds, final_bounds);
32+ layout.LayoutWindowsNearest(layout_windows, max_bounds, final_bounds);
33
34- auto lw_it = layout_windows.begin();
35- for (auto const& sw : scaled_windows)
36+ for (auto const& lw : layout_windows)
37 {
38- if (lw_it == layout_windows.end())
39- break;
40-
41- LayoutWindow::Ptr const& lw = *lw_it;
42-
43- if (sw->window->id() != lw->xid)
44+ auto sw_it = std::find_if(scaled_windows.begin(), scaled_windows.end(), [&lw] (ScaleWindow* sw) {
45+ return sw->window->id() == lw->xid;
46+ });
47+
48+ if (sw_it == scaled_windows.end())
49 continue;
50
51+ ScaleWindow* sw = *sw_it;
52 ScaleSlot slot(CompRectFromNuxGeo(lw->result));
53 slot.scale = lw->scale;
54
55@@ -3758,7 +3756,6 @@
56 slot.filled = true;
57
58 sw->setSlot(slot);
59- ++lw_it;
60 }
61 }
62
63
64=== modified file 'unity-shared/LayoutSystem.cpp'
65--- unity-shared/LayoutSystem.cpp 2014-03-10 13:17:01 +0000
66+++ unity-shared/LayoutSystem.cpp 2014-12-09 14:10:31 +0000
67@@ -32,7 +32,33 @@
68 if (windows.empty())
69 return;
70
71- LayoutGridWindows(windows, max_bounds, final_bounds);
72+ LayoutGridWindows(windows, GetRows(windows, max_bounds), max_bounds, final_bounds);
73+}
74+
75+void LayoutSystem::LayoutWindowsNearest(LayoutWindow::Vector& windows, nux::Geometry const& max_bounds, nux::Geometry& final_bounds)
76+{
77+ if (windows.empty())
78+ return;
79+
80+ std::stable_sort(windows.begin(), windows.end(), [](LayoutWindow::Ptr const& a, LayoutWindow::Ptr const& b) {
81+ return a->geo.y < b->geo.y;
82+ });
83+
84+ std::vector<LayoutWindow::Vector> rows = GetRows(windows, max_bounds);
85+ LayoutWindow::Vector ordered_windows;
86+
87+ for (auto& row : rows)
88+ {
89+ std::stable_sort(row.begin(), row.end(), [](LayoutWindow::Ptr const& a, LayoutWindow::Ptr const& b) {
90+ return (a->geo.x + a->geo.width / 2) < (b->geo.x + b->geo.width / 2);
91+ });
92+
93+ for (auto const& win : row)
94+ ordered_windows.push_back(win);
95+ }
96+
97+ LayoutGridWindows(ordered_windows, rows, max_bounds, final_bounds);
98+ windows = ordered_windows;
99 }
100
101 nux::Size LayoutSystem::GridSizeForWindows(LayoutWindow::Vector const& windows, nux::Geometry const& max_bounds) const
102@@ -229,10 +255,8 @@
103 return rows;
104 }
105
106-void LayoutSystem::LayoutGridWindows(LayoutWindow::Vector const& windows, nux::Geometry const& max_bounds, nux::Geometry& final_bounds)
107+void LayoutSystem::LayoutGridWindows(LayoutWindow::Vector const& windows, std::vector<LayoutWindow::Vector> const& rows, nux::Geometry const& max_bounds, nux::Geometry& final_bounds)
108 {
109- std::vector<LayoutWindow::Vector> const& rows = GetRows(windows, max_bounds);
110-
111 int height = rows.size();
112 int non_spacing_height = max_bounds.height - ((height - 1) * spacing);
113 int row_height = std::min (max_row_height(), non_spacing_height / height);
114
115=== modified file 'unity-shared/LayoutSystem.h'
116--- unity-shared/LayoutSystem.h 2014-03-10 13:17:01 +0000
117+++ unity-shared/LayoutSystem.h 2014-12-09 14:10:31 +0000
118@@ -64,10 +64,11 @@
119 LayoutSystem();
120
121 void LayoutWindows(LayoutWindow::Vector const& windows, nux::Geometry const& max_bounds, nux::Geometry& final_bounds);
122+ void LayoutWindowsNearest(LayoutWindow::Vector& windows, nux::Geometry const& max_bounds, nux::Geometry& final_bounds);
123 std::vector<int> GetRowSizes(LayoutWindow::Vector const& windows, nux::Geometry const& max_bounds) const;
124
125 protected:
126- void LayoutGridWindows(LayoutWindow::Vector const& windows, nux::Geometry const& max_bounds, nux::Geometry& final_bounds);
127+ void LayoutGridWindows(LayoutWindow::Vector const& windows, std::vector<LayoutWindow::Vector> const& rows, nux::Geometry const& max_bounds, nux::Geometry& final_bounds);
128
129 nux::Geometry LayoutRow(LayoutWindow::Vector const& row, nux::Geometry const& row_bounds);
130 nux::Geometry CompressAndPadRow(LayoutWindow::Vector const& windows, nux::Geometry const& max_bounds);

Subscribers

People subscribed via source and target branches

to all changes:
to status/vote changes: