mirror of
https://github.com/leahneukirchen/cwm.git
synced 2023-08-10 21:13:12 +03:00
[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.
This commit is contained in:
parent
2a3c2b5231
commit
bf43b62414
13
xevents.c
13
xevents.c
@ -292,7 +292,11 @@ xev_handle_keypress(XEvent *ee)
|
|||||||
KeySym keysym, skeysym;
|
KeySym keysym, skeysym;
|
||||||
unsigned int modshift;
|
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);
|
keysym = XkbKeycodeToKeysym(X_Dpy, e->keycode, 0, 0);
|
||||||
skeysym = XkbKeycodeToKeysym(X_Dpy, e->keycode, 0, 1);
|
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))
|
if (kb->press.keysym == ((modshift == 0) ? keysym : skeysym))
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (kb == NULL)
|
if (kb == NULL)
|
||||||
return;
|
return;
|
||||||
kb->cargs->xev = CWM_XEV_KEY;
|
kb->cargs->xev = CWM_XEV_KEY;
|
||||||
switch (kb->context) {
|
switch (kb->context) {
|
||||||
case CWM_CONTEXT_CC:
|
case CWM_CONTEXT_CC:
|
||||||
if (((cc = client_find(e->window)) == NULL) &&
|
if (((cc = client_find(e->subwindow)) == NULL) &&
|
||||||
((cc = client_current(NULL)) == NULL))
|
((cc = client_current(sc)) == NULL))
|
||||||
return;
|
return;
|
||||||
(*kb->callback)(cc, kb->cargs);
|
(*kb->callback)(cc, kb->cargs);
|
||||||
break;
|
break;
|
||||||
case CWM_CONTEXT_SC:
|
case CWM_CONTEXT_SC:
|
||||||
if ((sc = screen_find(e->window)) == NULL)
|
|
||||||
return;
|
|
||||||
(*kb->callback)(sc, kb->cargs);
|
(*kb->callback)(sc, kb->cargs);
|
||||||
break;
|
break;
|
||||||
case CWM_CONTEXT_NONE:
|
case CWM_CONTEXT_NONE:
|
||||||
|
Loading…
Reference in New Issue
Block a user