Merge lp:~3v1n0/unity/panel-spread-fixes into lp:unity

Proposed by Marco Trevisan (Treviño) on 2014-10-24
Status: Merged
Approved by: Christopher Townsend on 2014-11-04
Approved revision: 3890
Merged at revision: 3889
Proposed branch: lp:~3v1n0/unity/panel-spread-fixes
Merge into: lp:unity
Prerequisite: lp:~3v1n0/unity/scaled-windows-filtering-out-reset
Diff against target: 275 lines (+60/-40)
4 files modified
panel/PanelMenuView.cpp (+55/-36)
panel/PanelMenuView.h (+1/-1)
plugins/unityshell/src/unityshell.cpp (+1/-1)
unity-shared/PluginAdapter.cpp (+3/-2)
To merge this branch: bzr merge lp:~3v1n0/unity/panel-spread-fixes
Reviewer Review Type Date Requested Status
Christopher Townsend 2014-10-24 Approve on 2014-11-04
PS Jenkins bot (community) continuous-integration 2014-10-24 Approve on 2014-10-24
Review via email: mp+239588@code.launchpad.net

This proposal supersedes a proposal from 2014-10-24.

Commit message

PanelMenuView: ensure that proper window tiles and buttons are shown at the right place

To post a comment you must log in.
PS Jenkins bot (ps-jenkins) wrote : Posted in a previous version of this proposal
review: Approve (continuous-integration)
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Christopher Townsend (townsend) wrote :

