diff options
author | John Ankarstrom <john@ankarstrom.se> | 2021-06-30 18:07:04 +0200 |
---|---|---|
committer | John Ankarstrom <john@ankarstrom.se> | 2021-06-30 18:07:04 +0200 |
commit | 62c3f1087e5f53b2c80821907615bc907cb47676 (patch) | |
tree | c79f5123862b5ede63f12b50ac1e9a57189d1011 /src | |
parent | a2e7053fa52fa1670af7446821c2d488bf69638e (diff) | |
download | jwm-62c3f1087e5f53b2c80821907615bc907cb47676.tar.gz |
Don't move cursor to center of new window
Also prevent offset windows from overflowing.
Diffstat (limited to 'src')
-rw-r--r-- | src/place.c | 18 |
1 files changed, 9 insertions, 9 deletions
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); } |