aboutsummaryrefslogtreecommitdiff
path: root/src/Workspace.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/Workspace.cc
parentf911c4035fe86ed4c85a79f96aaab30902d56f89 (diff)
downloadfluxbox-a88511a4a772ec021029649905b7ce645ff9a597.zip
fluxbox-a88511a4a772ec021029649905b7ce645ff9a597.tar.bz2
xinerama for placement + snapping, + tidy
Diffstat (limited to 'src/Workspace.cc')
-rw-r--r--src/Workspace.cc68
1 files changed, 34 insertions, 34 deletions
diff --git a/src/Workspace.cc b/src/Workspace.cc
index db0cac2..2bf2450 100644
--- a/src/Workspace.cc
+++ b/src/Workspace.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: Workspace.cc,v 1.67 2003/05/19 15:32:47 rathnor Exp $ 25// $Id: Workspace.cc,v 1.68 2003/05/20 11:03:11 rathnor Exp $
26 26
27#include "Workspace.hh" 27#include "Workspace.hh"
28 28
@@ -479,7 +479,14 @@ void Workspace::placeWindow(FluxboxWindow &win) {
479 479
480 bool placed = false; 480 bool placed = false;
481 481
482 int place_x = 0, place_y = 0, change_x = 1, change_y = 1; 482 // restrictions
483 int head = (signed) screen().getCurrHead();
484 int head_left = (signed) screen().maxLeft(head);
485 int head_right = (signed) screen().maxRight(head);
486 int head_top = (signed) screen().maxTop(head);
487 int head_bot = (signed) screen().maxBottom(head);
488
489 int place_x = head_left, place_y = head_top, change_x = 1, change_y = 1;
483 490
484 if (screen().getColPlacementDirection() == BScreen::BOTTOMTOP) 491 if (screen().getColPlacementDirection() == BScreen::BOTTOMTOP)
485 change_y = -1; 492 change_y = -1;
@@ -494,7 +501,7 @@ void Workspace::placeWindow(FluxboxWindow &win) {
494 501
495 switch (screen().getPlacementPolicy()) { 502 switch (screen().getPlacementPolicy()) {
496 case BScreen::UNDERMOUSEPLACEMENT: { 503 case BScreen::UNDERMOUSEPLACEMENT: {
497 int root_x, root_y, min_y, min_x, max_y, max_x, ignore_i; 504 int root_x, root_y, ignore_i;
498 505
499 unsigned int ignore_ui; 506 unsigned int ignore_ui;
500 507
@@ -508,24 +515,19 @@ void Workspace::placeWindow(FluxboxWindow &win) {
508 test_x = root_x - (win_w / 2); 515 test_x = root_x - (win_w / 2);
509 test_y = root_y - (win_h / 2); 516 test_y = root_y - (win_h / 2);
510 517
511 min_x = (int) screen().maxLeft(win.frame().window());
512 min_y = (int) screen().maxTop(win.frame().window());
513 max_x = (int) screen().maxRight(win.frame().window()) - win_w;
514 max_y = (int) screen().maxBottom(win.frame().window()) - win_h;
515
516 // keep the window inside the screen 518 // keep the window inside the screen
517 519
518 if (test_x < min_x) 520 if (test_x < head_left)
519 test_x = min_x; 521 test_x = head_left;
520 522
521 if (test_x > max_x) 523 if (test_x > head_right)
522 test_x = max_x; 524 test_x = head_right;
523 525
524 if (test_y < min_y) 526 if (test_y < head_top)
525 test_y = min_y; 527 test_y = head_top;
526 528
527 if (test_y > max_y) 529 if (test_y > head_bot)
528 test_y = max_y; 530 test_y = head_bot;
529 531
530 place_x = test_x; 532 place_x = test_x;
531 place_y = test_y; 533 place_y = test_y;
@@ -540,21 +542,21 @@ void Workspace::placeWindow(FluxboxWindow &win) {
540 test_y = 0; 542 test_y = 0;
541 543
542 if (screen().getColPlacementDirection() == BScreen::BOTTOMTOP) 544 if (screen().getColPlacementDirection() == BScreen::BOTTOMTOP)
543 test_y = screen().height() - win_h - test_y; 545 test_y = head_bot - win_h - test_y;
544 546
545 547
546 while (((screen().getColPlacementDirection() == BScreen::BOTTOMTOP) ? 548 while (((screen().getColPlacementDirection() == BScreen::BOTTOMTOP) ?
547 test_y > 0 : test_y + win_h < (signed) screen().height()) && 549 test_y > 0 : test_y + win_h < head_bot) &&
548 ! placed) { 550 ! placed) {
549 551
550 test_x = 0; 552 test_x = 0;
551 553
552 if (screen().getRowPlacementDirection() == BScreen::RIGHTLEFT) 554 if (screen().getRowPlacementDirection() == BScreen::RIGHTLEFT)
553 test_x = screen().width() - win_w - test_x; 555 test_x = head_right - win_w - test_x;
554 556
555 557
556 while (((screen().getRowPlacementDirection() == BScreen::RIGHTLEFT) ? 558 while (((screen().getRowPlacementDirection() == BScreen::RIGHTLEFT) ?
557 test_x > 0 : test_x + win_w < (signed) screen().width()) && ! placed) { 559 test_x > 0 : test_x + win_w < head_right) && ! placed) {
558 560
559 placed = true; 561 placed = true;
560 562
@@ -596,23 +598,21 @@ void Workspace::placeWindow(FluxboxWindow &win) {
596 } // end case ROWSMARTPLACEMENT 598 } // end case ROWSMARTPLACEMENT
597 599
598 case BScreen::COLSMARTPLACEMENT: { 600 case BScreen::COLSMARTPLACEMENT: {
599 test_x = 0; 601 test_x = head_left;
600 602
601 if (screen().getRowPlacementDirection() == BScreen::RIGHTLEFT) 603 if (screen().getRowPlacementDirection() == BScreen::RIGHTLEFT)
602 604 test_x = head_right - win_w;
603 test_x = screen().width() - win_w - test_x;
604
605 605
606 while (((screen().getRowPlacementDirection() == BScreen::RIGHTLEFT) ? 606 while (((screen().getRowPlacementDirection() == BScreen::RIGHTLEFT) ?
607 test_x > 0 : test_x + win_w < (signed) screen().width()) && 607 test_x > head_left : test_x + win_w < head_right) &&
608 !placed) { 608 !placed) {
609 609
610 test_y = 0; 610 test_y = head_top;
611 if (screen().getColPlacementDirection() == BScreen::BOTTOMTOP) 611 if (screen().getColPlacementDirection() == BScreen::BOTTOMTOP)
612 test_y = screen().height() - win_h - test_y; 612 test_y = head_bot - win_h;
613 613
614 while (((screen().getColPlacementDirection() == BScreen::BOTTOMTOP) ? 614 while (((screen().getColPlacementDirection() == BScreen::BOTTOMTOP) ?
615 test_y > 0 : test_y + win_h < (signed) screen().height()) && 615 test_y > head_top : test_y + win_h < head_bot) &&
616 !placed) { 616 !placed) {
617 placed = True; 617 placed = True;
618 618
@@ -657,8 +657,8 @@ void Workspace::placeWindow(FluxboxWindow &win) {
657 // cascade placement or smart placement failed 657 // cascade placement or smart placement failed
658 if (! placed) { 658 if (! placed) {
659 659
660 if (((unsigned) m_cascade_x > (screen().width() / 2)) || 660 if ((m_cascade_x > ((head_left + head_right) / 2)) ||
661 ((unsigned) m_cascade_y > (screen().height() / 2))) 661 (m_cascade_y > ((head_top + head_bot) / 2)))
662 m_cascade_x = m_cascade_y = 32; 662 m_cascade_x = m_cascade_y = 32;
663 663
664 place_x = m_cascade_x; 664 place_x = m_cascade_x;
@@ -668,10 +668,10 @@ void Workspace::placeWindow(FluxboxWindow &win) {
668 m_cascade_y += win.titleHeight(); 668 m_cascade_y += win.titleHeight();
669 } 669 }
670 670
671 if (place_x + win_w > (signed) screen().width()) 671 if (place_x + win_w > head_right)
672 place_x = (((signed) screen().width()) - win_w) / 2; 672 place_x = (head_right - win_w) / 2;
673 if (place_y + win_h > (signed) screen().height()) 673 if (place_y + win_h > head_bot)
674 place_y = (((signed) screen().height()) - win_h) / 2; 674 place_y = (head_bot - win_h) / 2;
675 675
676 676
677 win.moveResize(place_x, place_y, win.width(), win.height()); 677 win.moveResize(place_x, place_y, win.width(), win.height());