From 6875a611dca24054ef4a116a51bd70eb98bcf0b8 Mon Sep 17 00:00:00 2001 From: Mark Tiefenbruck Date: Sat, 23 Aug 2008 05:44:11 -0700 Subject: make ShowDesktop and Deiconify commands maintain focus order --- src/WorkspaceCmd.cc | 31 ++++++++++++++++++------------- 1 file 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() { if (screen == 0) return; + // iconify windows in focus order, so it gets restored properly + const std::list wins = + screen->focusControl().focusedOrderWinList().clientList(); + std::list::const_iterator it = wins.begin(), + it_end = wins.end(); + unsigned int space = screen->currentWorkspaceID(); unsigned int count = 0; - Workspace::Windows windows(screen->currentWorkspace()->windowList()); - Workspace::Windows::iterator it = windows.begin(), - it_end = windows.end(); for (; it != it_end; ++it) { - if ((*it)->layerNum() < Layer::DESKTOP) { - (*it)->iconify(); + if (!(*it)->fbwindow()->isIconic() && ((*it)->fbwindow()->isStuck() || + (*it)->fbwindow()->workspaceNumber() == space) && + (*it)->fbwindow()->layerNum() < Layer::DESKTOP) { + (*it)->fbwindow()->iconify(); count++; } } if (count == 0) { BScreen::Icons icon_list = screen->iconList(); - BScreen::Icons::iterator icon_it = icon_list.begin(); - BScreen::Icons::iterator itend = icon_list.end(); - unsigned int space = screen->currentWorkspaceID(); - - for (; icon_it != itend; ++icon_it) { - if ((*icon_it)->isStuck() || (*icon_it)->workspaceNumber() == space) - (*icon_it)->deiconify(); + BScreen::Icons::reverse_iterator iconit = icon_list.rbegin(); + BScreen::Icons::reverse_iterator itend= icon_list.rend(); + for(; iconit != itend; iconit++) { + if ((*iconit)->workspaceNumber() == space || (*iconit)->isStuck()) + (*iconit)->deiconify(false); } - } + } else + FocusControl::revertFocus(*screen); + } REGISTER_COMMAND(closeallwindows, CloseAllWindowsCmd, void); -- cgit v0.11.2