diff options
author | okan | 2019-03-08 14:48:02 +0000 |
---|---|---|
committer | okan | 2019-03-08 14:48:02 +0000 |
commit | 70ba7fb2eae3142e0e36174cf69253283d5f2949 (patch) | |
tree | c7a0dd85da2c803c061a3a3f1324938841e1f76e /xevents.c | |
parent | f89dd493844f2d7f151dbda5a83c5e68fa131c8e (diff) | |
download | cwm-70ba7fb2eae3142e0e36174cf69253283d5f2949.tar.gz |
[keypress event] turns out we've been checking the wrong window for a matching
client thus always falling back to client_current(); while the current client
is problaby right in most cases, use event's subwindow (not window) to find the
client. Bail early if this event came to us from a screen we don't manage.
This is result of us grabing all keybindings off the root window instead of
selectively.
Diffstat (limited to 'xevents.c')
-rw-r--r-- | xevents.c | 15 |
1 files changed, 8 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.140 2019/03/08 13:17:26 okan Exp $ + * $OpenBSD: xevents.c,v 1.141 2019/03/08 14:48:02 okan Exp $ */ /* @@ -292,7 +292,11 @@ xev_handle_keypress(XEvent *ee) KeySym keysym, skeysym; unsigned int modshift; - LOG_DEBUG3("window: 0x%lx", e->window); + 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; keysym = XkbKeycodeToKeysym(X_Dpy, e->keycode, 0, 0); skeysym = XkbKeycodeToKeysym(X_Dpy, e->keycode, 0, 1); @@ -311,20 +315,17 @@ xev_handle_keypress(XEvent *ee) if (kb->press.keysym == ((modshift == 0) ? keysym : skeysym)) break; } - if (kb == NULL) return; kb->cargs->xev = CWM_XEV_KEY; switch (kb->context) { case CWM_CONTEXT_CC: - if (((cc = client_find(e->window)) == NULL) && - ((cc = client_current(NULL)) == NULL)) + if (((cc = client_find(e->subwindow)) == NULL) && + ((cc = client_current(sc)) == NULL)) return; (*kb->callback)(cc, kb->cargs); break; case CWM_CONTEXT_SC: - if ((sc = screen_find(e->window)) == NULL) - return; (*kb->callback)(sc, kb->cargs); break; case CWM_CONTEXT_NONE: |