aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIvan Kanakarakis <ivan.kanak@gmail.com>2012-07-20 17:11:43 +0300
committerIvan Kanakarakis <ivan.kanak@gmail.com>2012-07-20 18:52:18 +0300
commit24b94d72ba73bf4c4c4cadde3136e5ad1de528af (patch)
treeb06f9ec0bedbcbd0e85b92f41a36d00ae189e8e0
parentf5127003b9a22ce7c5cabdd956cb6f60cd8de868 (diff)
rework buttonpress fuction - allow commands even if no window is there
-rw-r--r--monsterwm.c13
1 files changed, 6 insertions, 7 deletions
diff --git a/monsterwm.c b/monsterwm.c
index e176855..c586fc2 100644
--- a/monsterwm.c
+++ b/monsterwm.c
@@ -237,15 +237,14 @@ void buttonpress(XEvent *e) {
Desktop *d = NULL;
Client *c = NULL;
- if (!wintoclient(e->xbutton.window, &c, &d)) return;
-
- if (CLICK_TO_FOCUS && d->curr != c && e->xbutton.button == Button1) focus(c, d);
+ if (wintoclient(e->xbutton.window, &c, &d) && CLICK_TO_FOCUS &&
+ c != d->curr && e->xbutton.button == Button1) focus(c, d);
for (unsigned int i = 0; i < LENGTH(buttons); i++)
- if (CLEANMASK(buttons[i].mask) == CLEANMASK(e->xbutton.state)
- && buttons[i].button == e->xbutton.button) {
- if (d->curr != c) focus(c, d);
- if (buttons[i].func) buttons[i].func(&(buttons[i].arg));
+ if (CLEANMASK(buttons[i].mask) == CLEANMASK(e->xbutton.state) &&
+ buttons[i].func && buttons[i].button == e->xbutton.button) {
+ if (c && d->curr != c) focus(c, d);
+ buttons[i].func(&(buttons[i].arg));
}
}