commit 7bd3fa2317c64791bbf2bef544dcd0deb1b8d312
parent 46a3ee439e3a160921ebd81a005878e240f1b5ba
Author: Natasha Kerensikova <natacha@instinctive.eu>
Date: Sat, 20 May 2023 17:04:45 +0200
[patch] dwm-destroyfocus-20210329-61bb8b2.diff
Diffstat:
M | dwm.c | | | 17 | ++++++++++++++++- |
1 file changed, 16 insertions(+), 1 deletion(-)
diff --git a/dwm.c b/dwm.c
@@ -172,6 +172,7 @@ static void focusin(XEvent *e);
static void focusmon(const Arg *arg);
static void focusstack(const Arg *arg);
static Atom getatomprop(Client *c, Atom prop);
+static Client *getclientundermouse(void);
static int getrootptr(int *x, int *y);
static long getstate(Window w);
static int gettextprop(Window w, Atom atom, char *text, unsigned int size);
@@ -933,6 +934,20 @@ getatomprop(Client *c, Atom prop)
return atom;
}
+Client *
+getclientundermouse(void)
+{
+ int ret, di;
+ unsigned int dui;
+ Window child, dummy;
+
+ ret = XQueryPointer(dpy, root, &dummy, &child, &di, &di, &di, &di, &dui);
+ if (!ret)
+ return NULL;
+
+ return wintoclient(child);
+}
+
int
getrootptr(int *x, int *y)
{
@@ -1931,7 +1946,7 @@ unmanage(Client *c, int destroyed)
XUngrabServer(dpy);
}
free(c);
- focus(NULL);
+ focus(getclientundermouse());
updateclientlist();
arrange(m);
}