aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorfluxgen <fluxgen>2003-09-10 14:07:48 (GMT)
committerfluxgen <fluxgen>2003-09-10 14:07:48 (GMT)
commitb78edef5b6e39822142dd91331a53ab38b147f05 (patch)
treea2842f409b3032f0aa041e14a0558718af023270 /src
parent90eb966c41af507c2995804213ec33ba833529cc (diff)
downloadfluxbox-b78edef5b6e39822142dd91331a53ab38b147f05.zip
fluxbox-b78edef5b6e39822142dd91331a53ab38b147f05.tar.bz2
added move command, thanks Mathias Gumz
Diffstat (limited to 'src')
-rw-r--r--src/CurrentWindowCmd.cc27
-rw-r--r--src/CurrentWindowCmd.hh44
-rw-r--r--src/FbCommandFactory.cc27
3 files changed, 31 insertions, 67 deletions
diff --git a/src/CurrentWindowCmd.cc b/src/CurrentWindowCmd.cc
index 894eaa3..4f49362 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.5 2003/09/06 15:43:27 fluxgen Exp $ 23// $Id: CurrentWindowCmd.cc,v 1.6 2003/09/10 14:07:48 fluxgen Exp $
24 24
25#include "CurrentWindowCmd.hh" 25#include "CurrentWindowCmd.hh"
26 26
@@ -63,26 +63,13 @@ FluxboxWindow &WindowHelperCmd::fbwindow() {
63 return *Fluxbox::instance()->getFocusedWindow()->fbwindow(); 63 return *Fluxbox::instance()->getFocusedWindow()->fbwindow();
64} 64}
65 65
66MoveLeftCmd::MoveLeftCmd(int step_size):MoveHelper(step_size) { } 66MoveCmd::MoveCmd(const int step_size_x, const int step_size_y) :
67void MoveLeftCmd::real_execute() { 67 m_step_size_x(step_size_x), m_step_size_y(step_size_y) { }
68 fbwindow().move(fbwindow().x() - stepSize(),
69 fbwindow().y());
70}
71
72MoveRightCmd::MoveRightCmd(int step_size):MoveHelper(step_size) { }
73void MoveRightCmd::real_execute() {
74 fbwindow().move(fbwindow().x() + stepSize(),
75 fbwindow().y());
76}
77
78MoveDownCmd::MoveDownCmd(int step_size):MoveHelper(step_size) { }
79void MoveDownCmd::real_execute() {
80 fbwindow().move(fbwindow().x(), fbwindow().y() + stepSize());
81}
82 68
83MoveUpCmd::MoveUpCmd(int step_size):MoveHelper(step_size) { } 69void MoveCmd::real_execute() {
84void MoveUpCmd::real_execute() { 70 fbwindow().move(
85 fbwindow().move(fbwindow().x(), fbwindow().y() - stepSize()); 71 fbwindow().x() + m_step_size_x,
72 fbwindow().y() + m_step_size_y );
86} 73}
87 74
88ResizeCmd::ResizeCmd(const int step_size_x, const int step_size_y) : 75ResizeCmd::ResizeCmd(const int step_size_x, const int step_size_y) :
diff --git a/src/CurrentWindowCmd.hh b/src/CurrentWindowCmd.hh
index 05015a0..18bcc45 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.4 2003/09/06 15:43:27 fluxgen Exp $ 23// $Id: CurrentWindowCmd.hh,v 1.5 2003/09/10 14:07:48 fluxgen Exp $
24 24
25#ifndef CURRENTWINDOWCMD_HH 25#ifndef CURRENTWINDOWCMD_HH
26#define CURRENTWINDOWCMD_HH 26#define CURRENTWINDOWCMD_HH
@@ -69,48 +69,18 @@ private:
69 const int m_workspace_num; 69 const int m_workspace_num;
70}; 70};
71 71
72class MoveHelper: public WindowHelperCmd { 72class MoveCmd: public WindowHelperCmd {
73public: 73public:
74 explicit MoveHelper(int step_size):m_step_size(step_size) { } 74 explicit MoveCmd(const int step_size_x, const int step_size_y);
75protected:
76 int stepSize() const { return m_step_size; }
77
78private:
79 const int m_step_size;
80};
81/// move window to left
82class MoveLeftCmd: public MoveHelper {
83public:
84 explicit MoveLeftCmd(int step_size);
85protected:
86 void real_execute();
87};
88
89/// move window to right
90class MoveRightCmd: public MoveHelper {
91public:
92 explicit MoveRightCmd(int step_size);
93protected: 75protected:
94 void real_execute(); 76 void real_execute();
95};
96
97/// move window up
98class MoveUpCmd: public MoveHelper {
99public:
100 explicit MoveUpCmd(int step_size);
101protected:
102 void real_execute();
103};
104 77
105/// move window down 78private:
106class MoveDownCmd: public MoveHelper { 79 const int m_step_size_x;
107public: 80 const int m_step_size_y;
108 explicit MoveDownCmd(int step_size);
109protected:
110 void real_execute();
111}; 81};
112 82
113// resize horizontal 83// resize cmd
114class ResizeCmd: public WindowHelperCmd{ 84class ResizeCmd: public WindowHelperCmd{
115public: 85public:
116 explicit ResizeCmd(int step_size_x, int step_size_y); 86 explicit ResizeCmd(int step_size_x, int step_size_y);
diff --git a/src/FbCommandFactory.cc b/src/FbCommandFactory.cc
index f9e22ce..d7bea89 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.15 2003/09/06 15:43:27 fluxgen Exp $ 23// $Id: FbCommandFactory.cc,v 1.16 2003/09/10 14:06:37 fluxgen Exp $
24 24
25#include "FbCommandFactory.hh" 25#include "FbCommandFactory.hh"
26 26
@@ -40,7 +40,7 @@ FbCommandFactory FbCommandFactory::s_autoreg;
40 40
41FbCommandFactory::FbCommandFactory() { 41FbCommandFactory::FbCommandFactory() {
42 // setup commands that we can handle 42 // setup commands that we can handle
43 const char commands[][33] = { 43 const char commands[][52] = {
44 "arrangewindows", 44 "arrangewindows",
45 "close", 45 "close",
46 "detachclient", 46 "detachclient",
@@ -57,6 +57,7 @@ FbCommandFactory::FbCommandFactory() {
57 "maximizewindow", 57 "maximizewindow",
58 "minimize", 58 "minimize",
59 "minimizewindow", 59 "minimizewindow",
60 "move",
60 "movedown", 61 "movedown",
61 "moveleft", 62 "moveleft",
62 "moveright", 63 "moveright",
@@ -133,23 +134,29 @@ FbTk::Command *FbCommandFactory::stringToCommand(const std::string &command,
133 else if (command == "maximizehorizontal") 134 else if (command == "maximizehorizontal")
134 return new CurrentWindowCmd(&FluxboxWindow::maximizeHorizontal); 135 return new CurrentWindowCmd(&FluxboxWindow::maximizeHorizontal);
135 else if (command == "resize") { 136 else if (command == "resize") {
136 std::istringstream is(arguments); 137 std::istringstream is(arguments);
137 int dx = 0, dy = 0; 138 int dx = 0, dy = 0;
138 is >> dx >> dy; 139 is >> dx >> dy;
139 return new ResizeCmd(dx, dy); 140 return new ResizeCmd(dx, dy);
140 } 141 }
141 else if (command == "resizehorizontal") 142 else if (command == "resizehorizontal")
142 return new ResizeCmd(atoi(arguments.c_str()),0); 143 return new ResizeCmd(atoi(arguments.c_str()),0);
143 else if (command == "resizevertical") 144 else if (command == "resizevertical")
144 return new ResizeCmd(0,atoi(arguments.c_str())); 145 return new ResizeCmd(0,atoi(arguments.c_str()));
146 else if (command == "move") {
147 std::istringstream is(arguments);
148 int dx = 0, dy = 0;
149 is >> dx >> dy;
150 return new MoveCmd(dx, dy);
151 }
145 else if (command == "moveright") 152 else if (command == "moveright")
146 return new MoveRightCmd(atoi(arguments.c_str())); 153 return new MoveCmd(atoi(arguments.c_str()),0);
147 else if (command == "moveleft") 154 else if (command == "moveleft")
148 return new MoveLeftCmd(atoi(arguments.c_str())); 155 return new MoveCmd(-atoi(arguments.c_str()),0);
149 else if (command == "moveup") 156 else if (command == "moveup")
150 return new MoveUpCmd(atoi(arguments.c_str())); 157 return new MoveCmd(0,-atoi(arguments.c_str()));
151 else if (command == "movedown") 158 else if (command == "movedown")
152 return new MoveDownCmd(atoi(arguments.c_str())); 159 return new MoveCmd(0,atoi(arguments.c_str()));
153 else if (command == "raise") 160 else if (command == "raise")
154 return new CurrentWindowCmd(&FluxboxWindow::raise); 161 return new CurrentWindowCmd(&FluxboxWindow::raise);
155 else if (command == "lower") 162 else if (command == "lower")