aboutsummaryrefslogtreecommitdiff
path: root/src/Window.cc
diff options
context:
space:
mode:
authorrathnor <rathnor>2003-05-20 11:03:11 (GMT)
committerrathnor <rathnor>2003-05-20 11:03:11 (GMT)
commita88511a4a772ec021029649905b7ce645ff9a597 (patch)
treed75369cc8a4e7b2be9bf9ef1ecc3d5ac771dbc6f /src/Window.cc
parentf911c4035fe86ed4c85a79f96aaab30902d56f89 (diff)
downloadfluxbox_pavel-a88511a4a772ec021029649905b7ce645ff9a597.zip
fluxbox_pavel-a88511a4a772ec021029649905b7ce645ff9a597.tar.bz2
xinerama for placement + snapping, + tidy
Diffstat (limited to 'src/Window.cc')
-rw-r--r--src/Window.cc46
1 files changed, 29 insertions, 17 deletions
diff --git a/src/Window.cc b/src/Window.cc
index 032c4cd..3254b50 100644
--- a/src/Window.cc
+++ b/src/Window.cc
@@ -22,7 +22,7 @@
22// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 22// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
23// DEALINGS IN THE SOFTWARE. 23// DEALINGS IN THE SOFTWARE.
24 24
25// $Id: Window.cc,v 1.182 2003/05/19 22:43:48 fluxgen Exp $ 25// $Id: Window.cc,v 1.183 2003/05/20 11:03:10 rathnor Exp $
26 26
27#include "Window.hh" 27#include "Window.hh"
28 28
@@ -1381,16 +1381,17 @@ void FluxboxWindow::maximize() {
1381 1381
1382 if (!maximized) { 1382 if (!maximized) {
1383 // save old values 1383 // save old values
1384 int head = screen().getHead(frame().window());
1384 m_old_width = frame().width(); 1385 m_old_width = frame().width();
1385 m_old_height = frame().height(); 1386 m_old_height = frame().height();
1386 m_old_pos_x = frame().x(); 1387 m_old_pos_x = frame().x();
1387 m_old_pos_y = frame().y(); 1388 m_old_pos_y = frame().y();
1388 unsigned int left_x = screen().maxLeft(frame().window()); 1389 unsigned int left_x = screen().maxLeft(head);
1389 unsigned int max_width = screen().maxRight(frame().window()); 1390 unsigned int max_width = screen().maxRight(head);
1390 unsigned int max_top = screen().maxTop(frame().window()); 1391 unsigned int max_top = screen().maxTop(head);
1391 moveResize(left_x, max_top, 1392 moveResize(left_x, max_top,
1392 max_width - left_x - 2*frame().window().borderWidth(), 1393 max_width - left_x - 2*frame().window().borderWidth(),
1393 screen().maxBottom(frame().window()) - max_top - 2*frame().window().borderWidth()); 1394 screen().maxBottom(head) - max_top - 2*frame().window().borderWidth());
1394 } else { // demaximize, restore to old values 1395 } else { // demaximize, restore to old values
1395 moveResize(m_old_pos_x, m_old_pos_y, 1396 moveResize(m_old_pos_x, m_old_pos_y,
1396 m_old_width, m_old_height); 1397 m_old_width, m_old_height);
@@ -1400,8 +1401,9 @@ void FluxboxWindow::maximize() {
1400} 1401}
1401 1402
1402void FluxboxWindow::maximizeHorizontal() { 1403void FluxboxWindow::maximizeHorizontal() {
1403 unsigned int left_x = screen().maxLeft(frame().window()); 1404 int head = screen().getHead(frame().window());
1404 unsigned int max_width = screen().maxRight(frame().window()); 1405 unsigned int left_x = screen().maxLeft(head);
1406 unsigned int max_width = screen().maxRight(head);
1405 moveResize(left_x, frame().y(), 1407 moveResize(left_x, frame().y(),
1406 max_width - left_x - 2*frame().window().borderWidth(), frame().height()); 1408 max_width - left_x - 2*frame().window().borderWidth(), frame().height());
1407 1409
@@ -1411,10 +1413,11 @@ void FluxboxWindow::maximizeHorizontal() {
1411 Maximize window horizontal 1413 Maximize window horizontal
1412 */ 1414 */
1413void FluxboxWindow::maximizeVertical() { 1415void FluxboxWindow::maximizeVertical() {
1414 unsigned int max_top = screen().maxTop(frame().window()); 1416 int head = screen().getHead(frame().window());
1417 unsigned int max_top = screen().maxTop(head);
1415 moveResize(frame().x(), max_top, 1418 moveResize(frame().x(), max_top,
1416 frame().width(), 1419 frame().width(),
1417 screen().maxBottom(frame().window()) - max_top - 2*frame().window().borderWidth()); 1420 screen().maxBottom(head) - max_top - 2*frame().window().borderWidth());
1418} 1421}
1419 1422
1420 1423
@@ -2899,17 +2902,15 @@ inline void snapToWindow(int &xlimit, int &ylimit,
2899} 2902}
2900 2903
2901/* 2904/*
2902 * Do Whatever snapping magic is necessary, and return using the left and top variables 2905 * Do Whatever snapping magic is necessary, and return using the orig_left
2903 * to indicate the new x,y position 2906 * and orig_top variables to indicate the new x,y position
2904 */ 2907 */
2905void FluxboxWindow::doSnapping(int &orig_left, int &orig_top) { 2908void FluxboxWindow::doSnapping(int &orig_left, int &orig_top) {
2906 /* 2909 /*
2907 * Snap to screen edge 2910 * Snap to screen/head edges
2908 * Snap to windows 2911 * Snap to windows
2909 * Snap to toolbar 2912 * Snap to toolbar
2910 * Snap to slit 2913 * Snap to slit
2911 * TODO:
2912 * Xinerama screen edge?
2913 */ 2914 */
2914 2915
2915 if (screen().getEdgeSnapThreshold() == 0) return; 2916 if (screen().getEdgeSnapThreshold() == 0) return;
@@ -2928,9 +2929,20 @@ void FluxboxWindow::doSnapping(int &orig_left, int &orig_top) {
2928 int bottom = orig_top + height() + 2*borderW; 2929 int bottom = orig_top + height() + 2*borderW;
2929 2930
2930 ///////////////////////////////////// 2931 /////////////////////////////////////
2931 // begin by checking the screen edges 2932 // begin by checking the screen (or Xinerama head) edges
2932 2933
2933 snapToWindow(dx, dy, left, right, top, bottom, 0, screen().width(), 0, screen().height()); 2934 if (screen().hasXinerama()) {
2935 // head "0" == whole screen width + height, which we skip since the
2936 // sum of all the heads covers those edges
2937 for (int h = 1; h <= screen().numHeads(); h++) {
2938 snapToWindow(dx, dy, left, right, top, bottom,
2939 screen().maxLeft(h),
2940 screen().maxRight(h),
2941 screen().maxTop(h),
2942 screen().maxBottom(h));
2943 }
2944 } else
2945 snapToWindow(dx, dy, left, right, top, bottom, 0, screen().width(), 0, screen().height());
2934 2946
2935 ///////////////////////////////////// 2947 /////////////////////////////////////
2936 // now check window edges 2948 // now check window edges