diff options
author | okan | 2019-03-08 17:40:43 +0000 |
---|---|---|
committer | okan | 2019-03-08 17:40:43 +0000 |
commit | e84d869e7b37a6f1bfce8045982c49e9ae47b805 (patch) | |
tree | da0e1370855620247abcf98c333a865d2bc563c1 /xevents.c | |
parent | 1f97a0b3c43fd4c7d00c2661af638d76c0c7acc0 (diff) | |
download | cwm-e84d869e7b37a6f1bfce8045982c49e9ae47b805.tar.gz |
Similar to keypress event, fetch the screen from the event root window in the
buttonpress handler; bail if we don't manage the screen. Allows us to find the
current client based on the screen/event root.
Diffstat (limited to 'xevents.c')
-rw-r--r-- | xevents.c | 12 |
1 files changed, 5 insertions, 7 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.142 2019/03/08 15:04:39 okan Exp $ + * $OpenBSD: xevents.c,v 1.143 2019/03/08 17:40:43 okan Exp $ */ /* @@ -237,28 +237,26 @@ xev_handle_buttonpress(XEvent *ee) LOG_DEBUG3("root: 0x%lx window: 0x%lx subwindow: 0x%lx", e->root, e->window, e->subwindow); + if ((sc = screen_find(e->root)) == NULL) + return; + e->state &= ~IGNOREMODMASK; TAILQ_FOREACH(mb, &Conf.mousebindq, entry) { if (e->button == mb->press.button && e->state == mb->modmask) break; } - if (mb == NULL) return; mb->cargs->xev = CWM_XEV_BTN; switch (mb->context) { case CWM_CONTEXT_CC: if (((cc = client_find(e->window)) == NULL) && - ((cc = client_current(NULL)) == NULL)) + ((cc = client_current(sc)) == NULL)) return; (*mb->callback)(cc, mb->cargs); break; case CWM_CONTEXT_SC: - if (e->window != e->root) - return; - if ((sc = screen_find(e->window)) == NULL) - return; (*mb->callback)(sc, mb->cargs); break; case CWM_CONTEXT_NONE: |