commit cb9e69cc5568fc8c52b3c404620581c11e9e74ac
parent 40105e478133cb059c7eb6e0ad0609c3155a62da
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);
@@ -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)
{
@@ -1930,7 +1945,7 @@ unmanage(Client *c, int destroyed)
XUngrabServer(dpy);
}
free(c);
- focus(NULL);
+ focus(getclientundermouse());
updateclientlist();
arrange(m);
}