dwm-destroyfocus-20210329-61bb8b2.diff - sites - public wiki contents of suckless.org
(HTM) git clone git://git.suckless.org/sites
(DIR) Log
(DIR) Files
(DIR) Refs
---
dwm-destroyfocus-20210329-61bb8b2.diff (978B)
---
1 diff --git dwm.c dwm.c
2 index 5e4d494..bdb1446 100644
3 --- dwm.c
4 +++ dwm.c
5 @@ -170,6 +170,7 @@ static void focusin(XEvent *e);
6 static void focusmon(const Arg *arg);
7 static void focusstack(const Arg *arg);
8 static Atom getatomprop(Client *c, Atom prop);
9 +static Client *getclientundermouse(void);
10 static int getrootptr(int *x, int *y);
11 static long getstate(Window w);
12 static int gettextprop(Window w, Atom atom, char *text, unsigned int size);
13 @@ -872,6 +873,20 @@ getatomprop(Client *c, Atom prop)
14 return atom;
15 }
16
17 +Client *
18 +getclientundermouse(void)
19 +{
20 + int ret, di;
21 + unsigned int dui;
22 + Window child, dummy;
23 +
24 + ret = XQueryPointer(dpy, root, &dummy, &child, &di, &di, &di, &di, &dui);
25 + if (!ret)
26 + return NULL;
27 +
28 + return wintoclient(child);
29 +}
30 +
31 int
32 getrootptr(int *x, int *y)
33 {
34 @@ -1782,7 +1797,7 @@ unmanage(Client *c, int destroyed)
35 XUngrabServer(dpy);
36 }
37 free(c);
38 - focus(NULL);
39 + focus(getclientundermouse());
40 updateclientlist();
41 arrange(m);
42 }