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
|
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||||
// DEALINGS IN THE SOFTWARE.
|
// 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"
|
#include "CurrentWindowCmd.hh"
|
||||||
|
|
||||||
|
@ -63,26 +63,13 @@ FluxboxWindow &WindowHelperCmd::fbwindow() {
|
||||||
return *Fluxbox::instance()->getFocusedWindow()->fbwindow();
|
return *Fluxbox::instance()->getFocusedWindow()->fbwindow();
|
||||||
}
|
}
|
||||||
|
|
||||||
MoveLeftCmd::MoveLeftCmd(int step_size):MoveHelper(step_size) { }
|
MoveCmd::MoveCmd(const int step_size_x, const int step_size_y) :
|
||||||
void MoveLeftCmd::real_execute() {
|
m_step_size_x(step_size_x), m_step_size_y(step_size_y) { }
|
||||||
fbwindow().move(fbwindow().x() - stepSize(),
|
|
||||||
fbwindow().y());
|
|
||||||
}
|
|
||||||
|
|
||||||
MoveRightCmd::MoveRightCmd(int step_size):MoveHelper(step_size) { }
|
void MoveCmd::real_execute() {
|
||||||
void MoveRightCmd::real_execute() {
|
fbwindow().move(
|
||||||
fbwindow().move(fbwindow().x() + stepSize(),
|
fbwindow().x() + m_step_size_x,
|
||||||
fbwindow().y());
|
fbwindow().y() + m_step_size_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());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ResizeCmd::ResizeCmd(const int step_size_x, const int 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
|
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||||
// DEALINGS IN THE SOFTWARE.
|
// 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
|
#ifndef CURRENTWINDOWCMD_HH
|
||||||
#define CURRENTWINDOWCMD_HH
|
#define CURRENTWINDOWCMD_HH
|
||||||
|
@ -69,48 +69,18 @@ private:
|
||||||
const int m_workspace_num;
|
const int m_workspace_num;
|
||||||
};
|
};
|
||||||
|
|
||||||
class MoveHelper: public WindowHelperCmd {
|
class MoveCmd: public WindowHelperCmd {
|
||||||
public:
|
public:
|
||||||
explicit MoveHelper(int step_size):m_step_size(step_size) { }
|
explicit MoveCmd(const int step_size_x, const int step_size_y);
|
||||||
protected:
|
protected:
|
||||||
int stepSize() const { return m_step_size; }
|
void real_execute();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
const int m_step_size;
|
const int m_step_size_x;
|
||||||
};
|
const int m_step_size_y;
|
||||||
/// move window to left
|
|
||||||
class MoveLeftCmd: public MoveHelper {
|
|
||||||
public:
|
|
||||||
explicit MoveLeftCmd(int step_size);
|
|
||||||
protected:
|
|
||||||
void real_execute();
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/// move window to right
|
// resize cmd
|
||||||
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
|
|
||||||
class ResizeCmd: public WindowHelperCmd{
|
class ResizeCmd: public WindowHelperCmd{
|
||||||
public:
|
public:
|
||||||
explicit ResizeCmd(int step_size_x, int step_size_y);
|
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
|
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||||
// DEALINGS IN THE SOFTWARE.
|
// 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"
|
#include "FbCommandFactory.hh"
|
||||||
|
|
||||||
|
@ -40,7 +40,7 @@ FbCommandFactory FbCommandFactory::s_autoreg;
|
||||||
|
|
||||||
FbCommandFactory::FbCommandFactory() {
|
FbCommandFactory::FbCommandFactory() {
|
||||||
// setup commands that we can handle
|
// setup commands that we can handle
|
||||||
const char commands[][33] = {
|
const char commands[][52] = {
|
||||||
"arrangewindows",
|
"arrangewindows",
|
||||||
"close",
|
"close",
|
||||||
"detachclient",
|
"detachclient",
|
||||||
|
@ -57,6 +57,7 @@ FbCommandFactory::FbCommandFactory() {
|
||||||
"maximizewindow",
|
"maximizewindow",
|
||||||
"minimize",
|
"minimize",
|
||||||
"minimizewindow",
|
"minimizewindow",
|
||||||
|
"move",
|
||||||
"movedown",
|
"movedown",
|
||||||
"moveleft",
|
"moveleft",
|
||||||
"moveright",
|
"moveright",
|
||||||
|
@ -142,14 +143,20 @@ FbTk::Command *FbCommandFactory::stringToCommand(const std::string &command,
|
||||||
return new ResizeCmd(atoi(arguments.c_str()),0);
|
return new ResizeCmd(atoi(arguments.c_str()),0);
|
||||||
else if (command == "resizevertical")
|
else if (command == "resizevertical")
|
||||||
return new ResizeCmd(0,atoi(arguments.c_str()));
|
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")
|
else if (command == "moveright")
|
||||||
return new MoveRightCmd(atoi(arguments.c_str()));
|
return new MoveCmd(atoi(arguments.c_str()),0);
|
||||||
else if (command == "moveleft")
|
else if (command == "moveleft")
|
||||||
return new MoveLeftCmd(atoi(arguments.c_str()));
|
return new MoveCmd(-atoi(arguments.c_str()),0);
|
||||||
else if (command == "moveup")
|
else if (command == "moveup")
|
||||||
return new MoveUpCmd(atoi(arguments.c_str()));
|
return new MoveCmd(0,-atoi(arguments.c_str()));
|
||||||
else if (command == "movedown")
|
else if (command == "movedown")
|
||||||
return new MoveDownCmd(atoi(arguments.c_str()));
|
return new MoveCmd(0,atoi(arguments.c_str()));
|
||||||
else if (command == "raise")
|
else if (command == "raise")
|
||||||
return new CurrentWindowCmd(&FluxboxWindow::raise);
|
return new CurrentWindowCmd(&FluxboxWindow::raise);
|
||||||
else if (command == "lower")
|
else if (command == "lower")
|
||||||
|
|
Loading…
Reference in a new issue