summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/FbCommandFactory.cc37
-rw-r--r--src/FbCommands.cc51
-rw-r--r--src/FbCommands.hh26
3 files changed, 110 insertions, 4 deletions
diff --git a/src/FbCommandFactory.cc b/src/FbCommandFactory.cc
index ee22b28..9853b50 100644
--- a/src/FbCommandFactory.cc
+++ b/src/FbCommandFactory.cc
@@ -20,7 +20,7 @@
20// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 20// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
21// DEALINGS IN THE SOFTWARE. 21// DEALINGS IN THE SOFTWARE.
22 22
23// $Id: FbCommandFactory.cc,v 1.28 2004/03/08 12:23:16 rathnor Exp $ 23// $Id: FbCommandFactory.cc,v 1.29 2004/04/22 21:12:34 fluxgen Exp $
24 24
25#include "FbCommandFactory.hh" 25#include "FbCommandFactory.hh"
26 26
@@ -64,6 +64,7 @@ FbCommandFactory::FbCommandFactory() {
64 "bindkey", 64 "bindkey",
65 "close", 65 "close",
66 "commanddialog", 66 "commanddialog",
67 "deiconify",
67 "detachclient", 68 "detachclient",
68 "exec", 69 "exec",
69 "execcommand", 70 "execcommand",
@@ -298,7 +299,39 @@ FbTk::Command *FbCommandFactory::stringToCommand(const std::string &command,
298 // 299 //
299 // special commands 300 // special commands
300 // 301 //
301 else if (command == "macrocmd") { 302 else if (command == "deiconify") {
303
304 FB_istringstream iss(arguments);
305 string mode;
306 string d;
307 DeiconifyCmd::Destination dest;
308
309 iss >> mode;
310 if (iss.fail())
311 mode="lastworkspace";
312 mode= FbTk::StringUtil::toLower(mode);
313
314 iss >> d;
315 if (iss.fail())
316 d="current";
317 d= FbTk::StringUtil::toLower(d);
318 if (d == "origin" )
319 dest= DeiconifyCmd::ORIGIN;
320 else if (d == "originquiet")
321 dest= DeiconifyCmd::ORIGINQUIET;
322 else
323 dest= DeiconifyCmd::CURRENT;
324
325 if ( mode == "all" )
326 return new DeiconifyCmd(DeiconifyCmd::ALL, dest);
327 else if ( mode == "allworkspace" )
328 return new DeiconifyCmd(DeiconifyCmd::ALLWORKSPACE, dest);
329 else if ( mode == "last" )
330 return new DeiconifyCmd(DeiconifyCmd::LAST, dest);
331 else // lastworkspace, default
332 return new DeiconifyCmd(DeiconifyCmd::LASTWORKSPACE, dest);
333
334 } else if (command == "macrocmd") {
302 std::string cmd; 335 std::string cmd;
303 int err= 0; 336 int err= 0;
304 int parse_pos= 0; 337 int parse_pos= 0;
diff --git a/src/FbCommands.cc b/src/FbCommands.cc
index 99c8eca..e7d1986 100644
--- a/src/FbCommands.cc
+++ b/src/FbCommands.cc
@@ -19,13 +19,14 @@
19// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 19// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
20// DEALINGS IN THE SOFTWARE. 20// DEALINGS IN THE SOFTWARE.
21 21
22// $Id: FbCommands.cc,v 1.23 2004/01/21 14:11:15 fluxgen Exp $ 22// $Id: FbCommands.cc,v 1.24 2004/04/22 21:12:32 fluxgen Exp $
23 23
24#include "FbCommands.hh" 24#include "FbCommands.hh"
25#include "fluxbox.hh" 25#include "fluxbox.hh"
26#include "Screen.hh" 26#include "Screen.hh"
27#include "CommandDialog.hh" 27#include "CommandDialog.hh"
28#include "Workspace.hh" 28#include "Workspace.hh"
29#include "Window.hh"
29#include "Keys.hh" 30#include "Keys.hh"
30 31
31#include "FbTk/Theme.hh" 32#include "FbTk/Theme.hh"
@@ -249,4 +250,52 @@ void BindKeyCmd::execute() {
249 } 250 }
250} 251}
251 252
253DeiconifyCmd::DeiconifyCmd(const Mode mode,
254 const Destination dest) : m_mode(mode), m_dest(dest) { }
255
256void DeiconifyCmd::execute() {
257 BScreen *screen = Fluxbox::instance()->mouseScreen();
258 if (screen == 0)
259 return;
260
261 BScreen::Icons::reverse_iterator it= screen->getIconList().rbegin();
262 BScreen::Icons::reverse_iterator itend= screen->getIconList().rend();
263 unsigned int workspace_num= screen->currentWorkspaceID();
264 unsigned int old_workspace_num;
265
266 const bool change_ws= m_dest == ORIGIN;
267
268 switch(m_mode) {
269
270 case ALL:
271 case ALLWORKSPACE:
272 for(; it != itend; it++) {
273 old_workspace_num= (*it)->workspaceNumber();
274 if (m_mode == ALL || old_workspace_num == workspace_num) {
275 if (m_dest == ORIGIN || m_dest == ORIGINQUIET)
276 screen->sendToWorkspace(old_workspace_num, (*it), change_ws);
277 else
278 (*it)->deiconify(false);
279 }
280 }
281 break;
282
283 case LAST:
284 case LASTWORKSPACE:
285 default:
286 for (; it != itend; it++) {
287 old_workspace_num= (*it)->workspaceNumber();
288 if(m_mode == LAST || old_workspace_num == workspace_num) {
289 if ((m_dest == ORIGIN || m_dest == ORIGINQUIET) &&
290 m_mode != LASTWORKSPACE)
291 screen->sendToWorkspace(old_workspace_num, (*it), change_ws);
292 else
293 (*it)->deiconify(false);
294 break;
295 }
296 }
297 break;
298 };
299}
300
252}; // end namespace FbCommands 301}; // end namespace FbCommands
diff --git a/src/FbCommands.hh b/src/FbCommands.hh
index f65869e..bc67610 100644
--- a/src/FbCommands.hh
+++ b/src/FbCommands.hh
@@ -19,7 +19,7 @@
19// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 19// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
20// DEALINGS IN THE SOFTWARE. 20// DEALINGS IN THE SOFTWARE.
21 21
22// $Id: FbCommands.hh,v 1.18 2004/03/16 18:44:40 fluxgen Exp $ 22// $Id: FbCommands.hh,v 1.19 2004/04/22 21:12:33 fluxgen Exp $
23 23
24// \file contains basic commands to restart, reconfigure, execute command and exit fluxbox 24// \file contains basic commands to restart, reconfigure, execute command and exit fluxbox
25 25
@@ -135,4 +135,28 @@ private:
135 const std::string m_keybind; 135 const std::string m_keybind;
136}; 136};
137 137
138/// deiconifies iconified windows
139class DeiconifyCmd: public FbTk::Command {
140public:
141 enum Mode {
142 LAST,
143 LASTWORKSPACE,
144 ALL,
145 ALLWORKSPACE
146 };
147
148 enum Destination {
149 CURRENT, /// deiconification on current workspace
150 ORIGIN, /// deiconification on origin workspace, change to that ws
151 ORIGINQUIET /// deiconification on origin workspace, dont change ws
152 };
153
154 DeiconifyCmd(const Mode mode= LASTWORKSPACE,
155 const Destination dest= CURRENT);
156 void execute();
157private:
158 Mode m_mode;
159 Destination m_dest;
160};
161
138#endif // FBCOMMANDS_HH 162#endif // FBCOMMANDS_HH