From 80a6c7fbec7b310f432f16589e8aff7b963e5371 Mon Sep 17 00:00:00 2001 From: Ivan Kanakarakis Date: Thu, 12 Jan 2012 20:13:16 +0200 Subject: rework FOLLOW_MOUSE option --- monsterwm.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) (limited to 'monsterwm.c') diff --git a/monsterwm.c b/monsterwm.c index 92718f9..f7f510a 100644 --- a/monsterwm.c +++ b/monsterwm.c @@ -155,8 +155,7 @@ void addwindow(Window w) { } prevfocus = current; - XSelectInput(dis, ((current = c)->win = w), PropertyChangeMask); - if (FOLLOW_MOUSE) XSelectInput(dis, c->win, EnterWindowMask); + XSelectInput(dis, ((current = c)->win = w), PropertyChangeMask|(FOLLOW_MOUSE?EnterWindowMask:0)); } void buttonpress(XEvent *e) { @@ -273,10 +272,9 @@ void die(const char *errstr, ...) { } void enternotify(XEvent *e) { - if (FOLLOW_MOUSE) - if ((e->xcrossing.mode == NotifyNormal && e->xcrossing.detail != NotifyInferior) || e->xcrossing.window == root) - for (current=head; current; current=current->next) if (e->xcrossing.window == current->win) break; - if (!current) current = head; + client *c = wintoclient(e->xcrossing.window); + if (!c) return; + if (FOLLOW_MOUSE && e->xcrossing.mode == NotifyNormal && e->xcrossing.detail != NotifyInferior) current = c; update_current(); } -- cgit v1.3.1