aboutsummaryrefslogtreecommitdiff
path: root/src/Workspace.cc
diff options
context:
space:
mode:
authorrathnor <rathnor>2003-04-25 09:07:14 (GMT)
committerrathnor <rathnor>2003-04-25 09:07:14 (GMT)
commit384603e962dcbd34bc05a220d8fbf3e88a980e80 (patch)
treed1b1a9018c48bde8efca64391ddd422f8efe19bb /src/Workspace.cc
parent9014e53be3ad695776be2eed5d80cbaffaa18873 (diff)
downloadfluxbox-384603e962dcbd34bc05a220d8fbf3e88a980e80.zip
fluxbox-384603e962dcbd34bc05a220d8fbf3e88a980e80.tar.bz2
add UnderMousePlacement placement policy, plus a little fix for window
positioning (Simon)
Diffstat (limited to 'src/Workspace.cc')
-rw-r--r--src/Workspace.cc44
1 files changed, 42 insertions, 2 deletions
diff --git a/src/Workspace.cc b/src/Workspace.cc
index 9ddce15..4d357b0 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.53 2003/04/16 14:43:06 rathnor Exp $ 25// $Id: Workspace.cc,v 1.54 2003/04/25 09:07:13 rathnor Exp $
26 26
27#include "Workspace.hh" 27#include "Workspace.hh"
28 28
@@ -528,13 +528,53 @@ void Workspace::placeWindow(FluxboxWindow &win) {
528 if (screen.getRowPlacementDirection() == BScreen::RIGHTLEFT) 528 if (screen.getRowPlacementDirection() == BScreen::RIGHTLEFT)
529 change_x = -1; 529 change_x = -1;
530 530
531
532 int win_w = win.getWidth() + screen.getBorderWidth2x(), 531 int win_w = win.getWidth() + screen.getBorderWidth2x(),
533 win_h = win.getHeight() + screen.getBorderWidth2x(); 532 win_h = win.getHeight() + screen.getBorderWidth2x();
534 533
535 int test_x, test_y, curr_x, curr_y, curr_w, curr_h; 534 int test_x, test_y, curr_x, curr_y, curr_w, curr_h;
536 535
537 switch (screen.getPlacementPolicy()) { 536 switch (screen.getPlacementPolicy()) {
537 case BScreen::UNDERMOUSEPLACEMENT: {
538 int root_x, root_y, min_y, min_x, max_y, max_x, ignore_i;
539
540 unsigned int ignore_ui;
541
542 Window ignore_w;
543
544 XQueryPointer(screen.getBaseDisplay()->getXDisplay(),
545 screen.getRootWindow(), &ignore_w, &ignore_w, &root_x, &root_y,
546 &ignore_i, &ignore_i, &ignore_ui);
547
548 test_x = root_x - (win_w / 2);
549 test_y = root_y - (win_h / 2);
550
551 min_x = (int) screen.getMaxLeft();
552 min_y = (int) screen.getMaxTop();
553 max_x = (int) screen.getMaxRight() - win_w;
554 max_y = (int) screen.getMaxBottom() - win_h;
555
556 // keep the window inside the screen
557
558 if (test_x < min_x)
559 test_x = min_x;
560
561 if (test_x > max_x)
562 test_x = max_x;
563
564 if (test_y < min_y)
565 test_y = min_y;
566
567 if (test_y > max_y)
568 test_y = max_y;
569
570 place_x = test_x;
571 place_y = test_y;
572
573 placed = true;
574
575 break;
576 } // end case UNDERMOUSEPLACEMENT
577
538 case BScreen::ROWSMARTPLACEMENT: { 578 case BScreen::ROWSMARTPLACEMENT: {
539 579
540 test_y = 0; 580 test_y = 0;