summaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
authorOkan Demirmen <okan@cvs.openbsd.org>2013-07-10 14:15:59 +0000
committerOkan Demirmen <okan@cvs.openbsd.org>2013-07-10 14:15:59 +0000
commite5159cc0af688d4f972c084eaa7ee5d754ea85b5 (patch)
tree82d97cc01d7f2501fc61f727d859504735698a31 /app
parent88ddd7e4cba212b732cb8f6e0994c1655a38cc3e (diff)
bring buttonpress and keypress event handlers slightly closer together
Diffstat (limited to 'app')
-rw-r--r--app/cwm/xevents.c17
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);
}