warp on close patch

This commit is contained in:
yosh 2023-01-05 12:03:00 -06:00
parent f97d6ade0c
commit cee2b7fc79
2 changed files with 49 additions and 0 deletions

View File

@ -653,6 +653,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

View File

@ -0,0 +1,30 @@
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