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

Proposed by Marco Trevisan (Treviño)
Status: Merged
Approved by: Christopher Townsend
Approved revision: no longer in the source branch.
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 Approve
PS Jenkins bot (community) continuous-integration Approve
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.
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote : Posted in a previous version of this proposal
review: Approve (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
Christopher Townsend (townsend) wrote :

+1

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'panel/PanelMenuView.cpp'
--- panel/PanelMenuView.cpp 2014-09-17 03:48:40 +0000
+++ panel/PanelMenuView.cpp 2014-10-24 16:32:57 +0000
@@ -275,6 +275,9 @@
275 if (!mouse_inside)275 if (!mouse_inside)
276 return nullptr;276 return nullptr;
277277
278 if (WindowManager::Default().IsExpoActive())
279 return nullptr;
280
278 Area* found_area = nullptr;281 Area* found_area = nullptr;
279282
280 if (!integrated_menus_ && !we_control_active_ && !spread_showing_)283 if (!integrated_menus_ && !we_control_active_ && !spread_showing_)
@@ -386,14 +389,12 @@
386389
387bool PanelMenuView::ShouldDrawButtons() const390bool PanelMenuView::ShouldDrawButtons() const
388{391{
392 if (spread_showing_)
393 return true;
394
389 if (integrated_menus_)395 if (integrated_menus_)
390 {396 {
391 if (spread_showing_)397 if (!WindowManager::Default().IsExpoActive())
392 return true;
393
394 WindowManager& wm = WindowManager::Default();
395
396 if (!wm.IsExpoActive() && !wm.IsScaleActive())
397 return (GetMaximizedWindow() != 0);398 return (GetMaximizedWindow() != 0);
398399
399 return false;400 return false;
@@ -401,9 +402,7 @@
401402
402 if (we_control_active_ && is_maximized_ && !launcher_keynav_ && !switcher_showing_)403 if (we_control_active_ && is_maximized_ && !launcher_keynav_ && !switcher_showing_)
403 {404 {
404 WindowManager& wm = WindowManager::Default();405 if (!WindowManager::Default().IsExpoActive())
405
406 if (!wm.IsExpoActive())
407 {406 {
408 if (is_inside_ || show_now_activated_ || new_application_)407 if (is_inside_ || show_now_activated_ || new_application_)
409 return true;408 return true;
@@ -413,9 +412,6 @@
413 }412 }
414 }413 }
415414
416 if (spread_showing_)
417 return true;
418
419 return false;415 return false;
420}416}
421417
@@ -821,7 +817,7 @@
821 auto state = WidgetState::NORMAL;817 auto state = WidgetState::NORMAL;
822 float dpi_scale = Settings::Instance().em(monitor_)->DPIScale();818 float dpi_scale = Settings::Instance().em(monitor_)->DPIScale();
823819
824 if (integrated_menus_ && !is_desktop_focused_ && !WindowManager::Default().IsScaleActive())820 if (integrated_menus_ && !is_desktop_focused_ && !WindowManager::Default().IsExpoActive())
825 {821 {
826 title_geo_.x = geo.x + window_buttons_->GetBaseWidth() + (style->TitleIndent() * dpi_scale);822 title_geo_.x = geo.x + window_buttons_->GetBaseWidth() + (style->TitleIndent() * dpi_scale);
827823
@@ -854,10 +850,9 @@
854{850{
855 if (integrated_menus_ || (!switcher_showing_ && !launcher_keynav_))851 if (integrated_menus_ || (!switcher_showing_ && !launcher_keynav_))
856 {852 {
857 WindowManager& wm = WindowManager::Default();
858 std::string new_title;853 std::string new_title;
859854
860 if (wm.IsExpoActive())855 if (WindowManager::Default().IsExpoActive())
861 {856 {
862 new_title = desktop_name_;857 new_title = desktop_name_;
863 }858 }
@@ -1129,7 +1124,10 @@
1129 }1124 }
11301125
1131 if (is_maximized_)1126 if (is_maximized_)
1132 maximized_set_.insert(active_xid_);1127 {
1128 maximized_wins_.erase(std::remove(maximized_wins_.begin(), maximized_wins_.end(), active_xid_), maximized_wins_.end());
1129 maximized_wins_.push_front(active_xid_);
1130 }
11331131
1134 // register callback for new view1132 // register callback for new view
1135 view_name_changed_signal_.Connect(new_view, "name-changed",1133 view_name_changed_signal_.Connect(new_view, "name-changed",
@@ -1185,7 +1183,7 @@
11851183
1186void PanelMenuView::OnWindowMinimized(Window xid)1184void PanelMenuView::OnWindowMinimized(Window xid)
1187{1185{
1188 maximized_set_.erase(xid);1186 maximized_wins_.erase(std::remove(maximized_wins_.begin(), maximized_wins_.end(), xid), maximized_wins_.end());
11891187
1190 if (xid == active_xid_)1188 if (xid == active_xid_)
1191 {1189 {
@@ -1201,18 +1199,24 @@
12011199
1202void PanelMenuView::OnWindowUnminimized(Window xid)1200void PanelMenuView::OnWindowUnminimized(Window xid)
1203{1201{
1204 if (WindowManager::Default().IsWindowMaximized(xid))
1205 maximized_set_.insert(xid);
1206
1207 if (xid == active_xid_)1202 if (xid == active_xid_)
1208 {1203 {
1204 if (WindowManager::Default().IsWindowMaximized(xid))
1205 maximized_wins_.push_front(xid);
1206
1209 if (Refresh())1207 if (Refresh())
1210 QueueDraw();1208 QueueDraw();
1211 }1209 }
1212 else if (integrated_menus_ && IsWindowUnderOurControl(xid))1210 else
1213 {1211 {
1214 if (Refresh())1212 if (WindowManager::Default().IsWindowMaximized(xid))
1215 QueueDraw();1213 maximized_wins_.push_back(xid);
1214
1215 if (integrated_menus_ && IsWindowUnderOurControl(xid))
1216 {
1217 if (Refresh())
1218 QueueDraw();
1219 }
1216 }1220 }
1217}1221}
12181222
@@ -1220,7 +1224,7 @@
1220{1224{
1221 // FIXME: compiz doesn't give us a valid xid (is always 0 on unmap)1225 // FIXME: compiz doesn't give us a valid xid (is always 0 on unmap)
1222 // we need to do this again on BamfView closed signal.1226 // we need to do this again on BamfView closed signal.
1223 maximized_set_.erase(xid);1227 maximized_wins_.erase(std::remove(maximized_wins_.begin(), maximized_wins_.end(), xid), maximized_wins_.end());
12241228
1225 if (xid == active_xid_)1229 if (xid == active_xid_)
1226 {1230 {
@@ -1238,22 +1242,26 @@
1238{1242{
1239 if (WindowManager::Default().IsWindowMaximized(xid))1243 if (WindowManager::Default().IsWindowMaximized(xid))
1240 {1244 {
1241 maximized_set_.insert(xid);
1242
1243 if (xid == active_xid_)1245 if (xid == active_xid_)
1244 {1246 {
1247 maximized_wins_.push_front(xid);
1248
1245 if (Refresh())1249 if (Refresh())
1246 QueueDraw();1250 QueueDraw();
1247 }1251 }
1252 else
1253 {
1254 maximized_wins_.push_back(xid);
1255 }
1248 }1256 }
1249}1257}
12501258
1251void PanelMenuView::OnWindowMaximized(Window xid)1259void PanelMenuView::OnWindowMaximized(Window xid)
1252{1260{
1253 maximized_set_.insert(xid);
1254
1255 if (xid == active_xid_)1261 if (xid == active_xid_)
1256 {1262 {
1263 maximized_wins_.push_front(xid);
1264
1257 // We need to update the is_inside_ state in the case of maximization by grab1265 // We need to update the is_inside_ state in the case of maximization by grab
1258 auto mouse = nux::GetGraphicsDisplay()->GetMouseScreenCoord();1266 auto mouse = nux::GetGraphicsDisplay()->GetMouseScreenCoord();
1259 is_inside_ = GetAbsoluteGeometry().IsInside(mouse);1267 is_inside_ = GetAbsoluteGeometry().IsInside(mouse);
@@ -1262,16 +1270,21 @@
1262 if (Refresh())1270 if (Refresh())
1263 FullRedraw();1271 FullRedraw();
1264 }1272 }
1265 else if (integrated_menus_ && IsWindowUnderOurControl(xid))1273 else
1266 {1274 {
1267 if (Refresh())1275 maximized_wins_.push_back(xid);
1268 QueueDraw();1276
1277 if (integrated_menus_ && IsWindowUnderOurControl(xid))
1278 {
1279 if (Refresh())
1280 QueueDraw();
1281 }
1269 }1282 }
1270}1283}
12711284
1272void PanelMenuView::OnWindowRestored(Window xid)1285void PanelMenuView::OnWindowRestored(Window xid)
1273{1286{
1274 maximized_set_.erase(xid);1287 maximized_wins_.erase(std::remove(maximized_wins_.begin(), maximized_wins_.end(), xid), maximized_wins_.end());
12751288
1276 if (active_xid_ == xid)1289 if (active_xid_ == xid)
1277 {1290 {
@@ -1370,7 +1383,7 @@
1370 Window window_xid = 0;1383 Window window_xid = 0;
13711384
1372 // Find the front-most of the maximized windows we are controlling1385 // Find the front-most of the maximized windows we are controlling
1373 for (auto xid : maximized_set_)1386 for (auto xid : maximized_wins_)
1374 {1387 {
1375 // We can safely assume only the front-most is visible1388 // We can safely assume only the front-most is visible
1376 if (IsValidWindow(xid))1389 if (IsValidWindow(xid))
@@ -1795,8 +1808,8 @@
1795{1808{
1796 PanelIndicatorsView::SetMonitor(monitor);1809 PanelIndicatorsView::SetMonitor(monitor);
17971810
1811 maximized_wins_.clear();
1798 monitor_geo_ = UScreen::GetDefault()->GetMonitorGeometry(monitor_);1812 monitor_geo_ = UScreen::GetDefault()->GetMonitorGeometry(monitor_);
1799 maximized_set_.clear();
1800 GList* windows = bamf_matcher_get_window_stack_for_monitor(matcher_, monitor_);1813 GList* windows = bamf_matcher_get_window_stack_for_monitor(matcher_, monitor_);
18011814
1802 for (GList* l = windows; l; l = l->next)1815 for (GList* l = windows; l; l = l->next)
@@ -1806,12 +1819,18 @@
18061819
1807 auto window = static_cast<BamfWindow*>(l->data);1820 auto window = static_cast<BamfWindow*>(l->data);
1808 auto view = static_cast<BamfView*>(l->data);1821 auto view = static_cast<BamfView*>(l->data);
1822 auto xid = bamf_window_get_xid(window);
18091823
1810 if (bamf_view_is_active(view))1824 if (bamf_view_is_active(view))
1811 active_xid_ = bamf_window_get_xid(window);1825 active_xid_ = xid;
18121826
1813 if (bamf_window_maximized(window) == BAMF_WINDOW_MAXIMIZED)1827 if (bamf_window_maximized(window) == BAMF_WINDOW_MAXIMIZED)
1814 maximized_set_.insert(bamf_window_get_xid(window));1828 {
1829 if (xid == active_xid_)
1830 maximized_wins_.push_front(xid);
1831 else
1832 maximized_wins_.push_back(xid);
1833 }
1815 }1834 }
18161835
1817 Window maximized = GetMaximizedWindow();1836 Window maximized = GetMaximizedWindow();
18181837
=== modified file 'panel/PanelMenuView.h'
--- panel/PanelMenuView.h 2014-09-16 06:14:33 +0000
+++ panel/PanelMenuView.h 2014-10-24 16:32:57 +0000
@@ -170,7 +170,7 @@
170 bool is_desktop_focused_;170 bool is_desktop_focused_;
171171
172 PanelIndicatorEntryView* last_active_view_;172 PanelIndicatorEntryView* last_active_view_;
173 std::set<Window> maximized_set_;173 std::deque<Window> maximized_wins_;
174 glib::Object<BamfApplication> new_application_;174 glib::Object<BamfApplication> new_application_;
175 std::list<glib::Object<BamfApplication>> new_apps_;175 std::list<glib::Object<BamfApplication>> new_apps_;
176 std::string panel_title_;176 std::string panel_title_;
177177
=== modified file 'plugins/unityshell/src/unityshell.cpp'
--- plugins/unityshell/src/unityshell.cpp 2014-10-24 16:32:57 +0000
+++ plugins/unityshell/src/unityshell.cpp 2014-10-24 16:32:57 +0000
@@ -542,7 +542,7 @@
542542
543 for (auto const& swin : sScreen->getWindows())543 for (auto const& swin : sScreen->getWindows())
544 {544 {
545 if (std::find(filtered_windows.begin(), filtered_windows.end(), swin->window->id()) != filtered_windows.end())545 if (filtered_windows.find(swin->window->id()) != filtered_windows.end())
546 continue;546 continue;
547547
548 auto* uwin = UnityWindow::get(swin->window);548 auto* uwin = UnityWindow::get(swin->window);
549549
=== modified file 'unity-shared/PluginAdapter.cpp'
--- unity-shared/PluginAdapter.cpp 2014-08-13 23:32:39 +0000
+++ unity-shared/PluginAdapter.cpp 2014-10-24 16:32:57 +0000
@@ -554,9 +554,10 @@
554554
555bool PluginAdapter::IsWindowObscured(Window window_id) const555bool PluginAdapter::IsWindowObscured(Window window_id) const
556{556{
557 CompWindow* window = m_Screen->findWindow(window_id);557 if (_spread_state)
558 return false;
558559
559 if (window)560 if (CompWindow* window = m_Screen->findWindow(window_id))
560 {561 {
561 if (window->inShowDesktopMode())562 if (window->inShowDesktopMode())
562 return true;563 return true;