diff options
author | fluxgen <fluxgen> | 2003-02-16 16:40:19 (GMT) |
---|---|---|
committer | fluxgen <fluxgen> | 2003-02-16 16:40:19 (GMT) |
commit | 98a3f4c7269f6bceb0439024e67bd09c44d17df0 (patch) | |
tree | 91e6e31baeb71aa4a2a99dc2aad7937acc6a6f25 /src | |
parent | 9db6e018950bd831d08d9fda605e1fe89b148699 (diff) | |
download | fluxbox_lack-98a3f4c7269f6bceb0439024e67bd09c44d17df0.zip fluxbox_lack-98a3f4c7269f6bceb0439024e67bd09c44d17df0.tar.bz2 |
changed screen pointer to reference and fixed client menu
Diffstat (limited to 'src')
-rw-r--r-- | src/Workspace.cc | 212 |
1 files changed, 115 insertions, 97 deletions
diff --git a/src/Workspace.cc b/src/Workspace.cc index 694292e..1e3c8d0 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.46 2003/02/09 14:11:13 rathnor Exp $ | 25 | // $Id: Workspace.cc,v 1.47 2003/02/16 16:40:19 fluxgen Exp $ |
26 | 26 | ||
27 | #include "Workspace.hh" | 27 | #include "Workspace.hh" |
28 | 28 | ||
@@ -32,6 +32,7 @@ | |||
32 | #include "Window.hh" | 32 | #include "Window.hh" |
33 | #include "StringUtil.hh" | 33 | #include "StringUtil.hh" |
34 | #include "Slit.hh" | 34 | #include "Slit.hh" |
35 | #include "SimpleCommand.hh" | ||
35 | 36 | ||
36 | // use GNU extensions | 37 | // use GNU extensions |
37 | #ifndef _GNU_SOURCE | 38 | #ifndef _GNU_SOURCE |
@@ -68,20 +69,40 @@ int countTransients(const FluxboxWindow &win) { | |||
68 | return ret; | 69 | return ret; |
69 | } | 70 | } |
70 | 71 | ||
72 | class RaiseFocusAndSetWorkspace: public FbTk::Command { | ||
73 | public: | ||
74 | RaiseFocusAndSetWorkspace(Workspace &space, FluxboxWindow &win): | ||
75 | m_space(space), m_win(win) { } | ||
76 | void execute() { | ||
77 | // determine workspace change | ||
78 | for (size_t i=0; i<m_space.getScreen().getCount(); i++) { | ||
79 | if (m_space.getScreen().getWorkspace(i) == &m_space) { | ||
80 | m_space.getScreen().changeWorkspaceID(i); | ||
81 | break; | ||
82 | } | ||
83 | } | ||
84 | |||
85 | m_win.raiseAndFocus(); | ||
86 | } | ||
87 | private: | ||
88 | Workspace &m_space; | ||
89 | FluxboxWindow &m_win; | ||
90 | }; | ||
91 | |||
71 | }; | 92 | }; |
72 | 93 | ||
73 | Workspace::GroupList Workspace::m_groups; | 94 | Workspace::GroupList Workspace::m_groups; |
74 | 95 | ||
75 | Workspace::Workspace(BScreen *scrn, FbTk::MultLayers &layermanager, unsigned int i): | 96 | Workspace::Workspace(BScreen &scrn, FbTk::MultLayers &layermanager, unsigned int i): |
76 | screen(scrn), | 97 | screen(scrn), |
77 | lastfocus(0), | 98 | lastfocus(0), |
78 | m_clientmenu(*scrn->menuTheme(), scrn->getScreenNumber(), *scrn->getImageControl()), | 99 | m_clientmenu(*scrn.menuTheme(), scrn.getScreenNumber(), *scrn.getImageControl()), |
79 | m_layermanager(layermanager), | 100 | m_layermanager(layermanager), |
80 | m_name(""), | 101 | m_name(""), |
81 | m_id(i), | 102 | m_id(i), |
82 | cascade_x(32), cascade_y(32) { | 103 | cascade_x(32), cascade_y(32) { |
83 | 104 | ||
84 | setName(screen->getNameOfWorkspace(m_id)); | 105 | setName(screen.getNameOfWorkspace(m_id)); |
85 | 106 | ||
86 | } | 107 | } |
87 | 108 | ||
@@ -134,15 +155,17 @@ int Workspace::addWindow(FluxboxWindow *w, bool place) { | |||
134 | 155 | ||
135 | } | 156 | } |
136 | */ | 157 | */ |
137 | //add to list | 158 | FbTk::RefCount<FbTk::Command> |
138 | m_clientmenu.insert(w->getTitle().c_str()); | 159 | raise_and_focus(new RaiseFocusAndSetWorkspace(*this, *w)); |
160 | |||
161 | m_clientmenu.insert(w->getTitle().c_str(), raise_and_focus); | ||
139 | m_windowlist.push_back(w); | 162 | m_windowlist.push_back(w); |
140 | 163 | ||
141 | //update menugraphics | 164 | //update menugraphics |
142 | m_clientmenu.update(); | 165 | m_clientmenu.update(); |
143 | 166 | ||
144 | if (!w->isStuck()) | 167 | if (!w->isStuck()) |
145 | screen->updateNetizenWindowAdd(w->getClientWindow(), m_id); | 168 | screen.updateNetizenWindowAdd(w->getClientWindow(), m_id); |
146 | 169 | ||
147 | return w->getWindowNumber(); | 170 | return w->getWindowNumber(); |
148 | } | 171 | } |
@@ -157,15 +180,10 @@ int Workspace::removeWindow(FluxboxWindow *w) { | |||
157 | } | 180 | } |
158 | 181 | ||
159 | if (w->isFocused()) { | 182 | if (w->isFocused()) { |
160 | if (screen->isSloppyFocus()) { | 183 | if (screen.isSloppyFocus()) { |
161 | Fluxbox::instance()->setFocusedWindow(0); // set focused window to none | 184 | Fluxbox::instance()->setFocusedWindow(0); // set focused window to none |
162 | } else if (w->isTransient() && w->getTransientFor() && | 185 | } else if (w->isTransient() && w->getTransientFor() && |
163 | w->getTransientFor()->isVisible()) { | 186 | w->getTransientFor()->isVisible()) { |
164 | /* TODO: check transient | ||
165 | if (w->getTransientFor() == w) { // FATAL ERROR, this should not happend | ||
166 | cerr<<"w->getTransientFor() == w: aborting!"<<endl; | ||
167 | abort(); | ||
168 | }*/ | ||
169 | w->getTransientFor()->setInputFocus(); | 187 | w->getTransientFor()->setInputFocus(); |
170 | } else { | 188 | } else { |
171 | FluxboxWindow *top = 0; | 189 | FluxboxWindow *top = 0; |
@@ -228,7 +246,7 @@ int Workspace::removeWindow(FluxboxWindow *w) { | |||
228 | m_clientmenu.update(); | 246 | m_clientmenu.update(); |
229 | 247 | ||
230 | if (!w->isStuck()) | 248 | if (!w->isStuck()) |
231 | screen->updateNetizenWindowDel(w->getClientWindow()); | 249 | screen.updateNetizenWindowDel(w->getClientWindow()); |
232 | 250 | ||
233 | { | 251 | { |
234 | Windows::iterator it = m_windowlist.begin(); | 252 | Windows::iterator it = m_windowlist.begin(); |
@@ -394,7 +412,7 @@ void Workspace::update() { | |||
394 | 412 | ||
395 | 413 | ||
396 | bool Workspace::isCurrent() const{ | 414 | bool Workspace::isCurrent() const{ |
397 | return (m_id == screen->getCurrentWorkspaceID()); | 415 | return (m_id == screen.getCurrentWorkspaceID()); |
398 | } | 416 | } |
399 | 417 | ||
400 | 418 | ||
@@ -403,7 +421,7 @@ bool Workspace::isLastWindow(FluxboxWindow *w) const{ | |||
403 | } | 421 | } |
404 | 422 | ||
405 | void Workspace::setCurrent() { | 423 | void Workspace::setCurrent() { |
406 | screen->changeWorkspaceID(m_id); | 424 | screen.changeWorkspaceID(m_id); |
407 | } | 425 | } |
408 | 426 | ||
409 | 427 | ||
@@ -419,7 +437,7 @@ void Workspace::setName(const std::string &name) { | |||
419 | m_name = tname; | 437 | m_name = tname; |
420 | } | 438 | } |
421 | 439 | ||
422 | screen->updateWorkspaceNamesAtom(); | 440 | screen.updateWorkspaceNamesAtom(); |
423 | 441 | ||
424 | m_clientmenu.setLabel(m_name.c_str()); | 442 | m_clientmenu.setLabel(m_name.c_str()); |
425 | m_clientmenu.update(); | 443 | m_clientmenu.update(); |
@@ -441,19 +459,19 @@ void Workspace::shutdown() { | |||
441 | 459 | ||
442 | void Workspace::placeWindow(FluxboxWindow *win) { | 460 | void Workspace::placeWindow(FluxboxWindow *win) { |
443 | Bool placed = False; | 461 | Bool placed = False; |
444 | int borderWidth4x = screen->getBorderWidth2x() * 2, | 462 | int borderWidth4x = screen.getBorderWidth2x() * 2, |
445 | #ifdef SLIT | 463 | #ifdef SLIT |
446 | slit_x = screen->getSlit()->x() - screen->getBorderWidth(), | 464 | slit_x = screen.getSlit()->x() - screen.getBorderWidth(), |
447 | slit_y = screen->getSlit()->y() - screen->getBorderWidth(), | 465 | slit_y = screen.getSlit()->y() - screen.getBorderWidth(), |
448 | slit_w = screen->getSlit()->width() + borderWidth4x, | 466 | slit_w = screen.getSlit()->width() + borderWidth4x, |
449 | slit_h = screen->getSlit()->height() + borderWidth4x, | 467 | slit_h = screen.getSlit()->height() + borderWidth4x, |
450 | #endif // SLIT | 468 | #endif // SLIT |
451 | 469 | ||
452 | place_x = 0, place_y = 0, change_x = 1, change_y = 1; | 470 | place_x = 0, place_y = 0, change_x = 1, change_y = 1; |
453 | 471 | ||
454 | if (screen->getColPlacementDirection() == BScreen::BOTTOMTOP) | 472 | if (screen.getColPlacementDirection() == BScreen::BOTTOMTOP) |
455 | change_y = -1; | 473 | change_y = -1; |
456 | if (screen->getRowPlacementDirection() == BScreen::RIGHTLEFT) | 474 | if (screen.getRowPlacementDirection() == BScreen::RIGHTLEFT) |
457 | change_x = -1; | 475 | change_x = -1; |
458 | 476 | ||
459 | #ifdef XINERAMA | 477 | #ifdef XINERAMA |
@@ -461,55 +479,55 @@ void Workspace::placeWindow(FluxboxWindow *win) { | |||
461 | head_x = 0, | 479 | head_x = 0, |
462 | head_y = 0; | 480 | head_y = 0; |
463 | int head_w, head_h; | 481 | int head_w, head_h; |
464 | if (screen->hasXinerama()) { | 482 | if (screen.hasXinerama()) { |
465 | head = screen->getCurrHead(); | 483 | head = screen.getCurrHead(); |
466 | head_x = screen->getHeadX(head); | 484 | head_x = screen.getHeadX(head); |
467 | head_y = screen->getHeadY(head); | 485 | head_y = screen.getHeadY(head); |
468 | head_w = screen->getHeadWidth(head); | 486 | head_w = screen.getHeadWidth(head); |
469 | head_h = screen->getHeadHeight(head); | 487 | head_h = screen.getHeadHeight(head); |
470 | 488 | ||
471 | } else { // no xinerama | 489 | } else { // no xinerama |
472 | head_w = screen->getWidth(); | 490 | head_w = screen.getWidth(); |
473 | head_h = screen->getHeight(); | 491 | head_h = screen.getHeight(); |
474 | } | 492 | } |
475 | 493 | ||
476 | #endif // XINERAMA | 494 | #endif // XINERAMA |
477 | 495 | ||
478 | int win_w = win->getWidth() + screen->getBorderWidth2x(), | 496 | int win_w = win->getWidth() + screen.getBorderWidth2x(), |
479 | win_h = win->getHeight() + screen->getBorderWidth2x(); | 497 | win_h = win->getHeight() + screen.getBorderWidth2x(); |
480 | 498 | ||
481 | if (win->hasTab()) { | 499 | if (win->hasTab()) { |
482 | if ((! win->isShaded()) && | 500 | if ((! win->isShaded()) && |
483 | screen->getTabPlacement() == Tab::PLEFT || | 501 | screen.getTabPlacement() == Tab::PLEFT || |
484 | screen->getTabPlacement() == Tab::PRIGHT) | 502 | screen.getTabPlacement() == Tab::PRIGHT) |
485 | win_w += (screen->isTabRotateVertical()) | 503 | win_w += (screen.isTabRotateVertical()) |
486 | ? screen->getTabHeight() | 504 | ? screen.getTabHeight() |
487 | : screen->getTabWidth(); | 505 | : screen.getTabWidth(); |
488 | else // tab placement top or bottom or win is shaded | 506 | else // tab placement top or bottom or win is shaded |
489 | win_h += screen->getTabHeight(); | 507 | win_h += screen.getTabHeight(); |
490 | } | 508 | } |
491 | 509 | ||
492 | register int test_x, test_y, curr_x, curr_y, curr_w, curr_h; | 510 | register int test_x, test_y, curr_x, curr_y, curr_w, curr_h; |
493 | 511 | ||
494 | switch (screen->getPlacementPolicy()) { | 512 | switch (screen.getPlacementPolicy()) { |
495 | case BScreen::ROWSMARTPLACEMENT: { | 513 | case BScreen::ROWSMARTPLACEMENT: { |
496 | #ifdef XINERAMA | 514 | #ifdef XINERAMA |
497 | test_y = head_y; | 515 | test_y = head_y; |
498 | #else // !XINERAMA | 516 | #else // !XINERAMA |
499 | test_y = 0; | 517 | test_y = 0; |
500 | #endif // XINERAMA | 518 | #endif // XINERAMA |
501 | if (screen->getColPlacementDirection() == BScreen::BOTTOMTOP) | 519 | if (screen.getColPlacementDirection() == BScreen::BOTTOMTOP) |
502 | #ifdef XINERAMA | 520 | #ifdef XINERAMA |
503 | test_y = (head_y + head_h) - win_h - test_y; | 521 | test_y = (head_y + head_h) - win_h - test_y; |
504 | #else // !XINERAMA | 522 | #else // !XINERAMA |
505 | test_y = screen->getHeight() - win_h - test_y; | 523 | test_y = screen.getHeight() - win_h - test_y; |
506 | #endif // XINERAMA | 524 | #endif // XINERAMA |
507 | 525 | ||
508 | while (((screen->getColPlacementDirection() == BScreen::BOTTOMTOP) ? | 526 | while (((screen.getColPlacementDirection() == BScreen::BOTTOMTOP) ? |
509 | #ifdef XINERAMA | 527 | #ifdef XINERAMA |
510 | test_y >= head_y : test_y + win_h <= (head_y + head_h) | 528 | test_y >= head_y : test_y + win_h <= (head_y + head_h) |
511 | #else // !XINERAMA | 529 | #else // !XINERAMA |
512 | test_y > 0 : test_y + win_h < (signed) screen->getHeight() | 530 | test_y > 0 : test_y + win_h < (signed) screen.getHeight() |
513 | #endif // XINERAMA | 531 | #endif // XINERAMA |
514 | ) && ! placed) { | 532 | ) && ! placed) { |
515 | 533 | ||
@@ -518,18 +536,18 @@ void Workspace::placeWindow(FluxboxWindow *win) { | |||
518 | #else // !XINERAMA | 536 | #else // !XINERAMA |
519 | test_x = 0; | 537 | test_x = 0; |
520 | #endif // XINERAMA | 538 | #endif // XINERAMA |
521 | if (screen->getRowPlacementDirection() == BScreen::RIGHTLEFT) | 539 | if (screen.getRowPlacementDirection() == BScreen::RIGHTLEFT) |
522 | #ifdef XINERAMA | 540 | #ifdef XINERAMA |
523 | test_x = (head_x + head_w) - win_w - test_x; | 541 | test_x = (head_x + head_w) - win_w - test_x; |
524 | #else // !XINERAMA | 542 | #else // !XINERAMA |
525 | test_x = screen->getWidth() - win_w - test_x; | 543 | test_x = screen.getWidth() - win_w - test_x; |
526 | #endif // XINERAMA | 544 | #endif // XINERAMA |
527 | 545 | ||
528 | while (((screen->getRowPlacementDirection() == BScreen::RIGHTLEFT) ? | 546 | while (((screen.getRowPlacementDirection() == BScreen::RIGHTLEFT) ? |
529 | #ifdef XINERAMA | 547 | #ifdef XINERAMA |
530 | test_x >= head_x : test_x + win_w <= (head_x + head_w) | 548 | test_x >= head_x : test_x + win_w <= (head_x + head_w) |
531 | #else // !XINERAMA | 549 | #else // !XINERAMA |
532 | test_x > 0 : test_x + win_w < (signed) screen->getWidth() | 550 | test_x > 0 : test_x + win_w < (signed) screen.getWidth() |
533 | #endif // XINERAMA | 551 | #endif // XINERAMA |
534 | ) && ! placed) { | 552 | ) && ! placed) { |
535 | 553 | ||
@@ -541,37 +559,37 @@ void Workspace::placeWindow(FluxboxWindow *win) { | |||
541 | for (; it != it_end && placed; ++it) { | 559 | for (; it != it_end && placed; ++it) { |
542 | curr_x = (*it)->getXFrame(); | 560 | curr_x = (*it)->getXFrame(); |
543 | curr_y = (*it)->getYFrame(); | 561 | curr_y = (*it)->getYFrame(); |
544 | curr_w = (*it)->getWidth() + screen->getBorderWidth2x(); | 562 | curr_w = (*it)->getWidth() + screen.getBorderWidth2x(); |
545 | curr_h = | 563 | curr_h = |
546 | (((*it)->isShaded()) | 564 | (((*it)->isShaded()) |
547 | ? (*it)->getTitleHeight() | 565 | ? (*it)->getTitleHeight() |
548 | : (*it)->getHeight()) + | 566 | : (*it)->getHeight()) + |
549 | screen->getBorderWidth2x(); | 567 | screen.getBorderWidth2x(); |
550 | 568 | ||
551 | if ((*it)->hasTab()) { | 569 | if ((*it)->hasTab()) { |
552 | if (! (*it)->isShaded()) { // not shaded window | 570 | if (! (*it)->isShaded()) { // not shaded window |
553 | switch(screen->getTabPlacement()) { | 571 | switch(screen.getTabPlacement()) { |
554 | case Tab::PTOP: | 572 | case Tab::PTOP: |
555 | curr_y -= screen->getTabHeight(); | 573 | curr_y -= screen.getTabHeight(); |
556 | case Tab::PBOTTOM: | 574 | case Tab::PBOTTOM: |
557 | curr_h += screen->getTabHeight(); | 575 | curr_h += screen.getTabHeight(); |
558 | break; | 576 | break; |
559 | case Tab::PLEFT: | 577 | case Tab::PLEFT: |
560 | curr_x -= (screen->isTabRotateVertical()) | 578 | curr_x -= (screen.isTabRotateVertical()) |
561 | ? screen->getTabHeight() | 579 | ? screen.getTabHeight() |
562 | : screen->getTabWidth(); | 580 | : screen.getTabWidth(); |
563 | case Tab::PRIGHT: | 581 | case Tab::PRIGHT: |
564 | curr_w += (screen->isTabRotateVertical()) | 582 | curr_w += (screen.isTabRotateVertical()) |
565 | ? screen->getTabHeight() | 583 | ? screen.getTabHeight() |
566 | : screen->getTabWidth(); | 584 | : screen.getTabWidth(); |
567 | break; | 585 | break; |
568 | case Tab::PNONE: | 586 | case Tab::PNONE: |
569 | break; | 587 | break; |
570 | } | 588 | } |
571 | } else { // shaded window | 589 | } else { // shaded window |
572 | if (screen->getTabPlacement() == Tab::PTOP) | 590 | if (screen.getTabPlacement() == Tab::PTOP) |
573 | curr_y -= screen->getTabHeight(); | 591 | curr_y -= screen.getTabHeight(); |
574 | curr_h += screen->getTabHeight(); | 592 | curr_h += screen.getTabHeight(); |
575 | } | 593 | } |
576 | } // tab cheking done | 594 | } // tab cheking done |
577 | 595 | ||
@@ -615,18 +633,18 @@ void Workspace::placeWindow(FluxboxWindow *win) { | |||
615 | #else // !XINERAMA | 633 | #else // !XINERAMA |
616 | test_x = 0; | 634 | test_x = 0; |
617 | #endif // XINERAMA | 635 | #endif // XINERAMA |
618 | if (screen->getRowPlacementDirection() == BScreen::RIGHTLEFT) | 636 | if (screen.getRowPlacementDirection() == BScreen::RIGHTLEFT) |
619 | #ifdef XINERAMA | 637 | #ifdef XINERAMA |
620 | test_x = (head_x + head_w) - win_w - test_x; | 638 | test_x = (head_x + head_w) - win_w - test_x; |
621 | #else // !XINERAMA | 639 | #else // !XINERAMA |
622 | test_x = screen->getWidth() - win_w - test_x; | 640 | test_x = screen.getWidth() - win_w - test_x; |
623 | #endif // XINERAMA | 641 | #endif // XINERAMA |
624 | 642 | ||
625 | while (((screen->getRowPlacementDirection() == BScreen::RIGHTLEFT) ? | 643 | while (((screen.getRowPlacementDirection() == BScreen::RIGHTLEFT) ? |
626 | #ifdef XINERAMA | 644 | #ifdef XINERAMA |
627 | test_x >= 0 : test_x + win_w <= (head_x + head_w) | 645 | test_x >= 0 : test_x + win_w <= (head_x + head_w) |
628 | #else // !XINERAMA | 646 | #else // !XINERAMA |
629 | test_x > 0 : test_x + win_w < (signed) screen->getWidth() | 647 | test_x > 0 : test_x + win_w < (signed) screen.getWidth() |
630 | #endif // XINERAMA | 648 | #endif // XINERAMA |
631 | ) && ! placed) { | 649 | ) && ! placed) { |
632 | 650 | ||
@@ -635,18 +653,18 @@ void Workspace::placeWindow(FluxboxWindow *win) { | |||
635 | #else // !XINERAMA | 653 | #else // !XINERAMA |
636 | test_y = 0; | 654 | test_y = 0; |
637 | #endif // XINERAMA | 655 | #endif // XINERAMA |
638 | if (screen->getColPlacementDirection() == BScreen::BOTTOMTOP) | 656 | if (screen.getColPlacementDirection() == BScreen::BOTTOMTOP) |
639 | #ifdef XINERAMA | 657 | #ifdef XINERAMA |
640 | test_y = (head_y + head_h) - win_h - test_y; | 658 | test_y = (head_y + head_h) - win_h - test_y; |
641 | #else // !XINERAMA | 659 | #else // !XINERAMA |
642 | test_y = screen->getHeight() - win_h - test_y; | 660 | test_y = screen.getHeight() - win_h - test_y; |
643 | #endif // XINERAMA | 661 | #endif // XINERAMA |
644 | 662 | ||
645 | while (((screen->getColPlacementDirection() == BScreen::BOTTOMTOP) ? | 663 | while (((screen.getColPlacementDirection() == BScreen::BOTTOMTOP) ? |
646 | #ifdef XINERAMA | 664 | #ifdef XINERAMA |
647 | test_y >= head_y : test_y + win_h <= (head_y + head_h) | 665 | test_y >= head_y : test_y + win_h <= (head_y + head_h) |
648 | #else // !XINERAMA | 666 | #else // !XINERAMA |
649 | test_y > 0 : test_y + win_h < (signed) screen->getHeight() | 667 | test_y > 0 : test_y + win_h < (signed) screen.getHeight() |
650 | #endif // XINERAMA | 668 | #endif // XINERAMA |
651 | ) && ! placed) { | 669 | ) && ! placed) { |
652 | placed = True; | 670 | placed = True; |
@@ -656,29 +674,29 @@ void Workspace::placeWindow(FluxboxWindow *win) { | |||
656 | for (; it != it_end && placed; ++it) { | 674 | for (; it != it_end && placed; ++it) { |
657 | curr_x = (*it)->getXFrame(); | 675 | curr_x = (*it)->getXFrame(); |
658 | curr_y = (*it)->getYFrame(); | 676 | curr_y = (*it)->getYFrame(); |
659 | curr_w = (*it)->getWidth() + screen->getBorderWidth2x(); | 677 | curr_w = (*it)->getWidth() + screen.getBorderWidth2x(); |
660 | curr_h = | 678 | curr_h = |
661 | (((*it)->isShaded()) | 679 | (((*it)->isShaded()) |
662 | ? (*it)->getTitleHeight() | 680 | ? (*it)->getTitleHeight() |
663 | : (*it)->getHeight()) + | 681 | : (*it)->getHeight()) + |
664 | screen->getBorderWidth2x();; | 682 | screen.getBorderWidth2x();; |
665 | 683 | ||
666 | if ((*it)->hasTab()) { | 684 | if ((*it)->hasTab()) { |
667 | if (! (*it)->isShaded()) { // not shaded window | 685 | if (! (*it)->isShaded()) { // not shaded window |
668 | switch(screen->getTabPlacement()) { | 686 | switch(screen.getTabPlacement()) { |
669 | case Tab::PTOP: | 687 | case Tab::PTOP: |
670 | curr_y -= screen->getTabHeight(); | 688 | curr_y -= screen.getTabHeight(); |
671 | case Tab::PBOTTOM: | 689 | case Tab::PBOTTOM: |
672 | curr_h += screen->getTabHeight(); | 690 | curr_h += screen.getTabHeight(); |
673 | break; | 691 | break; |
674 | case Tab::PLEFT: | 692 | case Tab::PLEFT: |
675 | curr_x -= (screen->isTabRotateVertical()) | 693 | curr_x -= (screen.isTabRotateVertical()) |
676 | ? screen->getTabHeight() | 694 | ? screen.getTabHeight() |
677 | : screen->getTabWidth(); | 695 | : screen.getTabWidth(); |
678 | case Tab::PRIGHT: | 696 | case Tab::PRIGHT: |
679 | curr_w += (screen->isTabRotateVertical()) | 697 | curr_w += (screen.isTabRotateVertical()) |
680 | ? screen->getTabHeight() | 698 | ? screen.getTabHeight() |
681 | : screen->getTabWidth(); | 699 | : screen.getTabWidth(); |
682 | break; | 700 | break; |
683 | default: | 701 | default: |
684 | #ifdef DEBUG | 702 | #ifdef DEBUG |
@@ -688,9 +706,9 @@ void Workspace::placeWindow(FluxboxWindow *win) { | |||
688 | break; | 706 | break; |
689 | } | 707 | } |
690 | } else { // shaded window | 708 | } else { // shaded window |
691 | if (screen->getTabPlacement() == Tab::PTOP) | 709 | if (screen.getTabPlacement() == Tab::PTOP) |
692 | curr_y -= screen->getTabHeight(); | 710 | curr_y -= screen.getTabHeight(); |
693 | curr_h += screen->getTabHeight(); | 711 | curr_h += screen.getTabHeight(); |
694 | } | 712 | } |
695 | } // tab cheking done | 713 | } // tab cheking done |
696 | 714 | ||
@@ -733,8 +751,8 @@ void Workspace::placeWindow(FluxboxWindow *win) { | |||
733 | if ((cascade_x > (head_w / 2)) || | 751 | if ((cascade_x > (head_w / 2)) || |
734 | (cascade_y > (head_h / 2))) | 752 | (cascade_y > (head_h / 2))) |
735 | #else // !XINERAMA | 753 | #else // !XINERAMA |
736 | if (((unsigned) cascade_x > (screen->getWidth() / 2)) || | 754 | if (((unsigned) cascade_x > (screen.getWidth() / 2)) || |
737 | ((unsigned) cascade_y > (screen->getHeight() / 2))) | 755 | ((unsigned) cascade_y > (screen.getHeight() / 2))) |
738 | #endif // XINERAMA | 756 | #endif // XINERAMA |
739 | 757 | ||
740 | cascade_x = cascade_y = 32; | 758 | cascade_x = cascade_y = 32; |
@@ -755,20 +773,20 @@ void Workspace::placeWindow(FluxboxWindow *win) { | |||
755 | if (place_y + win_h > (head_y + head_h)) | 773 | if (place_y + win_h > (head_y + head_h)) |
756 | place_y = head_y + ((head_h - win_h) / 2); | 774 | place_y = head_y + ((head_h - win_h) / 2); |
757 | #else // !XINERAMA | 775 | #else // !XINERAMA |
758 | if (place_x + win_w > (signed) screen->getWidth()) | 776 | if (place_x + win_w > (signed) screen.getWidth()) |
759 | place_x = (((signed) screen->getWidth()) - win_w) / 2; | 777 | place_x = (((signed) screen.getWidth()) - win_w) / 2; |
760 | if (place_y + win_h > (signed) screen->getHeight()) | 778 | if (place_y + win_h > (signed) screen.getHeight()) |
761 | place_y = (((signed) screen->getHeight()) - win_h) / 2; | 779 | place_y = (((signed) screen.getHeight()) - win_h) / 2; |
762 | #endif // XINERAMA | 780 | #endif // XINERAMA |
763 | 781 | ||
764 | // fix window placement, think of tabs | 782 | // fix window placement, think of tabs |
765 | if (win->hasTab()) { | 783 | if (win->hasTab()) { |
766 | if (screen->getTabPlacement() == Tab::PTOP) | 784 | if (screen.getTabPlacement() == Tab::PTOP) |
767 | place_y += screen->getTabHeight(); | 785 | place_y += screen.getTabHeight(); |
768 | else if (screen->getTabPlacement() == Tab::PLEFT) | 786 | else if (screen.getTabPlacement() == Tab::PLEFT) |
769 | place_x += (screen->isTabRotateVertical()) | 787 | place_x += (screen.isTabRotateVertical()) |
770 | ? screen->getTabHeight() | 788 | ? screen.getTabHeight() |
771 | : screen->getTabWidth(); | 789 | : screen.getTabWidth(); |
772 | } | 790 | } |
773 | 791 | ||
774 | win->moveResize(place_x, place_y, win->getWidth(), win->getHeight()); | 792 | win->moveResize(place_x, place_y, win->getWidth(), win->getHeight()); |