summaryrefslogtreecommitdiff
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
parentc1d9ae5068ed209a8ed051a68c269bd0158bf6a8 (diff)
downloadfluxbox_lack-5f9f2475b72e977fa96214e368c34c588b265888.zip
fluxbox_lack-5f9f2475b72e977fa96214e368c34c588b265888.tar.bz2
make Raise/LowerLayer accept integer argument for number of layers, default 2
-rw-r--r--ChangeLog2
-rw-r--r--doc/asciidoc/fluxbox-keys.txt2
-rw-r--r--doc/fluxbox-keys.5.in2
-rw-r--r--src/CurrentWindowCmd.cc25
-rw-r--r--src/CurrentWindowCmd.hh11
-rw-r--r--src/Window.cc9
-rw-r--r--src/Window.hh3
7 files changed, 37 insertions, 17 deletions
diff --git a/ChangeLog b/ChangeLog
index 925e20e..da33f82 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,6 +1,8 @@
1 (Format: Year/Month/Day) 1 (Format: Year/Month/Day)
2Changes for 1.1.2 2Changes for 1.1.2
3*09/06/28: 3*09/06/28:
4 * Make Raise/LowerLayer commands accept integer argument, defualt 2 (Mark)
5 CurrentWindowCmd.cc/hh Window.cc/hh
4 * Change default toolbar head to 1 (Mark) 6 * Change default toolbar head to 1 (Mark)
5 Toolbar.cc 7 Toolbar.cc
6 * Add window menu and alt-tab to error case for keys file (Mark) 8 * Add window menu and alt-tab to error case for keys file (Mark)
diff --git a/doc/asciidoc/fluxbox-keys.txt b/doc/asciidoc/fluxbox-keys.txt
index ae9abb0..58f59b1 100644
--- a/doc/asciidoc/fluxbox-keys.txt
+++ b/doc/asciidoc/fluxbox-keys.txt
@@ -195,7 +195,7 @@ These commands ordinarily affect only the currently focused window. The
195 Reorder this window to the top or bottom of the window stack, within 195 Reorder this window to the top or bottom of the window stack, within
196 its current layer. See 'fluxbox(1)' for a discussion of layers. 196 its current layer. See 'fluxbox(1)' for a discussion of layers.
197 197
198*RaiseLayer* / *LowerLayer*:: 198*RaiseLayer* / *LowerLayer* ['offset']::
199 Raise the window up to the layer above, or lower it to the layer 199 Raise the window up to the layer above, or lower it to the layer
200 below. See 'fluxbox(1)' for a discussion of layers. 200 below. See 'fluxbox(1)' for a discussion of layers.
201 201
diff --git a/doc/fluxbox-keys.5.in b/doc/fluxbox-keys.5.in
index f1ee22f..1420162 100644
--- a/doc/fluxbox-keys.5.in
+++ b/doc/fluxbox-keys.5.in
@@ -278,7 +278,7 @@ Reorder this window to the top or bottom of the window stack, within its current
278for a discussion of layers\&. 278for a discussion of layers\&.
279.RE 279.RE
280.PP 280.PP
281\fBRaiseLayer\fR / \fBLowerLayer\fR 281\fBRaiseLayer\fR / \fBLowerLayer\fR [\fIoffset\fR]
282.RS 4 282.RS 4
283Raise the window up to the layer above, or lower it to the layer below\&. See 283Raise the window up to the layer above, or lower it to the layer below\&. See
284\fIfluxbox(1)\fR 284\fIfluxbox(1)\fR
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;