add CloseAllWindows key action

thanks Adriano Dal Bosco - adbosco at users.sourceforge.net
This commit is contained in:
simonb 2006-04-16 11:29:38 +00:00
parent 553104ee1d
commit 4d0a0c9e11
4 changed files with 35 additions and 0 deletions

View file

@ -1,6 +1,11 @@
(Format: Year/Month/Day)
Changes for 0.9.16:
*06/04/16:
* Add "CloseAllWindows" key binding
(thanks Adriano Dal Bosco - adbosco at users.sourceforge.net)
- Useful to trigger all "close" actions before flux exit (or other)
to catch any pending file saves etc...
WorkspaceCmd.hh/cc FbCommandFactory.cc
* Fix all warnings with (gcc 3.4.6) -Wall, mainly sign comparisons (Simon)
ClientPattern.cc Container.cc FbWinFrame.cc IconButton.cc IconbarTool.cc
ScreenPlacement.hh ScreenResources.cc ToolFactory.cc Toolbar.cc

View file

@ -51,6 +51,7 @@ FbCommandFactory::FbCommandFactory() {
"arrangewindows",
"bindkey",
"close",
"closeallwindows",
"commanddialog",
"deiconify",
"detachclient",
@ -310,6 +311,8 @@ FbTk::Command *FbCommandFactory::stringToCommand(const std::string &command,
return new CurrentWindowCmd(&FluxboxWindow::lowerLayer);
else if (command == "close")
return new CurrentWindowCmd(&FluxboxWindow::close);
else if (command == "closeallwindows")
return new CloseAllWindowsCmd();
else if (command == "shade" || command == "shadewindow")
return new CurrentWindowCmd(&FluxboxWindow::shade);
else if (command == "stick" || command == "stickwindow")

View file

@ -238,3 +238,24 @@ void ShowDesktopCmd::execute() {
windows.end(),
std::mem_fun(&FluxboxWindow::iconify));
}
void CloseAllWindowsCmd::execute() {
BScreen *screen = Fluxbox::instance()->mouseScreen();
if (screen == 0)
return;
BScreen::Workspaces::iterator workspace_it = screen->getWorkspacesList().begin();
BScreen::Workspaces::iterator workspace_it_end = screen->getWorkspacesList().end();
for (; workspace_it != workspace_it_end; ++workspace_it) {
Workspace::Windows windows((*workspace_it)->windowList());
std::for_each(windows.begin(),
windows.end(),
std::mem_fun(&FluxboxWindow::close));
}
BScreen::Icons::iterator icon_it = screen->iconList().begin();
BScreen::Icons::iterator icon_it_end = screen->iconList().end();
for (; icon_it != icon_it_end; ++icon_it ) {
(*icon_it)->close();
}
}

View file

@ -104,4 +104,10 @@ public:
void execute();
};
class CloseAllWindowsCmd: public FbTk::Command {
public:
void execute();
};
#endif // WORKSPACECMD_HH