diff options
| -rw-r--r-- | dwm.c | 12 |
1 files changed, 12 insertions, 0 deletions
| @@ -220,6 +220,7 @@ static void updatestatus(void); | |||
| 220 | static void updatetitle(Client *c); | 220 | static void updatetitle(Client *c); |
| 221 | static void updatewmhints(Client *c); | 221 | static void updatewmhints(Client *c); |
| 222 | static void view(const Arg *arg); | 222 | static void view(const Arg *arg); |
| 223 | static void warptomon(Monitor *m); | ||
| 223 | static Client *wintoclient(Window w); | 224 | static Client *wintoclient(Window w); |
| 224 | static Monitor *wintomon(Window w); | 225 | static Monitor *wintomon(Window w); |
| 225 | static int xerror(Display *dpy, XErrorEvent *ee); | 226 | static 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 | ||
| 2083 | void | ||
| 2084 | warptomon(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 | |||
| 2081 | Client * | 2093 | Client * |
| 2082 | wintoclient(Window w) { | 2094 | wintoclient(Window w) { |
| 2083 | Client *c; | 2095 | Client *c; |
