summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/WorkspaceCmd.cc31
1 files changed, 18 insertions, 13 deletions
diff --git a/src/WorkspaceCmd.cc b/src/WorkspaceCmd.cc
index 41c7832..dbcc5dd 100644
--- a/src/WorkspaceCmd.cc
+++ b/src/WorkspaceCmd.cc
@@ -488,28 +488,33 @@ void ShowDesktopCmd::execute() {
488 if (screen == 0) 488 if (screen == 0)
489 return; 489 return;
490 490
491 // iconify windows in focus order, so it gets restored properly
492 const std::list<Focusable *> wins =
493 screen->focusControl().focusedOrderWinList().clientList();
494 std::list<Focusable *>::const_iterator it = wins.begin(),
495 it_end = wins.end();
496 unsigned int space = screen->currentWorkspaceID();
491 unsigned int count = 0; 497 unsigned int count = 0;
492 Workspace::Windows windows(screen->currentWorkspace()->windowList());
493 Workspace::Windows::iterator it = windows.begin(),
494 it_end = windows.end();
495 for (; it != it_end; ++it) { 498 for (; it != it_end; ++it) {
496 if ((*it)->layerNum() < Layer::DESKTOP) { 499 if (!(*it)->fbwindow()->isIconic() && ((*it)->fbwindow()->isStuck() ||
497 (*it)->iconify(); 500 (*it)->fbwindow()->workspaceNumber() == space) &&
501 (*it)->fbwindow()->layerNum() < Layer::DESKTOP) {
502 (*it)->fbwindow()->iconify();
498 count++; 503 count++;
499 } 504 }
500 } 505 }
501 506
502 if (count == 0) { 507 if (count == 0) {
503 BScreen::Icons icon_list = screen->iconList(); 508 BScreen::Icons icon_list = screen->iconList();
504 BScreen::Icons::iterator icon_it = icon_list.begin(); 509 BScreen::Icons::reverse_iterator iconit = icon_list.rbegin();
505 BScreen::Icons::iterator itend = icon_list.end(); 510 BScreen::Icons::reverse_iterator itend= icon_list.rend();
506 unsigned int space = screen->currentWorkspaceID(); 511 for(; iconit != itend; iconit++) {
507 512 if ((*iconit)->workspaceNumber() == space || (*iconit)->isStuck())
508 for (; icon_it != itend; ++icon_it) { 513 (*iconit)->deiconify(false);
509 if ((*icon_it)->isStuck() || (*icon_it)->workspaceNumber() == space)
510 (*icon_it)->deiconify();
511 } 514 }
512 } 515 } else
516 FocusControl::revertFocus(*screen);
517
513} 518}
514 519
515REGISTER_COMMAND(closeallwindows, CloseAllWindowsCmd, void); 520REGISTER_COMMAND(closeallwindows, CloseAllWindowsCmd, void);