aboutsummaryrefslogtreecommitdiffstats
path: root/xevents.c
diff options
context:
space:
mode:
authorokan2013-07-10 14:15:58 +0000
committerokan2013-07-10 14:15:58 +0000
commite2b4dc0478e93db4ec1eed08ef1b5bd5869d1e03 (patch)
treed2ec7e89e48d40a85591da7474145aca4426b1fb /xevents.c
parentd30de00df7158839248bc961a101e910a704fd10 (diff)
downloadcwm-e2b4dc0478e93db4ec1eed08ef1b5bd5869d1e03.tar.gz
bring buttonpress and keypress event handlers slightly closer together
Diffstat (limited to 'xevents.c')
-rw-r--r--xevents.c17
1 files changed, 8 insertions, 9 deletions
diff --git a/xevents.c b/xevents.c
index bd2b715..ff7420e 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.
*
- * $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);
}