summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--dwm.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/dwm.c b/dwm.c
index 53af7c9..1afb953 100644
--- a/dwm.c
+++ b/dwm.c
@@ -220,6 +220,7 @@ static void updatestatus(void);
220static void updatetitle(Client *c); 220static void updatetitle(Client *c);
221static void updatewmhints(Client *c); 221static void updatewmhints(Client *c);
222static void view(const Arg *arg); 222static void view(const Arg *arg);
223static void warptomon(Monitor *m);
223static Client *wintoclient(Window w); 224static Client *wintoclient(Window w);
224static Monitor *wintomon(Window w); 225static Monitor *wintomon(Window w);
225static int xerror(Display *dpy, XErrorEvent *ee); 226static int xerror(Display *dpy, XErrorEvent *ee);
@@ -882,6 +883,7 @@ focusmon(const Arg *arg) {
882 return; 883 return;
883 unfocus(selmon->sel, True); 884 unfocus(selmon->sel, True);
884 selmon = m; 885 selmon = m;
886 warptomon(selmon);
885 focus(NULL); 887 focus(NULL);
886} 888}
887 889
@@ -2078,6 +2080,16 @@ view(const Arg *arg) {
2078 arrange(selmon); 2080 arrange(selmon);
2079} 2081}
2080 2082
2083void
2084warptomon(Monitor *m) {
2085 if(!m)
2086 return;
2087 if(m->sel) /* focus previously focused client */
2088 XWarpPointer(dpy, None, selmon->sel->win, 0, 0, 0, 0, 0, 0);
2089 else /* upper left corner */
2090 XWarpPointer(dpy, None, root, 0, 0, 0, 0, selmon->wx, selmon->wy);
2091}
2092
2081Client * 2093Client *
2082wintoclient(Window w) { 2094wintoclient(Window w) {
2083 Client *c; 2095 Client *c;