From 4d0a0c9e114cbadf3d06f4a71d5043bda847c844 Mon Sep 17 00:00:00 2001 From: simonb <simonb> Date: Sun, 16 Apr 2006 11:29:38 +0000 Subject: add CloseAllWindows key action thanks Adriano Dal Bosco - adbosco at users.sourceforge.net --- ChangeLog | 5 +++++ src/FbCommandFactory.cc | 3 +++ src/WorkspaceCmd.cc | 21 +++++++++++++++++++++ src/WorkspaceCmd.hh | 6 ++++++ 4 files changed, 35 insertions(+) diff --git a/ChangeLog b/ChangeLog index 5d736a2..9bcaf85 100644 --- a/ChangeLog +++ b/ChangeLog @@ -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 diff --git a/src/FbCommandFactory.cc b/src/FbCommandFactory.cc index 4bf1dd5..a749684 100644 --- a/src/FbCommandFactory.cc +++ b/src/FbCommandFactory.cc @@ -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") diff --git a/src/WorkspaceCmd.cc b/src/WorkspaceCmd.cc index 3673e17..9951e0e 100644 --- a/src/WorkspaceCmd.cc +++ b/src/WorkspaceCmd.cc @@ -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(); + } + +} diff --git a/src/WorkspaceCmd.hh b/src/WorkspaceCmd.hh index 786492d..1e5b04d 100644 --- a/src/WorkspaceCmd.hh +++ b/src/WorkspaceCmd.hh @@ -104,4 +104,10 @@ public: void execute(); }; + +class CloseAllWindowsCmd: public FbTk::Command { +public: + void execute(); +}; + #endif // WORKSPACECMD_HH -- cgit v0.11.2