cwm-patched/patches/warp-on-close.diff

31 lines
848 B
Diff

diff --git a/client.c b/client.c
index 59bc7b0..9c04175 100644
--- a/client.c
+++ b/client.c
@@ -652,6 +652,25 @@ client_wm_hints(struct client_ctx *cc)
void
client_close(struct client_ctx *cc)
{
+ struct client_ctx *newcc = cc;
+ struct screen_ctx *sc = cc->sc;
+
+ TAILQ_FOREACH(newcc, &sc->clientq, entry) {
+ if (newcc->gc != cc->gc)
+ continue;
+ if (newcc->flags & CLIENT_HIDDEN ||
+ newcc->flags & CLIENT_IGNORE || (newcc == cc))
+ continue;
+ break;
+ }
+ if (newcc != NULL) {
+ if (newcc->ptr.x < 0 || newcc->ptr.x > newcc->geom.w ||
+ newcc->ptr.y < 0 || newcc->ptr.y > newcc->geom.h) {
+ newcc->ptr.x = newcc->geom.w / 2;
+ newcc->ptr.y = newcc->geom.h / 2;
+ }
+ client_ptr_warp(newcc);
+ }
if (cc->flags & CLIENT_WM_DELETE_WINDOW)
xu_send_clientmsg(cc->win, cwmh[WM_DELETE_WINDOW], CurrentTime);
else