aboutsummaryrefslogtreecommitdiffstats
path: root/xevents.c
diff options
context:
space:
mode:
authoroga2008-06-17 20:55:48 +0000
committeroga2008-06-17 20:55:48 +0000
commitd8992dea78215e8b6fd889297b028280fd28922d (patch)
tree4e5e79014d45dbd08697b9a7fff776a63b96f8c8 /xevents.c
parente7c2e260624529c832dabe37f0503b8ed3a905c1 (diff)
downloadcwm-d8992dea78215e8b6fd889297b028280fd28922d.tar.gz
Just rework the mouse binding calculation on event to look like the
kbfunc one. Makes the code a lot easier to read. Fixes a bug i introduced in the last commit here. ok okan.
Diffstat (limited to 'xevents.c')
-rw-r--r--xevents.c30
1 files changed, 14 insertions, 16 deletions
diff --git a/xevents.c b/xevents.c
index abdc2b8..299993d 100644
--- a/xevents.c
+++ b/xevents.c
@@ -15,7 +15,7 @@
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*
- * $Id: xevents.c,v 1.21 2008/06/17 20:21:17 oga Exp $
+ * $Id: xevents.c,v 1.22 2008/06/17 20:55:48 oga Exp $
*/
/*
@@ -228,26 +228,24 @@ xev_handle_buttonpress(struct xevent *xev, XEvent *ee)
cc = client_find(e->window);
- if (e->window == sc->rootwin) {
- TAILQ_FOREACH(mb, &Conf.mousebindingq, entry) {
- if (e->button == mb->button && e->state == mb->modmask
- && mb->context == MOUSEBIND_CTX_ROOT) {
- (*mb->callback)(cc, e);
- break;
- }
- }
+ TAILQ_FOREACH(mb, &Conf.mousebindingq, entry) {
+ if (e->button == mb->button && e->state == mb->modmask)
+ break;
}
- if (cc == NULL || e->state == 0)
+ if (mb == NULL)
goto out;
- TAILQ_FOREACH(mb, &Conf.mousebindingq, entry) {
- if (e->button == mb->button && e->state == mb->modmask &&
- mb->context == MOUSEBIND_CTX_ROOT) {
- (*mb->callback)(cc, NULL);
- break;
- }
+ if (mb->context == MOUSEBIND_CTX_ROOT) {
+ if (e->window != sc->rootwin)
+ goto out;
+ } else if (mb->context == MOUSEBIND_CTX_WIN) {
+ cc = client_find(e->window);
+ if (cc == NULL)
+ goto out;
}
+
+ (*mb->callback)(cc, e);
out:
xev_register(xev);
}