From 559947186ef39e18f273e32026590f824782d905 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Amadeusz=20S=C5=82awi=C5=84ski?= Date: Sun, 15 Sep 2013 21:54:44 +0200 Subject: 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} --- src/Window.cc | 10 ++++++---- 1 file 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) { void FluxboxWindow::translateXCoords(int &x, ReferenceCorner dir) const { int head = getOnHead(), bw = 2 * frame().window().borderWidth(), left = screen().maxLeft(head), right = screen().maxRight(head); + int w = width(); if (dir == LEFTTOP || dir == LEFT || dir == LEFTBOTTOM) x += left; if (dir == RIGHTTOP || dir == RIGHT || dir == RIGHTBOTTOM) - x = right - width() - bw - x; + x = right - w - bw - x; if (dir == TOP || dir == CENTER || dir == BOTTOM) - x += (left + right - width() - bw)/2; + x += (left + right - w - bw)/2; } void FluxboxWindow::translateYCoords(int &y, ReferenceCorner dir) const { int head = getOnHead(), bw = 2 * frame().window().borderWidth(), top = screen().maxTop(head), bottom = screen().maxBottom(head); + int h = height(); if (dir == LEFTTOP || dir == TOP || dir == RIGHTTOP) y += top; if (dir == LEFTBOTTOM || dir == BOTTOM || dir == RIGHTBOTTOM) - y = bottom - height() - bw - y; + y = bottom - h - bw - y; if (dir == LEFT || dir == CENTER || dir == RIGHT) - y += (top + bottom - height() - bw)/2; + y += (top + bottom - h - bw)/2; } void FluxboxWindow::translateCoords(int &x, int &y, ReferenceCorner dir) const { -- cgit v0.11.2