all repos — fluxbox @ 559947186ef39e18f273e32026590f824782d905

custom fork of the fluxbox windowmanager

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}
Amadeusz Sławiński amade@asmblr.net
commit

559947186ef39e18f273e32026590f824782d905

parent

58472fea6d1a88c864598141e63aac085b83c77b

1 files changed, 6 insertions(+), 4 deletions(-)

jump to
M src/Window.ccsrc/Window.cc

@@ -3725,25 +3725,27 @@

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 {