diff options
Diffstat (limited to 'src/Workspace.cc')
-rw-r--r-- | src/Workspace.cc | 48 |
1 files changed, 27 insertions, 21 deletions
diff --git a/src/Workspace.cc b/src/Workspace.cc index 2bf2450..ef2429f 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.68 2003/05/20 11:03:11 rathnor Exp $ | 25 | // $Id: Workspace.cc,v 1.69 2003/05/21 23:59:54 rathnor Exp $ |
26 | 26 | ||
27 | #include "Workspace.hh" | 27 | #include "Workspace.hh" |
28 | 28 | ||
@@ -119,9 +119,15 @@ Workspace::Workspace(BScreen &scrn, FbTk::MultLayers &layermanager, unsigned int | |||
119 | m_clientmenu(*scrn.menuTheme(), scrn.screenNumber(), scrn.imageControl()), | 119 | m_clientmenu(*scrn.menuTheme(), scrn.screenNumber(), scrn.imageControl()), |
120 | m_layermanager(layermanager), | 120 | m_layermanager(layermanager), |
121 | m_name(""), | 121 | m_name(""), |
122 | m_id(i), | 122 | m_id(i) { |
123 | m_cascade_x(32), m_cascade_y(32) { | ||
124 | 123 | ||
124 | |||
125 | m_cascade_x = new int[scrn.numHeads()+1]; | ||
126 | m_cascade_y = new int[scrn.numHeads()+1]; | ||
127 | for (int i=0; i < scrn.numHeads()+1; i++) { | ||
128 | m_cascade_x[i] = 32 + scrn.getHeadX(i); | ||
129 | m_cascade_y[i] = 32 + scrn.getHeadY(i); | ||
130 | } | ||
125 | m_clientmenu.setInternalMenu(); | 131 | m_clientmenu.setInternalMenu(); |
126 | setName(screen().getNameOfWorkspace(m_id)); | 132 | setName(screen().getNameOfWorkspace(m_id)); |
127 | 133 | ||
@@ -129,7 +135,8 @@ Workspace::Workspace(BScreen &scrn, FbTk::MultLayers &layermanager, unsigned int | |||
129 | 135 | ||
130 | 136 | ||
131 | Workspace::~Workspace() { | 137 | Workspace::~Workspace() { |
132 | 138 | delete [] m_cascade_x; | |
139 | delete [] m_cascade_y; | ||
133 | } | 140 | } |
134 | 141 | ||
135 | void Workspace::setLastFocusedWindow(FluxboxWindow *win) { | 142 | void Workspace::setLastFocusedWindow(FluxboxWindow *win) { |
@@ -569,8 +576,7 @@ void Workspace::placeWindow(FluxboxWindow &win) { | |||
569 | curr_x = window.x(); | 576 | curr_x = window.x(); |
570 | curr_y = window.y(); | 577 | curr_y = window.y(); |
571 | curr_w = window.width() + window.fbWindow().borderWidth()*2; | 578 | curr_w = window.width() + window.fbWindow().borderWidth()*2; |
572 | curr_h = window.isShaded() ? window.titleHeight() : | 579 | curr_h = window.height() + window.fbWindow().borderWidth()*2; |
573 | window.height() + window.fbWindow().borderWidth()*2; | ||
574 | 580 | ||
575 | if (curr_x < test_x + win_w && | 581 | if (curr_x < test_x + win_w && |
576 | curr_x + curr_w > test_x && | 582 | curr_x + curr_w > test_x && |
@@ -621,13 +627,8 @@ void Workspace::placeWindow(FluxboxWindow &win) { | |||
621 | for (; it != it_end && placed; ++it) { | 627 | for (; it != it_end && placed; ++it) { |
622 | curr_x = (*it)->x(); | 628 | curr_x = (*it)->x(); |
623 | curr_y = (*it)->y(); | 629 | curr_y = (*it)->y(); |
624 | curr_w = (*it)->width() + (*it)->fbWindow().borderWidth()*2; | 630 | curr_w = (*it)->width() + (*it)->fbWindow().borderWidth()*2; |
625 | curr_h = | 631 | curr_h = (*it)->height() + (*it)->fbWindow().borderWidth()*2; |
626 | (((*it)->isShaded()) | ||
627 | ? (*it)->titleHeight() | ||
628 | : (*it)->height()) + | ||
629 | (*it)->fbWindow().borderWidth()*2; | ||
630 | |||
631 | 632 | ||
632 | if (curr_x < test_x + win_w && | 633 | if (curr_x < test_x + win_w && |
633 | curr_x + curr_w > test_x && | 634 | curr_x + curr_w > test_x && |
@@ -637,7 +638,6 @@ void Workspace::placeWindow(FluxboxWindow &win) { | |||
637 | } | 638 | } |
638 | } | 639 | } |
639 | 640 | ||
640 | |||
641 | if (placed) { | 641 | if (placed) { |
642 | place_x = test_x; | 642 | place_x = test_x; |
643 | place_y = test_y; | 643 | place_y = test_y; |
@@ -657,15 +657,21 @@ 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 ((m_cascade_x > ((head_left + head_right) / 2)) || | 660 | if ((m_cascade_x[head] > ((head_left + head_right) / 2)) || |
661 | (m_cascade_y > ((head_top + head_bot) / 2))) | 661 | (m_cascade_y[head] > ((head_top + head_bot) / 2))) { |
662 | m_cascade_x = m_cascade_y = 32; | 662 | m_cascade_x[head] = head_left + 32; |
663 | m_cascade_y[head] = head_top + 32; | ||
664 | } | ||
663 | 665 | ||
664 | place_x = m_cascade_x; | 666 | place_x = m_cascade_x[head]; |
665 | place_y = m_cascade_y; | 667 | place_y = m_cascade_y[head]; |
666 | 668 | ||
667 | m_cascade_x += win.titleHeight(); | 669 | // just one borderwidth, so they can share a borderwidth (looks better) |
668 | m_cascade_y += win.titleHeight(); | 670 | int titlebar_height = win.titlebarHeight() + win.fbWindow().borderWidth(); |
671 | if (titlebar_height < 4) // make sure it is not insignificant | ||
672 | titlebar_height = 32; | ||
673 | m_cascade_x[head] += titlebar_height; | ||
674 | m_cascade_y[head] += titlebar_height; | ||
669 | } | 675 | } |
670 | 676 | ||
671 | if (place_x + win_w > head_right) | 677 | if (place_x + win_w > head_right) |