diff options
author | okan | 2013-07-10 14:15:58 +0000 |
---|---|---|
committer | okan | 2013-07-10 14:15:58 +0000 |
commit | e2b4dc0478e93db4ec1eed08ef1b5bd5869d1e03 (patch) | |
tree | d2ec7e89e48d40a85591da7474145aca4426b1fb /xevents.c | |
parent | d30de00df7158839248bc961a101e910a704fd10 (diff) | |
download | cwm-e2b4dc0478e93db4ec1eed08ef1b5bd5869d1e03.tar.gz |
bring buttonpress and keypress event handlers slightly closer together
Diffstat (limited to 'xevents.c')
-rw-r--r-- | xevents.c | 17 |
1 files changed, 8 insertions, 9 deletions
@@ -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. * - * $OpenBSD: xevents.c,v 1.87 2013/07/08 18:19:22 okan Exp $ + * $OpenBSD: xevents.c,v 1.88 2013/07/10 14:15:58 okan Exp $ */ /* @@ -238,12 +238,8 @@ xev_handle_buttonpress(XEvent *ee) { XButtonEvent *e = &ee->xbutton; struct client_ctx *cc, fakecc; - struct screen_ctx *sc; struct mousebinding *mb; - sc = screen_fromroot(e->root); - cc = client_find(e->window); - e->state &= ~IGNOREMODMASK; TAILQ_FOREACH(mb, &Conf.mousebindingq, entry) { @@ -253,13 +249,16 @@ xev_handle_buttonpress(XEvent *ee) if (mb == NULL) return; - if (mb->flags == MOUSEBIND_CTX_ROOT) { - if (e->window != sc->rootwin) + if (mb->flags == MOUSEBIND_CTX_WIN) { + if (((cc = client_find(e->window)) == NULL) && + (cc = client_current()) == NULL) + return; + } else { /* (mb->flags == MOUSEBIND_CTX_ROOT) */ + if (e->window != e->root) return; cc = &fakecc; cc->sc = screen_fromroot(e->window); - } else if (cc == NULL) /* (mb->flags == MOUSEBIND_CTX_WIN */ - return; + } (*mb->callback)(cc, e); } |