diff options
author | mathias <mathias> | 2005-06-15 15:17:48 (GMT) |
---|---|---|
committer | mathias <mathias> | 2005-06-15 15:17:48 (GMT) |
commit | d69e300376db05642730792f34e38712f52efbc2 (patch) | |
tree | 97afcfc41bc49aaa05bbd0e7feb4b826f96c074f /src/CurrentWindowCmd.cc | |
parent | 93b295a1587f91366d16a0d8c7514a4cd841cd38 (diff) | |
download | fluxbox-d69e300376db05642730792f34e38712f52efbc2.zip fluxbox-d69e300376db05642730792f34e38712f52efbc2.tar.bz2 |
Enhanced MoveTo, fixes #1074568
MoveTo <int|*> <int|*> <Reference Corner>
- * means "use current value"
- Reference Corner is one of:
- UpperLeft, Upper, UpperRight
- Left, Right
- LowerLeft, Lower, Right
examples:
MoveTo 0 * Left -> snap to left workspace edge
MoveTo * 0 Lower -> snap to lower workspace edge
MoveTo 0 0 UpperRight -> snap to upper right workspace corner
TODO: perhaps add some "aliases" to make it more userfriendly
Diffstat (limited to 'src/CurrentWindowCmd.cc')
-rw-r--r-- | src/CurrentWindowCmd.cc | 26 |
1 files changed, 23 insertions, 3 deletions
diff --git a/src/CurrentWindowCmd.cc b/src/CurrentWindowCmd.cc index 834dcad..4db34c1 100644 --- a/src/CurrentWindowCmd.cc +++ b/src/CurrentWindowCmd.cc | |||
@@ -133,13 +133,33 @@ void ResizeCmd::real_execute() { | |||
133 | fbwindow().resize(w, h); | 133 | fbwindow().resize(w, h); |
134 | } | 134 | } |
135 | 135 | ||
136 | MoveToCmd::MoveToCmd(const int step_size_x, const int step_size_y) : | 136 | MoveToCmd::MoveToCmd(const int step_size_x, const int step_size_y, const unsigned int refc) : |
137 | m_step_size_x(step_size_x), m_step_size_y(step_size_y) { } | 137 | m_step_size_x(step_size_x), m_step_size_y(step_size_y), m_refc(refc) { } |
138 | 138 | ||
139 | void MoveToCmd::real_execute() { | 139 | void MoveToCmd::real_execute() { |
140 | fbwindow().move(m_step_size_x, m_step_size_y); | 140 | int x = 0; |
141 | int y = 0; | ||
142 | |||
143 | const int head = fbwindow().screen().getHead(fbwindow().fbWindow()); | ||
144 | |||
145 | if (m_refc & MoveToCmd::LOWER) | ||
146 | y = fbwindow().screen().maxBottom(head) - fbwindow().height() - m_step_size_y; | ||
147 | if (m_refc & MoveToCmd::UPPER) | ||
148 | y = fbwindow().screen().maxTop(head) + m_step_size_y; | ||
149 | if (m_refc & MoveToCmd::RIGHT) | ||
150 | x = fbwindow().screen().maxRight(head) - fbwindow().width() - m_step_size_x; | ||
151 | if (m_refc & MoveToCmd::LEFT) | ||
152 | x = fbwindow().screen().maxLeft(head) + m_step_size_x; | ||
153 | |||
154 | if (m_refc & MoveToCmd::IGNORE_X) | ||
155 | x = fbwindow().x(); | ||
156 | if (m_refc & MoveToCmd::IGNORE_Y) | ||
157 | y = fbwindow().y(); | ||
158 | |||
159 | fbwindow().move(x, y); | ||
141 | } | 160 | } |
142 | 161 | ||
162 | |||
143 | ResizeToCmd::ResizeToCmd(const int step_size_x, const int step_size_y) : | 163 | ResizeToCmd::ResizeToCmd(const int step_size_x, const int step_size_y) : |
144 | m_step_size_x(step_size_x), m_step_size_y(step_size_y) { } | 164 | m_step_size_x(step_size_x), m_step_size_y(step_size_y) { } |
145 | 165 | ||