added move command, thanks Mathias Gumz
This commit is contained in:
parent
90eb966c41
commit
b78edef5b6
3 changed files with 31 additions and 67 deletions
|
@ -20,7 +20,7 @@
|
|||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
// DEALINGS IN THE SOFTWARE.
|
||||
|
||||
// $Id: CurrentWindowCmd.cc,v 1.5 2003/09/06 15:43:27 fluxgen Exp $
|
||||
// $Id: CurrentWindowCmd.cc,v 1.6 2003/09/10 14:07:48 fluxgen Exp $
|
||||
|
||||
#include "CurrentWindowCmd.hh"
|
||||
|
||||
|
@ -63,26 +63,13 @@ FluxboxWindow &WindowHelperCmd::fbwindow() {
|
|||
return *Fluxbox::instance()->getFocusedWindow()->fbwindow();
|
||||
}
|
||||
|
||||
MoveLeftCmd::MoveLeftCmd(int step_size):MoveHelper(step_size) { }
|
||||
void MoveLeftCmd::real_execute() {
|
||||
fbwindow().move(fbwindow().x() - stepSize(),
|
||||
fbwindow().y());
|
||||
}
|
||||
MoveCmd::MoveCmd(const int step_size_x, const int step_size_y) :
|
||||
m_step_size_x(step_size_x), m_step_size_y(step_size_y) { }
|
||||
|
||||
MoveRightCmd::MoveRightCmd(int step_size):MoveHelper(step_size) { }
|
||||
void MoveRightCmd::real_execute() {
|
||||
fbwindow().move(fbwindow().x() + stepSize(),
|
||||
fbwindow().y());
|
||||
}
|
||||
|
||||
MoveDownCmd::MoveDownCmd(int step_size):MoveHelper(step_size) { }
|
||||
void MoveDownCmd::real_execute() {
|
||||
fbwindow().move(fbwindow().x(), fbwindow().y() + stepSize());
|
||||
}
|
||||
|
||||
MoveUpCmd::MoveUpCmd(int step_size):MoveHelper(step_size) { }
|
||||
void MoveUpCmd::real_execute() {
|
||||
fbwindow().move(fbwindow().x(), fbwindow().y() - stepSize());
|
||||
void MoveCmd::real_execute() {
|
||||
fbwindow().move(
|
||||
fbwindow().x() + m_step_size_x,
|
||||
fbwindow().y() + m_step_size_y );
|
||||
}
|
||||
|
||||
ResizeCmd::ResizeCmd(const int step_size_x, const int step_size_y) :
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
// DEALINGS IN THE SOFTWARE.
|
||||
|
||||
// $Id: CurrentWindowCmd.hh,v 1.4 2003/09/06 15:43:27 fluxgen Exp $
|
||||
// $Id: CurrentWindowCmd.hh,v 1.5 2003/09/10 14:07:48 fluxgen Exp $
|
||||
|
||||
#ifndef CURRENTWINDOWCMD_HH
|
||||
#define CURRENTWINDOWCMD_HH
|
||||
|
@ -69,48 +69,18 @@ private:
|
|||
const int m_workspace_num;
|
||||
};
|
||||
|
||||
class MoveHelper: public WindowHelperCmd {
|
||||
class MoveCmd: public WindowHelperCmd {
|
||||
public:
|
||||
explicit MoveHelper(int step_size):m_step_size(step_size) { }
|
||||
explicit MoveCmd(const int step_size_x, const int step_size_y);
|
||||
protected:
|
||||
int stepSize() const { return m_step_size; }
|
||||
void real_execute();
|
||||
|
||||
private:
|
||||
const int m_step_size;
|
||||
};
|
||||
/// move window to left
|
||||
class MoveLeftCmd: public MoveHelper {
|
||||
public:
|
||||
explicit MoveLeftCmd(int step_size);
|
||||
protected:
|
||||
void real_execute();
|
||||
const int m_step_size_x;
|
||||
const int m_step_size_y;
|
||||
};
|
||||
|
||||
/// move window to right
|
||||
class MoveRightCmd: public MoveHelper {
|
||||
public:
|
||||
explicit MoveRightCmd(int step_size);
|
||||
protected:
|
||||
void real_execute();
|
||||
};
|
||||
|
||||
/// move window up
|
||||
class MoveUpCmd: public MoveHelper {
|
||||
public:
|
||||
explicit MoveUpCmd(int step_size);
|
||||
protected:
|
||||
void real_execute();
|
||||
};
|
||||
|
||||
/// move window down
|
||||
class MoveDownCmd: public MoveHelper {
|
||||
public:
|
||||
explicit MoveDownCmd(int step_size);
|
||||
protected:
|
||||
void real_execute();
|
||||
};
|
||||
|
||||
// resize horizontal
|
||||
// resize cmd
|
||||
class ResizeCmd: public WindowHelperCmd{
|
||||
public:
|
||||
explicit ResizeCmd(int step_size_x, int step_size_y);
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
// DEALINGS IN THE SOFTWARE.
|
||||
|
||||
// $Id: FbCommandFactory.cc,v 1.15 2003/09/06 15:43:27 fluxgen Exp $
|
||||
// $Id: FbCommandFactory.cc,v 1.16 2003/09/10 14:06:37 fluxgen Exp $
|
||||
|
||||
#include "FbCommandFactory.hh"
|
||||
|
||||
|
@ -40,7 +40,7 @@ FbCommandFactory FbCommandFactory::s_autoreg;
|
|||
|
||||
FbCommandFactory::FbCommandFactory() {
|
||||
// setup commands that we can handle
|
||||
const char commands[][33] = {
|
||||
const char commands[][52] = {
|
||||
"arrangewindows",
|
||||
"close",
|
||||
"detachclient",
|
||||
|
@ -57,6 +57,7 @@ FbCommandFactory::FbCommandFactory() {
|
|||
"maximizewindow",
|
||||
"minimize",
|
||||
"minimizewindow",
|
||||
"move",
|
||||
"movedown",
|
||||
"moveleft",
|
||||
"moveright",
|
||||
|
@ -133,23 +134,29 @@ FbTk::Command *FbCommandFactory::stringToCommand(const std::string &command,
|
|||
else if (command == "maximizehorizontal")
|
||||
return new CurrentWindowCmd(&FluxboxWindow::maximizeHorizontal);
|
||||
else if (command == "resize") {
|
||||
std::istringstream is(arguments);
|
||||
int dx = 0, dy = 0;
|
||||
is >> dx >> dy;
|
||||
return new ResizeCmd(dx, dy);
|
||||
std::istringstream is(arguments);
|
||||
int dx = 0, dy = 0;
|
||||
is >> dx >> dy;
|
||||
return new ResizeCmd(dx, dy);
|
||||
}
|
||||
else if (command == "resizehorizontal")
|
||||
return new ResizeCmd(atoi(arguments.c_str()),0);
|
||||
else if (command == "resizevertical")
|
||||
return new ResizeCmd(0,atoi(arguments.c_str()));
|
||||
else if (command == "move") {
|
||||
std::istringstream is(arguments);
|
||||
int dx = 0, dy = 0;
|
||||
is >> dx >> dy;
|
||||
return new MoveCmd(dx, dy);
|
||||
}
|
||||
else if (command == "moveright")
|
||||
return new MoveRightCmd(atoi(arguments.c_str()));
|
||||
return new MoveCmd(atoi(arguments.c_str()),0);
|
||||
else if (command == "moveleft")
|
||||
return new MoveLeftCmd(atoi(arguments.c_str()));
|
||||
return new MoveCmd(-atoi(arguments.c_str()),0);
|
||||
else if (command == "moveup")
|
||||
return new MoveUpCmd(atoi(arguments.c_str()));
|
||||
return new MoveCmd(0,-atoi(arguments.c_str()));
|
||||
else if (command == "movedown")
|
||||
return new MoveDownCmd(atoi(arguments.c_str()));
|
||||
return new MoveCmd(0,atoi(arguments.c_str()));
|
||||
else if (command == "raise")
|
||||
return new CurrentWindowCmd(&FluxboxWindow::raise);
|
||||
else if (command == "lower")
|
||||
|
|
Loading…
Reference in a new issue