+1

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'panel/PanelMenuView.cpp'
2--- panel/PanelMenuView.cpp 2014-09-17 03:48:40 +0000
3+++ panel/PanelMenuView.cpp 2014-10-24 16:32:57 +0000
4@@ -275,6 +275,9 @@
5 if (!mouse_inside)
6 return nullptr;
7
8+ if (WindowManager::Default().IsExpoActive())
9+ return nullptr;
10+
11 Area* found_area = nullptr;
12
13 if (!integrated_menus_ && !we_control_active_ && !spread_showing_)
14@@ -386,14 +389,12 @@
15
16 bool PanelMenuView::ShouldDrawButtons() const
17 {
18+ if (spread_showing_)
19+ return true;
20+
21 if (integrated_menus_)
22 {
23- if (spread_showing_)
24- return true;
25-
26- WindowManager& wm = WindowManager::Default();
27-
28- if (!wm.IsExpoActive() && !wm.IsScaleActive())
29+ if (!WindowManager::Default().IsExpoActive())
30 return (GetMaximizedWindow() != 0);
31
32 return false;
33@@ -401,9 +402,7 @@
34
35 if (we_control_active_ && is_maximized_ && !launcher_keynav_ && !switcher_showing_)
36 {
37- WindowManager& wm = WindowManager::Default();
38-
39- if (!wm.IsExpoActive())
40+ if (!WindowManager::Default().IsExpoActive())
41 {
42 if (is_inside_ || show_now_activated_ || new_application_)
43 return true;
44@@ -413,9 +412,6 @@
45 }
46 }
47
48- if (spread_showing_)
49- return true;
50-
51 return false;
52 }
53
54@@ -821,7 +817,7 @@
55 auto state = WidgetState::NORMAL;
56 float dpi_scale = Settings::Instance().em(monitor_)->DPIScale();
57
58- if (integrated_menus_ && !is_desktop_focused_ && !WindowManager::Default().IsScaleActive())
59+ if (integrated_menus_ && !is_desktop_focused_ && !WindowManager::Default().IsExpoActive())
60 {
61 title_geo_.x = geo.x + window_buttons_->GetBaseWidth() + (style->TitleIndent() * dpi_scale);
62
63@@ -854,10 +850,9 @@
64 {
65 if (integrated_menus_ || (!switcher_showing_ && !launcher_keynav_))
66 {
67- WindowManager& wm = WindowManager::Default();
68 std::string new_title;
69
70- if (wm.IsExpoActive())
71+ if (WindowManager::Default().IsExpoActive())
72 {
73 new_title = desktop_name_;
74 }
75@@ -1129,7 +1124,10 @@
76 }
77
78 if (is_maximized_)
79- maximized_set_.insert(active_xid_);
80+ {
81+ maximized_wins_.erase(std::remove(maximized_wins_.begin(), maximized_wins_.end(), active_xid_), maximized_wins_.end());
82+ maximized_wins_.push_front(active_xid_);
83+ }
84
85 // register callback for new view
86 view_name_changed_signal_.Connect(new_view, "name-changed",
87@@ -1185,7 +1183,7 @@
88
89 void PanelMenuView::OnWindowMinimized(Window xid)
90 {
91- maximized_set_.erase(xid);
92+ maximized_wins_.erase(std::remove(maximized_wins_.begin(), maximized_wins_.end(), xid), maximized_wins_.end());
93
94 if (xid == active_xid_)
95 {
96@@ -1201,18 +1199,24 @@
97
98 void PanelMenuView::OnWindowUnminimized(Window xid)
99 {
100- if (WindowManager::Default().IsWindowMaximized(xid))
101- maximized_set_.insert(xid);
102-
103 if (xid == active_xid_)
104 {
105+ if (WindowManager::Default().IsWindowMaximized(xid))
106+ maximized_wins_.push_front(xid);
107+
108 if (Refresh())
109 QueueDraw();
110 }
111- else if (integrated_menus_ && IsWindowUnderOurControl(xid))
112+ else
113 {
114- if (Refresh())
115- QueueDraw();
116+ if (WindowManager::Default().IsWindowMaximized(xid))
117+ maximized_wins_.push_back(xid);
118+
119+ if (integrated_menus_ && IsWindowUnderOurControl(xid))
120+ {
121+ if (Refresh())
122+ QueueDraw();
123+ }
124 }
125 }
126
127@@ -1220,7 +1224,7 @@
128 {
129 // FIXME: compiz doesn't give us a valid xid (is always 0 on unmap)
130 // we need to do this again on BamfView closed signal.
131- maximized_set_.erase(xid);
132+ maximized_wins_.erase(std::remove(maximized_wins_.begin(), maximized_wins_.end(), xid), maximized_wins_.end());
133
134 if (xid == active_xid_)
135 {
136@@ -1238,22 +1242,26 @@
137 {
138 if (WindowManager::Default().IsWindowMaximized(xid))
139 {
140- maximized_set_.insert(xid);
141-
142 if (xid == active_xid_)
143 {
144+ maximized_wins_.push_front(xid);
145+
146 if (Refresh())
147 QueueDraw();
148 }
149+ else
150+ {
151+ maximized_wins_.push_back(xid);
152+ }
153 }
154 }
155
156 void PanelMenuView::OnWindowMaximized(Window xid)
157 {
158- maximized_set_.insert(xid);
159-
160 if (xid == active_xid_)
161 {
162+ maximized_wins_.push_front(xid);
163+
164 // We need to update the is_inside_ state in the case of maximization by grab
165 auto mouse = nux::GetGraphicsDisplay()->GetMouseScreenCoord();
166 is_inside_ = GetAbsoluteGeometry().IsInside(mouse);
167@@ -1262,16 +1270,21 @@
168 if (Refresh())
169 FullRedraw();
170 }
171- else if (integrated_menus_ && IsWindowUnderOurControl(xid))
172+ else
173 {
174- if (Refresh())
175- QueueDraw();
176+ maximized_wins_.push_back(xid);
177+
178+ if (integrated_menus_ && IsWindowUnderOurControl(xid))
179+ {
180+ if (Refresh())
181+ QueueDraw();
182+ }
183 }
184 }
185
186 void PanelMenuView::OnWindowRestored(Window xid)
187 {
188- maximized_set_.erase(xid);
189+ maximized_wins_.erase(std::remove(maximized_wins_.begin(), maximized_wins_.end(), xid), maximized_wins_.end());
190
191 if (active_xid_ == xid)
192 {
193@@ -1370,7 +1383,7 @@
194 Window window_xid = 0;
195
196 // Find the front-most of the maximized windows we are controlling
197- for (auto xid : maximized_set_)
198+ for (auto xid : maximized_wins_)
199 {
200 // We can safely assume only the front-most is visible
201 if (IsValidWindow(xid))
202@@ -1795,8 +1808,8 @@
203 {
204 PanelIndicatorsView::SetMonitor(monitor);
205
206+ maximized_wins_.clear();
207 monitor_geo_ = UScreen::GetDefault()->GetMonitorGeometry(monitor_);
208- maximized_set_.clear();
209 GList* windows = bamf_matcher_get_window_stack_for_monitor(matcher_, monitor_);
210
211 for (GList* l = windows; l; l = l->next)
212@@ -1806,12 +1819,18 @@
213
214 auto window = static_cast<BamfWindow*>(l->data);
215 auto view = static_cast<BamfView*>(l->data);
216+ auto xid = bamf_window_get_xid(window);
217
218 if (bamf_view_is_active(view))
219- active_xid_ = bamf_window_get_xid(window);
220+ active_xid_ = xid;
221
222 if (bamf_window_maximized(window) == BAMF_WINDOW_MAXIMIZED)
223- maximized_set_.insert(bamf_window_get_xid(window));
224+ {
225+ if (xid == active_xid_)
226+ maximized_wins_.push_front(xid);
227+ else
228+ maximized_wins_.push_back(xid);
229+ }
230 }
231
232 Window maximized = GetMaximizedWindow();
233
234=== modified file 'panel/PanelMenuView.h'
235--- panel/PanelMenuView.h 2014-09-16 06:14:33 +0000
236+++ panel/PanelMenuView.h 2014-10-24 16:32:57 +0000
237@@ -170,7 +170,7 @@
238 bool is_desktop_focused_;
239
240 PanelIndicatorEntryView* last_active_view_;
241- std::set<Window> maximized_set_;
242+ std::deque<Window> maximized_wins_;
243 glib::Object<BamfApplication> new_application_;
244 std::list<glib::Object<BamfApplication>> new_apps_;
245 std::string panel_title_;
246
247=== modified file 'plugins/unityshell/src/unityshell.cpp'
248--- plugins/unityshell/src/unityshell.cpp 2014-10-24 16:32:57 +0000
249+++ plugins/unityshell/src/unityshell.cpp 2014-10-24 16:32:57 +0000
250@@ -542,7 +542,7 @@
251
252 for (auto const& swin : sScreen->getWindows())
253 {
254- if (std::find(filtered_windows.begin(), filtered_windows.end(), swin->window->id()) != filtered_windows.end())
255+ if (filtered_windows.find(swin->window->id()) != filtered_windows.end())
256 continue;
257
258 auto* uwin = UnityWindow::get(swin->window);
259
260=== modified file 'unity-shared/PluginAdapter.cpp'
261--- unity-shared/PluginAdapter.cpp 2014-08-13 23:32:39 +0000
262+++ unity-shared/PluginAdapter.cpp 2014-10-24 16:32:57 +0000
263@@ -554,9 +554,10 @@
264
265 bool PluginAdapter::IsWindowObscured(Window window_id) const
266 {
267- CompWindow* window = m_Screen->findWindow(window_id);
268+ if (_spread_state)
269+ return false;
270
271- if (window)
272+ if (CompWindow* window = m_Screen->findWindow(window_id))
273 {
274 if (window->inShowDesktopMode())
275 return true;