Index: src/FbCommands.cc =================================================================== RCS file: /cvsroot/fluxbox/fluxbox/src/FbCommands.cc,v retrieving revision 1.23 diff -a -b -B -p -u -r1.23 FbCommands.cc --- src/FbCommands.cc 21 Jan 2004 14:11:15 -0000 1.23 +++ src/FbCommands.cc 20 Apr 2004 14:00:31 -0000 @@ -26,6 +26,7 @@ #include "Screen.hh" #include "CommandDialog.hh" #include "Workspace.hh" +#include "Window.hh" #include "Keys.hh" #include "FbTk/Theme.hh" @@ -249,4 +250,49 @@ void BindKeyCmd::execute() { } } +DeiconifyCmd::DeiconifyCmd(const Mode mode, + const Destination dest) : m_mode(mode), m_dest(dest) { } + +void DeiconifyCmd::execute() { + BScreen *screen = Fluxbox::instance()->mouseScreen(); + if (screen == 0) + return; + + BScreen::Icons::reverse_iterator it= screen->getIconList().rbegin(); + BScreen::Icons::reverse_iterator itend= screen->getIconList().rend(); + unsigned int workspace_num= screen->currentWorkspaceID(); + unsigned int old_workspace_num; + + switch(m_mode) { + + case ALL: + case ALLWORKSPACE: + for(; it != itend; it++) { + old_workspace_num= (*it)->workspaceNumber(); + if (m_mode == ALL || old_workspace_num == workspace_num) { + if (m_dest == ORIGIN) + screen->sendToWorkspace(old_workspace_num, (*it)); + else + (*it)->deiconify(false); + } + } + break; + + case LAST: + case LASTWORKSPACE: + default: + for (; it != itend; it++) { + old_workspace_num= (*it)->workspaceNumber(); + if(m_mode == LAST || old_workspace_num == workspace_num) { + if (m_dest == ORIGIN && m_mode != LASTWORKSPACE) + screen->sendToWorkspace(old_workspace_num, (*it)); + else + (*it)->deiconify(false); + break; + } + } + break; + }; +} + }; // end namespace FbCommands Index: src/FbCommandFactory.cc =================================================================== RCS file: /cvsroot/fluxbox/fluxbox/src/FbCommandFactory.cc,v retrieving revision 1.28 diff -a -b -B -p -u -r1.28 FbCommandFactory.cc --- src/FbCommandFactory.cc 8 Mar 2004 12:23:16 -0000 1.28 +++ src/FbCommandFactory.cc 20 Apr 2004 14:00:31 -0000 @@ -64,6 +64,7 @@ FbCommandFactory::FbCommandFactory() { "bindkey", "close", "commanddialog", + "deiconify", "detachclient", "exec", "execcommand", @@ -298,7 +299,34 @@ FbTk::Command *FbCommandFactory::stringT // // special commands // - else if (command == "macrocmd") { + else if (command == "deiconify") { + + FB_istringstream iss(arguments); + string mode; + string d; + DeiconifyCmd::Destination dest; + + iss >> mode; + if (iss.fail()) + mode="lastworkspace"; + mode= FbTk::StringUtil::toLower(mode); + + iss >> d; + if (iss.fail()) + d="current"; + d= FbTk::StringUtil::toLower(d); + dest= ( d == "current" ? DeiconifyCmd::CURRENT : DeiconifyCmd::ORIGIN ); + + if ( mode == "all" ) + return new DeiconifyCmd(DeiconifyCmd::ALL, dest); + else if ( mode == "allworkspace" ) + return new DeiconifyCmd(DeiconifyCmd::ALLWORKSPACE, dest); + else if ( mode == "last" ) + return new DeiconifyCmd(DeiconifyCmd::LAST, dest); + else // lastworkspace, default + return new DeiconifyCmd(DeiconifyCmd::LASTWORKSPACE, dest); + + } else if (command == "macrocmd") { std::string cmd; int err= 0; int parse_pos= 0; Index: src/FbCommands.hh =================================================================== RCS file: /cvsroot/fluxbox/fluxbox/src/FbCommands.hh,v retrieving revision 1.18 diff -a -b -B -p -u -r1.18 FbCommands.hh --- src/FbCommands.hh 16 Mar 2004 18:44:40 -0000 1.18 +++ src/FbCommands.hh 20 Apr 2004 14:00:31 -0000 @@ -135,4 +135,27 @@ private: const std::string m_keybind; }; +/// deiconifies iconified windows +class DeiconifyCmd: public FbTk::Command { +public: + enum Mode { + LAST, + LASTWORKSPACE, + ALL, + ALLWORKSPACE + }; + + enum Destination { + CURRENT, + ORIGIN + }; + + DeiconifyCmd(const Mode mode= LASTWORKSPACE, + const Destination dest= CURRENT); + void execute(); +private: + Mode m_mode; + Destination m_dest; +}; + #endif // FBCOMMANDS_HH