diff options
author | Mark Tiefenbruck <mark@fluxbox.org> | 2009-06-28 17:15:06 (GMT) |
---|---|---|
committer | Mark Tiefenbruck <mark@fluxbox.org> | 2009-06-28 17:15:06 (GMT) |
commit | 5f9f2475b72e977fa96214e368c34c588b265888 (patch) | |
tree | db2dc4b3cc762b356c4420f9345b52e39d94f0c7 /src | |
parent | c1d9ae5068ed209a8ed051a68c269bd0158bf6a8 (diff) | |
download | fluxbox_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.cc | 25 | ||||
-rw-r--r-- | src/CurrentWindowCmd.hh | 11 | ||||
-rw-r--r-- | src/Window.cc | 9 | ||||
-rw-r--r-- | src/Window.hh | 3 |
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); | |||
95 | REGISTER_COMMAND_PARSER(maximizevertical, createCurrentWindowCmd, void); | 91 | REGISTER_COMMAND_PARSER(maximizevertical, createCurrentWindowCmd, void); |
96 | REGISTER_COMMAND_PARSER(maximizehorizontal, createCurrentWindowCmd, void); | 92 | REGISTER_COMMAND_PARSER(maximizehorizontal, createCurrentWindowCmd, void); |
97 | REGISTER_COMMAND_PARSER(raise, createCurrentWindowCmd, void); | 93 | REGISTER_COMMAND_PARSER(raise, createCurrentWindowCmd, void); |
98 | REGISTER_COMMAND_PARSER(raiselayer, createCurrentWindowCmd, void); | ||
99 | REGISTER_COMMAND_PARSER(lower, createCurrentWindowCmd, void); | 94 | REGISTER_COMMAND_PARSER(lower, createCurrentWindowCmd, void); |
100 | REGISTER_COMMAND_PARSER(lowerlayer, createCurrentWindowCmd, void); | ||
101 | REGISTER_COMMAND_PARSER(close, createCurrentWindowCmd, void); | 95 | REGISTER_COMMAND_PARSER(close, createCurrentWindowCmd, void); |
102 | REGISTER_COMMAND_PARSER(killwindow, createCurrentWindowCmd, void); | 96 | REGISTER_COMMAND_PARSER(killwindow, createCurrentWindowCmd, void); |
103 | REGISTER_COMMAND_PARSER(kill, createCurrentWindowCmd, void); | 97 | REGISTER_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 | ||
463 | FbTk::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 | |||
475 | REGISTER_COMMAND_PARSER(raiselayer, ChangeLayerCmd::parse, void); | ||
476 | REGISTER_COMMAND_PARSER(lowerlayer, ChangeLayerCmd::parse, void); | ||
477 | |||
478 | void ChangeLayerCmd::real_execute() { | ||
479 | fbwindow().changeLayer(m_diff); | ||
480 | } | ||
481 | |||
469 | namespace { | 482 | namespace { |
470 | class SetTitleDialog: public TextDialog, public FbTk::Observer { | 483 | class SetTitleDialog: public TextDialog, public FbTk::Observer { |
471 | public: | 484 | public: |
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 | ||
258 | class ChangeLayerCmd: public WindowHelperCmd { | ||
259 | public: | ||
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); | ||
263 | protected: | ||
264 | void real_execute(); | ||
265 | private: | ||
266 | int m_diff; | ||
267 | }; | ||
268 | |||
258 | class MatchCmd: public WindowHelperBoolCmd { | 269 | class MatchCmd: public WindowHelperBoolCmd { |
259 | public: | 270 | public: |
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 | ||
1700 | void FluxboxWindow::raiseLayer() { | 1700 | void FluxboxWindow::changeLayer(int diff) { |
1701 | moveToLayer(m_state.layernum-1); | 1701 | moveToLayer(m_state.layernum+diff); |
1702 | } | 1702 | } |
1703 | 1703 | ||
1704 | void FluxboxWindow::lowerLayer() { | ||
1705 | moveToLayer(m_state.layernum+1); | ||
1706 | } | ||
1707 | |||
1708 | |||
1709 | void FluxboxWindow::moveToLayer(int layernum, bool force) { | 1704 | void 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; |