aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIvan Kanakarakis <ivan.kanak@gmail.com>2012-01-12 20:13:16 +0200
committerIvan Kanakarakis <ivan.kanak@gmail.com>2012-01-12 20:16:32 +0200
commit80a6c7fbec7b310f432f16589e8aff7b963e5371 (patch)
tree23c2bd9e9b104428767bd667627913d0448395fb
parent1572cc27403160f9cc0bbe999f5c49f32984515c (diff)
rework FOLLOW_MOUSE option
-rw-r--r--monsterwm.c10
1 files changed, 4 insertions, 6 deletions
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();
}