commit 8df2c57618b076265198321a4aaa5d104f55b6b4
parent d8556e34cd753ac8e252cf2f19a30a91298a0ce0
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
@@ -173,6 +173,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);
@@ -934,6 +935,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)
{
@@ -1932,7 +1947,7 @@ unmanage(Client *c, int destroyed)
XUngrabServer(dpy);
}
free(c);
- focus(NULL);
+ focus(getclientundermouse());
updateclientlist();
arrange(m);
}