diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/CurrentWindowCmd.cc | 15 | ||||
-rw-r--r-- | src/CurrentWindowCmd.hh | 20 | ||||
-rw-r--r-- | src/FbCommandFactory.cc | 8 |
3 files changed, 40 insertions, 3 deletions
diff --git a/src/CurrentWindowCmd.cc b/src/CurrentWindowCmd.cc index 4320f73..44355aa 100644 --- a/src/CurrentWindowCmd.cc +++ b/src/CurrentWindowCmd.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: CurrentWindowCmd.cc,v 1.8 2003/10/26 12:36:55 fluxgen Exp $ | 23 | // $Id: CurrentWindowCmd.cc,v 1.9 2004/02/20 19:40:31 fluxgen Exp $ |
24 | 24 | ||
25 | #include "CurrentWindowCmd.hh" | 25 | #include "CurrentWindowCmd.hh" |
26 | 26 | ||
@@ -47,6 +47,19 @@ void SendToWorkspaceCmd::real_execute() { | |||
47 | fbwindow().screen().sendToWorkspace(m_workspace_num, &fbwindow()); | 47 | fbwindow().screen().sendToWorkspace(m_workspace_num, &fbwindow()); |
48 | } | 48 | } |
49 | 49 | ||
50 | void SendToNextWorkspaceCmd::real_execute() { | ||
51 | unsigned int workspace_num= | ||
52 | ( fbwindow().screen().currentWorkspaceID() + m_workspace_num ) % | ||
53 | fbwindow().screen().getNumberOfWorkspaces(); | ||
54 | fbwindow().screen().sendToWorkspace(workspace_num, &fbwindow()); | ||
55 | } | ||
56 | |||
57 | void SendToPrevWorkspaceCmd::real_execute() { | ||
58 | int workspace_num= fbwindow().screen().currentWorkspaceID() - m_workspace_num; | ||
59 | if ( workspace_num < 0 ) workspace_num+= fbwindow().screen().getNumberOfWorkspaces(); | ||
60 | fbwindow().screen().sendToWorkspace(workspace_num, &fbwindow()); | ||
61 | } | ||
62 | |||
50 | void WindowHelperCmd::execute() { | 63 | void WindowHelperCmd::execute() { |
51 | WinClient *client = Fluxbox::instance()->getFocusedWindow(); | 64 | WinClient *client = Fluxbox::instance()->getFocusedWindow(); |
52 | if (client && client->fbwindow()) // guarantee that fbwindow() exists too | 65 | if (client && client->fbwindow()) // guarantee that fbwindow() exists too |
diff --git a/src/CurrentWindowCmd.hh b/src/CurrentWindowCmd.hh index c4c559b..2c22f07 100644 --- a/src/CurrentWindowCmd.hh +++ b/src/CurrentWindowCmd.hh | |||
@@ -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: CurrentWindowCmd.hh,v 1.6 2003/10/25 22:11:22 fluxgen Exp $ | 23 | // $Id: CurrentWindowCmd.hh,v 1.7 2004/02/20 19:40:31 fluxgen Exp $ |
24 | 24 | ||
25 | #ifndef CURRENTWINDOWCMD_HH | 25 | #ifndef CURRENTWINDOWCMD_HH |
26 | #define CURRENTWINDOWCMD_HH | 26 | #define CURRENTWINDOWCMD_HH |
@@ -69,6 +69,24 @@ private: | |||
69 | const int m_workspace_num; | 69 | const int m_workspace_num; |
70 | }; | 70 | }; |
71 | 71 | ||
72 | class SendToNextWorkspaceCmd: public WindowHelperCmd { | ||
73 | public: | ||
74 | explicit SendToNextWorkspaceCmd(int workspace_num):m_workspace_num(workspace_num) { } | ||
75 | protected: | ||
76 | void real_execute(); | ||
77 | private: | ||
78 | const int m_workspace_num; | ||
79 | }; | ||
80 | |||
81 | class SendToPrevWorkspaceCmd: public WindowHelperCmd { | ||
82 | public: | ||
83 | explicit SendToPrevWorkspaceCmd(int workspace_num):m_workspace_num(workspace_num) { } | ||
84 | protected: | ||
85 | void real_execute(); | ||
86 | private: | ||
87 | const int m_workspace_num; | ||
88 | }; | ||
89 | |||
72 | // move cmd, relative position | 90 | // move cmd, relative position |
73 | class MoveCmd: public WindowHelperCmd { | 91 | class MoveCmd: public WindowHelperCmd { |
74 | public: | 92 | public: |
diff --git a/src/FbCommandFactory.cc b/src/FbCommandFactory.cc index 9e4ec8f..a275446 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.26 2004/01/21 14:11:42 fluxgen Exp $ | 23 | // $Id: FbCommandFactory.cc,v 1.27 2004/02/20 19:40:31 fluxgen Exp $ |
24 | 24 | ||
25 | #include "FbCommandFactory.hh" | 25 | #include "FbCommandFactory.hh" |
26 | 26 | ||
@@ -108,6 +108,8 @@ FbCommandFactory::FbCommandFactory() { | |||
108 | "rootmenu", | 108 | "rootmenu", |
109 | "saverc", | 109 | "saverc", |
110 | "sendtoworkspace", | 110 | "sendtoworkspace", |
111 | "sendtonextworkspace", | ||
112 | "sendtoprevworkspace", | ||
111 | "setstyle", | 113 | "setstyle", |
112 | "setworkspacename", | 114 | "setworkspacename", |
113 | "setworkspacenamedialog", | 115 | "setworkspacenamedialog", |
@@ -235,6 +237,10 @@ FbTk::Command *FbCommandFactory::stringToCommand(const std::string &command, | |||
235 | return new CurrentWindowCmd(&FluxboxWindow::toggleDecoration); | 237 | return new CurrentWindowCmd(&FluxboxWindow::toggleDecoration); |
236 | else if (command == "sendtoworkspace") | 238 | else if (command == "sendtoworkspace") |
237 | return new SendToWorkspaceCmd(atoi(arguments.c_str()) - 1); // make 1-indexed to user | 239 | return new SendToWorkspaceCmd(atoi(arguments.c_str()) - 1); // make 1-indexed to user |
240 | else if (command == "sendtonextworkspace") | ||
241 | return new SendToNextWorkspaceCmd(atoi(arguments.c_str())); | ||
242 | else if (command == "sendtoprevworkspace") | ||
243 | return new SendToPrevWorkspaceCmd(atoi(arguments.c_str())); | ||
238 | else if (command == "killwindow") | 244 | else if (command == "killwindow") |
239 | return new KillWindowCmd(); | 245 | return new KillWindowCmd(); |
240 | else if (command == "nexttab") | 246 | else if (command == "nexttab") |