diff options
-rw-r--r-- | app/cwm/xevents.c | 17 |
1 files changed, 8 insertions, 9 deletions
diff --git a/app/cwm/xevents.c b/app/cwm/xevents.c index bd2b715c4..ff7420e3c 100644 --- a/app/cwm/xevents.c +++ b/app/cwm/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. * - * $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); } |