diff options
author | rathnor <rathnor> | 2003-05-21 23:59:54 (GMT) |
---|---|---|
committer | rathnor <rathnor> | 2003-05-21 23:59:54 (GMT) |
commit | 51f7970f7494710df2d015afca2007ceebbe7b2d (patch) | |
tree | e08b0fb137f4789fbc7f327b1c5e8ad0927b531a /src | |
parent | a88511a4a772ec021029649905b7ce645ff9a597 (diff) | |
download | fluxbox_pavel-51f7970f7494710df2d015afca2007ceebbe7b2d.zip fluxbox_pavel-51f7970f7494710df2d015afca2007ceebbe7b2d.tar.bz2 |
fix cascade placement for multiple heads
Diffstat (limited to 'src')
-rw-r--r-- | src/FbWinFrame.cc | 6 | ||||
-rw-r--r-- | src/FbWinFrame.hh | 4 | ||||
-rw-r--r-- | src/Window.cc | 6 | ||||
-rw-r--r-- | src/Window.hh | 4 | ||||
-rw-r--r-- | src/Workspace.cc | 48 | ||||
-rw-r--r-- | src/Workspace.hh | 2 |
6 files changed, 36 insertions, 34 deletions
diff --git a/src/FbWinFrame.cc b/src/FbWinFrame.cc index 1ec9232..02aca76 100644 --- a/src/FbWinFrame.cc +++ b/src/FbWinFrame.cc | |||
@@ -19,7 +19,7 @@ | |||
19 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER | 19 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER |
20 | // DEALINGS IN THE SOFTWARE. | 20 | // DEALINGS IN THE SOFTWARE. |
21 | 21 | ||
22 | // $Id: FbWinFrame.cc,v 1.24 2003/05/15 11:17:26 fluxgen Exp $ | 22 | // $Id: FbWinFrame.cc,v 1.25 2003/05/21 23:59:53 rathnor Exp $ |
23 | 23 | ||
24 | #include "FbWinFrame.hh" | 24 | #include "FbWinFrame.hh" |
25 | #include "ImageControl.hh" | 25 | #include "ImageControl.hh" |
@@ -545,10 +545,6 @@ void FbWinFrame::reconfigure() { | |||
545 | // titlebar stuff rendered already by reconftitlebar | 545 | // titlebar stuff rendered already by reconftitlebar |
546 | } | 546 | } |
547 | 547 | ||
548 | unsigned int FbWinFrame::titleHeight() const { | ||
549 | return m_theme.font().height(); | ||
550 | } | ||
551 | |||
552 | unsigned int FbWinFrame::buttonHeight() const { | 548 | unsigned int FbWinFrame::buttonHeight() const { |
553 | return m_titlebar.height() - m_bevel*2; | 549 | return m_titlebar.height() - m_bevel*2; |
554 | } | 550 | } |
diff --git a/src/FbWinFrame.hh b/src/FbWinFrame.hh index d71fc9b..74d1e76 100644 --- a/src/FbWinFrame.hh +++ b/src/FbWinFrame.hh | |||
@@ -19,7 +19,7 @@ | |||
19 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER | 19 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER |
20 | // DEALINGS IN THE SOFTWARE. | 20 | // DEALINGS IN THE SOFTWARE. |
21 | 21 | ||
22 | // $Id: FbWinFrame.hh,v 1.7 2003/05/01 13:19:36 rathnor Exp $ | 22 | // $Id: FbWinFrame.hh,v 1.8 2003/05/21 23:59:53 rathnor Exp $ |
23 | 23 | ||
24 | #ifndef FBWINFRAME_HH | 24 | #ifndef FBWINFRAME_HH |
25 | #define FBWINFRAME_HH | 25 | #define FBWINFRAME_HH |
@@ -153,7 +153,7 @@ public: | |||
153 | inline bool isShaded() const { return m_shaded; } | 153 | inline bool isShaded() const { return m_shaded; } |
154 | inline const FbWinFrameTheme &theme() const { return m_theme; } | 154 | inline const FbWinFrameTheme &theme() const { return m_theme; } |
155 | /// @return titlebar height | 155 | /// @return titlebar height |
156 | unsigned int titleHeight() const; | 156 | unsigned int titlebarHeight() const { return m_titlebar.height(); } |
157 | /// @return size of button | 157 | /// @return size of button |
158 | unsigned int buttonHeight() const; | 158 | unsigned int buttonHeight() const; |
159 | 159 | ||
diff --git a/src/Window.cc b/src/Window.cc index 3254b50..dc8e3dc 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.183 2003/05/20 11:03:10 rathnor Exp $ | 25 | // $Id: Window.cc,v 1.184 2003/05/21 23:59:53 rathnor Exp $ |
26 | 26 | ||
27 | #include "Window.hh" | 27 | #include "Window.hh" |
28 | 28 | ||
@@ -3151,8 +3151,8 @@ unsigned int FluxboxWindow::height() const { | |||
3151 | return frame().height(); | 3151 | return frame().height(); |
3152 | } | 3152 | } |
3153 | 3153 | ||
3154 | unsigned int FluxboxWindow::titleHeight() const { | 3154 | unsigned int FluxboxWindow::titlebarHeight() const { |
3155 | return frame().titleHeight(); | 3155 | return frame().titlebarHeight(); |
3156 | } | 3156 | } |
3157 | 3157 | ||
3158 | Window FluxboxWindow::clientWindow() const { | 3158 | Window FluxboxWindow::clientWindow() const { |
diff --git a/src/Window.hh b/src/Window.hh index 9b99f0f..46d0a12 100644 --- a/src/Window.hh +++ b/src/Window.hh | |||
@@ -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.hh,v 1.73 2003/05/15 11:17:27 fluxgen Exp $ | 25 | // $Id: Window.hh,v 1.74 2003/05/21 23:59:53 rathnor Exp $ |
26 | 26 | ||
27 | #ifndef WINDOW_HH | 27 | #ifndef WINDOW_HH |
28 | #define WINDOW_HH | 28 | #define WINDOW_HH |
@@ -303,7 +303,7 @@ public: | |||
303 | 303 | ||
304 | unsigned int width() const; | 304 | unsigned int width() const; |
305 | unsigned int height() const; | 305 | unsigned int height() const; |
306 | unsigned int titleHeight() const; | 306 | unsigned int titlebarHeight() const; |
307 | const std::string &className() const { return m_class_name; } | 307 | const std::string &className() const { return m_class_name; } |
308 | const std::string &instanceName() const { return m_instance_name; } | 308 | const std::string &instanceName() const { return m_instance_name; } |
309 | bool isLowerTab() const; | 309 | bool isLowerTab() const; |
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) |
diff --git a/src/Workspace.hh b/src/Workspace.hh index fcca4f0..a8c6e8c 100644 --- a/src/Workspace.hh +++ b/src/Workspace.hh | |||
@@ -111,7 +111,7 @@ private: | |||
111 | 111 | ||
112 | std::string m_name; ///< name of this workspace | 112 | std::string m_name; ///< name of this workspace |
113 | unsigned int m_id; ///< id, obsolete, this should be in BScreen | 113 | unsigned int m_id; ///< id, obsolete, this should be in BScreen |
114 | int m_cascade_x, m_cascade_y; | 114 | int *m_cascade_x, *m_cascade_y; // need a cascade for each head (Xinerama) |
115 | }; | 115 | }; |
116 | 116 | ||
117 | 117 | ||