diff options
| author | Ivan Kanakarakis <ivan.kanak@gmail.com> | 2012-11-14 05:11:30 +0200 |
|---|---|---|
| committer | Ivan Kanakarakis <ivan.kanak@gmail.com> | 2012-11-14 05:11:30 +0200 |
| commit | 65a3dcf47c2c5de7a3273134c436a77604dddd07 (patch) | |
| tree | 2cb5206dfa858424385a5ef6494c71585be43a8c | |
| parent | c89d4c5574c027b2db90a9a34041be379c46bb70 (diff) | |
fix for FOLLOW_MOUSE on monocle layout - fixes #16
| -rw-r--r-- | monsterwm.c | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/monsterwm.c b/monsterwm.c index 3625b77..ced64b5 100644 --- a/monsterwm.c +++ b/monsterwm.c @@ -435,10 +435,15 @@ void destroynotify(XEvent *e) { * and will get focus if FOLLOW_MOUSE is set in the config. */ void enternotify(XEvent *e) { - Desktop *d = NULL; Client *c = NULL; + Desktop *d = NULL; Client *c = NULL, *p = NULL; + + if (!FOLLOW_MOUSE || (e->xcrossing.mode != NotifyNormal && e->xcrossing.detail == NotifyInferior) + || !wintoclient(e->xcrossing.window, &c, &d) || e->xcrossing.window == d->curr->win) return; - if (FOLLOW_MOUSE && wintoclient(e->xcrossing.window, &c, &d) && e->xcrossing.mode == NotifyNormal - && e->xcrossing.detail != NotifyInferior && e->xcrossing.window != d->curr->win) focus(c, d); + if ((p = d->prev)) + XChangeWindowAttributes(dis, p->win, CWEventMask, &(XSetWindowAttributes){.do_not_propagate_mask = EnterWindowMask}); + focus(c, d); + if (p) XChangeWindowAttributes(dis, p->win, CWEventMask, &(XSetWindowAttributes){.event_mask = EnterWindowMask}); } /** |
