From 6b7246cb9031546402ec8c8e9151e445a22a271b Mon Sep 17 00:00:00 2001 From: bakkeby Date: Fri, 13 Jan 2023 16:19:33 +0100 Subject: [PATCH] zoomswap: proposed changes to ensure that previous zooms references are cleared when unmanaging a client ref. #324 --- dwm.c | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/dwm.c b/dwm.c index 7dbf150..9fe65b9 100644 --- a/dwm.c +++ b/dwm.c @@ -4352,7 +4352,7 @@ unfocus(Client *c, int setfocus, Client *nextfocus) void unmanage(Client *c, int destroyed) { - Monitor *m = c->mon; + Monitor *m; #if SWITCHTAG_PATCH unsigned int switchtag = c->switchtag; #endif // SWITCHTAG_PATCH @@ -4361,6 +4361,24 @@ unmanage(Client *c, int destroyed) XkbInfo *xkb; #endif // XKB_PATCH + #if ZOOMSWAP_PATCH + /* Make sure to clear any previous zoom references to the client being removed. */ + #if PERTAG_PATCH + int i; + for (m = mons; m; m = m->next) { + for (i = 0; i <= NUMTAGS; i++) { + if (m->pertag->prevzooms[i] == c) { + m->pertag->prevzooms[i] = NULL; + } + } + } + #else + if (c == prevzoom) + prevzoom = NULL; + #endif // PERTAG_PATCH + #endif // ZOOMSWAP_PATCH + m = c->mon; + #if SWALLOW_PATCH if (c->swallowing) { unswallow(c);