summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMark Tiefenbruck <mark@fluxbox.org>2009-06-28 17:15:06 (GMT)
committerMark Tiefenbruck <mark@fluxbox.org>2009-06-28 17:15:06 (GMT)
commit5f9f2475b72e977fa96214e368c34c588b265888 (patch)
treedb2dc4b3cc762b356c4420f9345b52e39d94f0c7 /src
parentc1d9ae5068ed209a8ed051a68c269bd0158bf6a8 (diff)
downloadfluxbox_lack-5f9f2475b72e977fa96214e368c34c588b265888.zip
fluxbox_lack-5f9f2475b72e977fa96214e368c34c588b265888.tar.bz2
make Raise/LowerLayer accept integer argument for number of layers, default 2
Diffstat (limited to 'src')
-rw-r--r--src/CurrentWindowCmd.cc25
-rw-r--r--src/CurrentWindowCmd.hh11
-rw-r--r--src/Window.cc9
-rw-r--r--src/Window.hh3
4 files changed, 33 insertions, 15 deletions
diff --git a/src/CurrentWindowCmd.cc b/src/CurrentWindowCmd.cc
index dfb5c19..6cb5c08 100644
--- a/src/CurrentWindowCmd.cc
+++ b/src/CurrentWindowCmd.cc
@@ -52,12 +52,8 @@ FbTk::Command<void> *createCurrentWindowCmd(const std::string &command,
52 return new CurrentWindowCmd(&FluxboxWindow::maximizeHorizontal); 52 return new CurrentWindowCmd(&FluxboxWindow::maximizeHorizontal);
53 else if (command == "raise") 53 else if (command == "raise")
54 return new CurrentWindowCmd(&FluxboxWindow::raise); 54 return new CurrentWindowCmd(&FluxboxWindow::raise);
55 else if (command == "raiselayer")
56 return new CurrentWindowCmd(&FluxboxWindow::raiseLayer);
57 else if (command == "lower") 55 else if (command == "lower")
58 return new CurrentWindowCmd(&FluxboxWindow::lower); 56 return new CurrentWindowCmd(&FluxboxWindow::lower);
59 else if (command == "lowerlayer")
60 return new CurrentWindowCmd(&FluxboxWindow::lowerLayer);
61 else if (command == "close") 57 else if (command == "close")
62 return new CurrentWindowCmd(&FluxboxWindow::close); 58 return new CurrentWindowCmd(&FluxboxWindow::close);
63 else if (command == "killwindow" || command == "kill") 59 else if (command == "killwindow" || command == "kill")
@@ -95,9 +91,7 @@ REGISTER_COMMAND_PARSER(maximize, createCurrentWindowCmd, void);
95REGISTER_COMMAND_PARSER(maximizevertical, createCurrentWindowCmd, void); 91REGISTER_COMMAND_PARSER(maximizevertical, createCurrentWindowCmd, void);
96REGISTER_COMMAND_PARSER(maximizehorizontal, createCurrentWindowCmd, void); 92REGISTER_COMMAND_PARSER(maximizehorizontal, createCurrentWindowCmd, void);
97REGISTER_COMMAND_PARSER(raise, createCurrentWindowCmd, void); 93REGISTER_COMMAND_PARSER(raise, createCurrentWindowCmd, void);
98REGISTER_COMMAND_PARSER(raiselayer, createCurrentWindowCmd, void);
99REGISTER_COMMAND_PARSER(lower, createCurrentWindowCmd, void); 94REGISTER_COMMAND_PARSER(lower, createCurrentWindowCmd, void);
100REGISTER_COMMAND_PARSER(lowerlayer, createCurrentWindowCmd, void);
101REGISTER_COMMAND_PARSER(close, createCurrentWindowCmd, void); 95REGISTER_COMMAND_PARSER(close, createCurrentWindowCmd, void);
102REGISTER_COMMAND_PARSER(killwindow, createCurrentWindowCmd, void); 96REGISTER_COMMAND_PARSER(killwindow, createCurrentWindowCmd, void);
103REGISTER_COMMAND_PARSER(kill, createCurrentWindowCmd, void); 97REGISTER_COMMAND_PARSER(kill, createCurrentWindowCmd, void);
@@ -466,6 +460,25 @@ void SetLayerCmd::real_execute() {
466 fbwindow().moveToLayer(m_layer); 460 fbwindow().moveToLayer(m_layer);
467} 461}
468 462
463FbTk::Command<void> *ChangeLayerCmd::parse(const string &command,
464 const string &args, bool trusted) {
465 int num = 2;
466 FbTk_istringstream iss(args.c_str());
467 iss >> num;
468 if (command == "raiselayer")
469 return new ChangeLayerCmd(-num);
470 else if (command == "lowerlayer")
471 return new ChangeLayerCmd(num);
472 return 0;
473}
474
475REGISTER_COMMAND_PARSER(raiselayer, ChangeLayerCmd::parse, void);
476REGISTER_COMMAND_PARSER(lowerlayer, ChangeLayerCmd::parse, void);
477
478void ChangeLayerCmd::real_execute() {
479 fbwindow().changeLayer(m_diff);
480}
481
469namespace { 482namespace {
470class SetTitleDialog: public TextDialog, public FbTk::Observer { 483class SetTitleDialog: public TextDialog, public FbTk::Observer {
471public: 484public:
diff --git a/src/CurrentWindowCmd.hh b/src/CurrentWindowCmd.hh
index 32cc5f0..edf00fa 100644
--- a/src/CurrentWindowCmd.hh
+++ b/src/CurrentWindowCmd.hh
@@ -255,6 +255,17 @@ private:
255 int m_layer; 255 int m_layer;
256}; 256};
257 257
258class ChangeLayerCmd: public WindowHelperCmd {
259public:
260 explicit ChangeLayerCmd(int diff): m_diff(diff) { }
261 static FbTk::Command<void> *parse(const std::string &command,
262 const std::string &args, bool trusted);
263protected:
264 void real_execute();
265private:
266 int m_diff;
267};
268
258class MatchCmd: public WindowHelperBoolCmd { 269class MatchCmd: public WindowHelperBoolCmd {
259public: 270public:
260 MatchCmd(const std::string &pat): m_pat(pat.c_str()) { }; 271 MatchCmd(const std::string &pat): m_pat(pat.c_str()) { };
diff --git a/src/Window.cc b/src/Window.cc
index 825c050..defa6cc 100644
--- a/src/Window.cc
+++ b/src/Window.cc
@@ -1697,15 +1697,10 @@ void FluxboxWindow::tempRaise() {
1697} 1697}
1698 1698
1699 1699
1700void FluxboxWindow::raiseLayer() { 1700void FluxboxWindow::changeLayer(int diff) {
1701 moveToLayer(m_state.layernum-1); 1701 moveToLayer(m_state.layernum+diff);
1702} 1702}
1703 1703
1704void FluxboxWindow::lowerLayer() {
1705 moveToLayer(m_state.layernum+1);
1706}
1707
1708
1709void FluxboxWindow::moveToLayer(int layernum, bool force) { 1704void FluxboxWindow::moveToLayer(int layernum, bool force) {
1710#ifdef DEBUG 1705#ifdef DEBUG
1711 cerr<<"FluxboxWindow("<<title()<<")::moveToLayer("<<layernum<<")"<<endl; 1706 cerr<<"FluxboxWindow("<<title()<<")::moveToLayer("<<layernum<<")"<<endl;
diff --git a/src/Window.hh b/src/Window.hh
index bf177b4..92d20d7 100644
--- a/src/Window.hh
+++ b/src/Window.hh
@@ -243,8 +243,7 @@ public:
243 void raise(); 243 void raise();
244 void lower(); 244 void lower();
245 void tempRaise(); 245 void tempRaise();
246 void raiseLayer(); 246 void changeLayer(int diff);
247 void lowerLayer();
248 /// moves the window to a new layer 247 /// moves the window to a new layer
249 void moveToLayer(int layernum, bool force = false); 248 void moveToLayer(int layernum, bool force = false);
250 int getOnHead() const; 249 int getOnHead() const;