From 65a3dcf47c2c5de7a3273134c436a77604dddd07 Mon Sep 17 00:00:00 2001 From: Ivan Kanakarakis Date: Wed, 14 Nov 2012 05:11:30 +0200 Subject: fix for FOLLOW_MOUSE on monocle layout - fixes #16 --- monsterwm.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'monsterwm.c') 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}); } /** -- cgit v1.3.1