diff options
author | okan <okan> | 2019-03-08 14:48:02 +0000 |
---|---|---|
committer | okan <okan> | 2019-03-08 14:48:02 +0000 |
commit | bf43b6241405dffa02ae15bf4ec1d55f84ea52aa (patch) | |
tree | d51a5113240bedf096108a4da8afa56289a999eb /xevents.c | |
parent | 2a3c2b5231e42691580c6ad90d82980e84cd5302 (diff) | |
download | cwm-bf43b6241405dffa02ae15bf4ec1d55f84ea52aa.tar.gz cwm-bf43b6241405dffa02ae15bf4ec1d55f84ea52aa.tar.xz cwm-bf43b6241405dffa02ae15bf4ec1d55f84ea52aa.zip |
[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 | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/xevents.c b/xevents.c index cdbfdfc..bbf8722 100644 --- a/xevents.c +++ b/xevents.c @@ -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: |