diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/Window.cc | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/src/Window.cc b/src/Window.cc index 56c78c7..7855f68 100644 --- a/src/Window.cc +++ b/src/Window.cc | |||
@@ -3926,8 +3926,21 @@ void FluxboxWindow::setOnHead(int head) { | |||
3926 | if (head > 0 && head <= screen().numHeads()) { | 3926 | if (head > 0 && head <= screen().numHeads()) { |
3927 | int cur = screen().getHead(fbWindow()); | 3927 | int cur = screen().getHead(fbWindow()); |
3928 | bool placed = m_placed; | 3928 | bool placed = m_placed; |
3929 | move(screen().getHeadX(head) + frame().x() - screen().getHeadX(cur), | 3929 | int x = frame().x(), y = frame().y(); |
3930 | screen().getHeadY(head) + frame().y() - screen().getHeadY(cur)); | 3930 | const int w = frame().width(), h = frame().height(), bw = frame().window().borderWidth(); |
3931 | const int sx = screen().getHeadX(cur), sw = screen().getHeadWidth(cur), | ||
3932 | sy = screen().getHeadY(cur), sh = screen().getHeadHeight(cur); | ||
3933 | int d = sx + sw - (x + bw + w); | ||
3934 | if (std::abs(sx - x) > bw && std::abs(d) <= bw) // right aligned | ||
3935 | x = screen().getHeadX(head) + screen().getHeadWidth(head) - (w + bw + d); | ||
3936 | else // calc top-left relative position | ||
3937 | x = screen().getHeadWidth(head) * (x - sx) / sw + screen().getHeadX(head); | ||
3938 | d = sy + sh - (y + bw + h); | ||
3939 | if (std::abs(sy - y) > bw && std::abs(d) <= bw) // bottom aligned | ||
3940 | y = screen().getHeadY(head) + screen().getHeadHeight(head) - (h + bw + d); | ||
3941 | else // calc top-left relative position | ||
3942 | y = screen().getHeadHeight(head) * (y - sy) / sh + screen().getHeadY(head); | ||
3943 | move(x, y); | ||
3931 | m_placed = placed; | 3944 | m_placed = placed; |
3932 | } | 3945 | } |
3933 | 3946 | ||