about summary refs log tree commit diff stats
path: root/dwm.c
diff options
context:
space:
mode:
authorAcid Bong <acid-bong@cock.lt>2022-10-19 13:15:14 +0300
committerAcid Bong <acid-bong@cock.lt>2022-10-19 13:15:14 +0300
commitabd174196e98af390857d3bbc924a3cfac6f27d9 (patch)
tree93f6cfe4498a0f9f4be072a6d5e4ac0e92c51b91 /dwm.c
parent55c72c9467270d2660af66e2052b876eec254104 (diff)
downloaddwm-abd174196e98af390857d3bbc924a3cfac6f27d9.tar.gz
patch: cursorwarp (included)
Diffstat (limited to 'dwm.c')
-rw-r--r--dwm.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/dwm.c b/dwm.c
index 91b6e39..40ac0df 100644
--- a/dwm.c
+++ b/dwm.c
@@ -938,6 +938,8 @@ focusmon(const Arg *arg)
 	unfocus(selmon->sel, 0);
 	selmon = m;
 	focus(NULL);
+	if (selmon->sel)
+		XWarpPointer(dpy, None, selmon->sel->win, 0, 0, 0, 0, selmon->sel->w/2, selmon->sel->h/2);
 }
 
 void
@@ -963,6 +965,7 @@ focusstack(const Arg *arg)
 	if (c) {
 		focus(c);
 		restack(selmon);
+		XWarpPointer(dpy, None, c->win, 0, 0, 0, 0, c->w/2, c->h/2);
 	}
 }
 
@@ -1205,6 +1208,8 @@ manage(Window w, XWindowAttributes *wa)
 	c->mon->sel = c;
 	arrange(c->mon);
 	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);
 }
 
@@ -2029,6 +2034,9 @@ unmanage(Client *c, int destroyed)
 	focus(NULL);
 	updateclientlist();
 	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