aboutsummaryrefslogtreecommitdiff
path: root/src/FbCommandFactory.cc
diff options
context:
space:
mode:
authormarkt <markt>2007-11-12 21:59:43 (GMT)
committermarkt <markt>2007-11-12 21:59:43 (GMT)
commit5d7043320da1378e7dd3b10f7e425f3b47455b28 (patch)
tree305db18a58ab6768b78ab230074da576d09e372d /src/FbCommandFactory.cc
parent807a1b557552e43dbdc169c1e7a3065a3f12aac7 (diff)
downloadfluxbox-5d7043320da1378e7dd3b10f7e425f3b47455b28.zip
fluxbox-5d7043320da1378e7dd3b10f7e425f3b47455b28.tar.bz2
allow arbitrary window patterns in iconbar
Diffstat (limited to 'src/FbCommandFactory.cc')
-rw-r--r--src/FbCommandFactory.cc39
1 files changed, 10 insertions, 29 deletions
diff --git a/src/FbCommandFactory.cc b/src/FbCommandFactory.cc
index d347878..72de740 100644
--- a/src/FbCommandFactory.cc
+++ b/src/FbCommandFactory.cc
@@ -24,6 +24,7 @@
24 24
25#include "FbCommandFactory.hh" 25#include "FbCommandFactory.hh"
26 26
27#include "FocusableList.hh"
27#include "CurrentWindowCmd.hh" 28#include "CurrentWindowCmd.hh"
28#include "FbCommands.hh" 29#include "FbCommands.hh"
29#include "Window.hh" 30#include "Window.hh"
@@ -59,26 +60,6 @@ static int getint(const char *str, int defaultvalue) {
59 return defaultvalue; 60 return defaultvalue;
60} 61}
61 62
62void parseNextWindowArgs(const string &in, int &opts, string &pat) {
63 string options;
64 int err = FbTk::StringUtil::getStringBetween(options, in.c_str(), '{', '}');
65
66 // the rest of the string is a ClientPattern
67 pat = in.c_str() + err;
68
69 // now parse the options
70 vector<string> args;
71 FbTk::StringUtil::stringtok(args, options);
72 vector<string>::iterator it = args.begin(), it_end = args.end();
73 opts = 0;
74 for (; it != it_end; ++it) {
75 if (strcasecmp((*it).c_str(), "static") == 0)
76 opts |= FocusControl::CYCLELINEAR;
77 else if (strcasecmp((*it).c_str(), "groups") == 0)
78 opts |= FocusControl::CYCLEGROUPS;
79 }
80}
81
82}; // end anonymous namespace 63}; // end anonymous namespace
83 64
84FbCommandFactory::FbCommandFactory() { 65FbCommandFactory::FbCommandFactory() {
@@ -522,29 +503,29 @@ FbTk::Command *FbCommandFactory::stringToCommand(const std::string &command,
522 } else if (command == "attach") { 503 } else if (command == "attach") {
523 int opts; // not used 504 int opts; // not used
524 string pat; 505 string pat;
525 parseNextWindowArgs(arguments, opts, pat); 506 FocusableList::parseArgs(arguments, opts, pat);
526 return new AttachCmd(pat); 507 return new AttachCmd(pat);
527 } else if (command == "nextwindow") { 508 } else if (command == "nextwindow") {
528 int opts; 509 int opts;
529 string pat; 510 string pat;
530 parseNextWindowArgs(arguments, opts, pat); 511 FocusableList::parseArgs(arguments, opts, pat);
531 return new NextWindowCmd(opts, pat); 512 return new NextWindowCmd(opts, pat);
532 } else if (command == "nextgroup") { 513 } else if (command == "nextgroup") {
533 int opts; 514 int opts;
534 string pat; 515 string pat;
535 parseNextWindowArgs(arguments, opts, pat); 516 FocusableList::parseArgs(arguments, opts, pat);
536 opts |= FocusControl::CYCLEGROUPS; 517 opts |= FocusableList::LIST_GROUPS;
537 return new NextWindowCmd(opts, pat); 518 return new NextWindowCmd(opts, pat);
538 } else if (command == "prevwindow") { 519 } else if (command == "prevwindow") {
539 int opts; 520 int opts;
540 string pat; 521 string pat;
541 parseNextWindowArgs(arguments, opts, pat); 522 FocusableList::parseArgs(arguments, opts, pat);
542 return new PrevWindowCmd(opts, pat); 523 return new PrevWindowCmd(opts, pat);
543 } else if (command == "prevgroup") { 524 } else if (command == "prevgroup") {
544 int opts; 525 int opts;
545 string pat; 526 string pat;
546 parseNextWindowArgs(arguments, opts, pat); 527 FocusableList::parseArgs(arguments, opts, pat);
547 opts |= FocusControl::CYCLEGROUPS; 528 opts |= FocusableList::LIST_GROUPS;
548 return new PrevWindowCmd(opts, pat); 529 return new PrevWindowCmd(opts, pat);
549 } else if (command == "gotowindow") { 530 } else if (command == "gotowindow") {
550 int num, opts; 531 int num, opts;
@@ -554,12 +535,12 @@ FbTk::Command *FbCommandFactory::stringToCommand(const std::string &command,
554 string::size_type pos = arguments.find_first_of("({"); 535 string::size_type pos = arguments.find_first_of("({");
555 if (pos != string::npos && pos != arguments.size()) 536 if (pos != string::npos && pos != arguments.size())
556 args = arguments.c_str() + pos; 537 args = arguments.c_str() + pos;
557 parseNextWindowArgs(args, opts, pat); 538 FocusableList::parseArgs(args, opts, pat);
558 return new GoToWindowCmd(num, opts, pat); 539 return new GoToWindowCmd(num, opts, pat);
559 } else if (command == "clientmenu") { 540 } else if (command == "clientmenu") {
560 int opts; 541 int opts;
561 string pat; 542 string pat;
562 parseNextWindowArgs(arguments, opts, pat); 543 FocusableList::parseArgs(arguments, opts, pat);
563 return new ShowClientMenuCmd(opts, pat); 544 return new ShowClientMenuCmd(opts, pat);
564 } else if (command == "focusup") 545 } else if (command == "focusup")
565 return new DirFocusCmd(FocusControl::FOCUSUP); 546 return new DirFocusCmd(FocusControl::FOCUSUP);