aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAmadeusz Sławiński <amade@asmblr.net>2013-09-15 19:54:44 (GMT)
committerMathias Gumz <akira at fluxbox dot org>2014-02-19 16:41:15 (GMT)
commit559947186ef39e18f273e32026590f824782d905 (patch)
tree1e426338ca22f4c65797029d6b6df463a939fde7
parent58472fea6d1a88c864598141e63aac085b83c77b (diff)
downloadfluxbox-559947186ef39e18f273e32026590f824782d905.zip
fluxbox-559947186ef39e18f273e32026590f824782d905.tar.bz2
make sure that result of division is signed int
there is problem that x/y ended with unsigned int value due to width()/height() and negative result of division ended up being big it causes Focus to move window due to screen boundary checks fixes annoying behaviour of window moving few pixels with Mod4 KP_8 :MacroCmd {ResizeTo 100% 50%} {MoveTo 0 0 Top} {Raise} {Focus}
-rw-r--r--src/Window.cc10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/Window.cc b/src/Window.cc
index c09cc24..4704672 100644
--- a/src/Window.cc
+++ b/src/Window.cc
@@ -3725,25 +3725,27 @@ FluxboxWindow::ReferenceCorner FluxboxWindow::getCorner(string str) {
3725void FluxboxWindow::translateXCoords(int &x, ReferenceCorner dir) const { 3725void FluxboxWindow::translateXCoords(int &x, ReferenceCorner dir) const {
3726 int head = getOnHead(), bw = 2 * frame().window().borderWidth(), 3726 int head = getOnHead(), bw = 2 * frame().window().borderWidth(),
3727 left = screen().maxLeft(head), right = screen().maxRight(head); 3727 left = screen().maxLeft(head), right = screen().maxRight(head);
3728 int w = width();
3728 3729
3729 if (dir == LEFTTOP || dir == LEFT || dir == LEFTBOTTOM) 3730 if (dir == LEFTTOP || dir == LEFT || dir == LEFTBOTTOM)
3730 x += left; 3731 x += left;
3731 if (dir == RIGHTTOP || dir == RIGHT || dir == RIGHTBOTTOM) 3732 if (dir == RIGHTTOP || dir == RIGHT || dir == RIGHTBOTTOM)
3732 x = right - width() - bw - x; 3733 x = right - w - bw - x;
3733 if (dir == TOP || dir == CENTER || dir == BOTTOM) 3734 if (dir == TOP || dir == CENTER || dir == BOTTOM)
3734 x += (left + right - width() - bw)/2; 3735 x += (left + right - w - bw)/2;
3735} 3736}
3736 3737
3737void FluxboxWindow::translateYCoords(int &y, ReferenceCorner dir) const { 3738void FluxboxWindow::translateYCoords(int &y, ReferenceCorner dir) const {
3738 int head = getOnHead(), bw = 2 * frame().window().borderWidth(), 3739 int head = getOnHead(), bw = 2 * frame().window().borderWidth(),
3739 top = screen().maxTop(head), bottom = screen().maxBottom(head); 3740 top = screen().maxTop(head), bottom = screen().maxBottom(head);
3741 int h = height();
3740 3742
3741 if (dir == LEFTTOP || dir == TOP || dir == RIGHTTOP) 3743 if (dir == LEFTTOP || dir == TOP || dir == RIGHTTOP)
3742 y += top; 3744 y += top;
3743 if (dir == LEFTBOTTOM || dir == BOTTOM || dir == RIGHTBOTTOM) 3745 if (dir == LEFTBOTTOM || dir == BOTTOM || dir == RIGHTBOTTOM)
3744 y = bottom - height() - bw - y; 3746 y = bottom - h - bw - y;
3745 if (dir == LEFT || dir == CENTER || dir == RIGHT) 3747 if (dir == LEFT || dir == CENTER || dir == RIGHT)
3746 y += (top + bottom - height() - bw)/2; 3748 y += (top + bottom - h - bw)/2;
3747} 3749}
3748 3750
3749void FluxboxWindow::translateCoords(int &x, int &y, ReferenceCorner dir) const { 3751void FluxboxWindow::translateCoords(int &x, int &y, ReferenceCorner dir) const {