From 62c3f1087e5f53b2c80821907615bc907cb47676 Mon Sep 17 00:00:00 2001 From: John Ankarstrom Date: Wed, 30 Jun 2021 18:07:04 +0200 Subject: Don't move cursor to center of new window Also prevent offset windows from overflowing. --- src/place.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'src') diff --git a/src/place.c b/src/place.c index 188945b..b9cdaf4 100644 --- a/src/place.c +++ b/src/place.c @@ -361,13 +361,14 @@ void UpdateStrutBounds(BoundingBox *box) { ****************************************************************************/ void PlaceClient(ClientNode *np, int alreadyMapped) { + static int offset = 0; static int prevx = -1; static int prevy = -1; static TimeType last = ZERO_TIME; BoundingBox box; const ScreenType *sp; - int height, offset, overflow, width, winx, winy, x, y; + int height, overflow, width, winx, winy, x, y; int north, south, east, west; TimeType now; unsigned int mask; @@ -405,7 +406,7 @@ void PlaceClient(ClientNode *np, int alreadyMapped) { if(prevx > -1 && prevy > -1 && (abs(x - prevx) <= borderWidth || abs(y - prevy) <= borderWidth)) - offset = borderWidth + titleHeight; + offset += borderWidth + titleHeight; else offset = 0; @@ -415,6 +416,10 @@ void PlaceClient(ClientNode *np, int alreadyMapped) { offset = 0; last = now; + /* Save cursor location. */ + prevx = x; + prevy = y; + /* Show window at cursor. */ width = np->width; height = np->height; @@ -436,15 +441,10 @@ void PlaceClient(ClientNode *np, int alreadyMapped) { /* Correct for overflow. */ ReturnToBorder(np, north, west); + /* Add offset. */ np->x += offset; np->y += offset; - MoveMouseToClient(np); - - /* Save cursor location. */ - JXQueryPointer(display, rootWindow, &rootReturn, &childReturn, - &x, &y, &winx, &winy, &mask); - prevx = x; - prevy = y; + if(offset) ReturnToBorder(np, north, west); } -- cgit v1.2.3