summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJulius Plenz <plenz@cis.fu-berlin.de>2010-10-13 11:19:35 (GMT)
committer Julius Plenz <plenz@cis.fu-berlin.de>2010-10-13 14:45:52 (GMT)
commitaea48bd580cc894ff707d1c99f72cfae0ffab866 (patch)
tree395a24fbe1eb57a9aff1b72f62fd2f7cd51a4b19
parentb97f0408b5c250385a3f5f60d59a462105d4b154 (diff)
downloaddwm-master.tar.gz
dwm-master.tar.bz2
When switching monitors, warp mouseHEADv5.8.2-feh3masterfeh/patches
This way, dmenu pops up on the currently selected display each time and there are no focus issues any more.
-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;