add the cursorwarp patch

This commit is contained in:
stupidcomputer 2024-11-25 21:14:07 -06:00
parent 061e9fe9a7
commit 43a850234e
1 changed files with 8 additions and 0 deletions

8
dwm.c
View File

@ -833,6 +833,8 @@ focusmon(const Arg *arg)
unfocus(selmon->sel, 0); unfocus(selmon->sel, 0);
selmon = m; selmon = m;
focus(NULL); focus(NULL);
if (selmon->sel)
XWarpPointer(dpy, None, selmon->sel->win, 0, 0, 0, 0, selmon->sel->w/2, selmon->sel->h/2);
} }
void void
@ -858,6 +860,7 @@ focusstack(const Arg *arg)
if (c) { if (c) {
focus(c); focus(c);
restack(selmon); restack(selmon);
XWarpPointer(dpy, None, c->win, 0, 0, 0, 0, c->w/2, c->h/2);
} }
} }
@ -1085,6 +1088,8 @@ manage(Window w, XWindowAttributes *wa)
c->mon->sel = c; c->mon->sel = c;
arrange(c->mon); arrange(c->mon);
XMapWindow(dpy, c->win); XMapWindow(dpy, c->win);
if (c && c->mon == selmon)
XWarpPointer(dpy, None, c->win, 0, 0, 0, 0, c->w/2, c->h/2);
focus(NULL); focus(NULL);
} }
@ -1799,6 +1804,9 @@ unmanage(Client *c, int destroyed)
focus(NULL); focus(NULL);
updateclientlist(); updateclientlist();
arrange(m); arrange(m);
if (m == selmon && m->sel)
XWarpPointer(dpy, None, m->sel->win, 0, 0, 0, 0,
m->sel->w/2, m->sel->h/2);
} }
void void