dotfiles/.config/suckless/dwm-6.4/patches/focuslastondestroy.diff
2023-10-28 12:27:52 +02:00

41 lines
990 B
Diff

diff --git a/dwm.c b/dwm.c
index e5efb6a..750783a 100644
--- a/dwm.c
+++ b/dwm.c
@@ -170,6 +170,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 *getclientptr(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);
@@ -878,6 +879,17 @@ getatomprop(Client *c, Atom prop)
return atom;
}
+Client *
+getclientptr(void)
+{
+ int di;
+ unsigned int dui;
+ Window win, dummy;
+
+ XQueryPointer(dpy, root, &dummy, &win, &di, &di, &di, &di, &dui);
+ return wintoclient(win);
+}
+
int
getrootptr(int *x, int *y)
{
@@ -2040,8 +2052,8 @@ view(const Arg *arg)
selmon->seltags ^= 1; /* toggle sel tagset */
if (arg->ui & TAGMASK)
selmon->tagset[selmon->seltags] = arg->ui & TAGMASK;
- focus(NULL);
arrange(selmon);
+ focus(getclientptr());
}
Client *