From ccd96d15637595d18f9702b0490afb09a0bfab94 Mon Sep 17 00:00:00 2001 From: Yuri Karaban Date: Sat, 12 Apr 2014 18:55:57 +0300 Subject: [PATCH] autoPlaceWindow: try placing window at center first --- src/placement.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/placement.c b/src/placement.c index 8cacd472..0ac0cab7 100644 --- a/src/placement.c +++ b/src/placement.c @@ -434,6 +434,14 @@ autoPlaceWindow(WWindow *wwin, int *x_ret, int *y_ret, sw = usableArea.x2 - usableArea.x1; sh = usableArea.y2 - usableArea.y1; + /* try placing at center first */ + if (center_place_window(wwin, &x, &y, width, height, usableArea) && + screen_has_space(scr, x, y, width, height, False)) { + *x_ret = x; + *y_ret = y; + return True; + } + /* this was based on fvwm2's smart placement */ for (y = Y_ORIGIN; (y + height) < sh; y += PLACETEST_VSTEP) { for (x = X_ORIGIN; (x + width) < sw; x += PLACETEST_HSTEP) {