tButton passthrough when client is not focused - dwm - [fork] customized build … | |
git clone git://src.adamsgaard.dk/dwm | |
Log | |
Files | |
Refs | |
README | |
LICENSE | |
--- | |
commit 022d07605412bc5bd9726f74af9355c562ba4957 | |
parent 2952b68db88f38be8d34b80c7a7d2c7eb5b2484d | |
Author: Markus Teich <[email protected]> | |
Date: Sat, 7 Jan 2017 17:21:29 +0100 | |
Button passthrough when client is not focused | |
Before this change it is not possible to press a button in a client on the first | |
click if the client is not yet focused. The first click on the button would | |
only focus the client and a second click on the button is needed to activate it. | |
This situation can occur when moving the mouse over a client (therefore focusing | |
it) and then moving the focus to another client with keyboard shortcuts. | |
After this commit the behavior is fixed and button presses on unfocused clients | |
are passed to the client correctly. | |
Diffstat: | |
M dwm.c | 21 +++++++++++---------- | |
1 file changed, 11 insertions(+), 10 deletions(-) | |
--- | |
diff --git a/dwm.c b/dwm.c | |
t@@ -446,6 +446,8 @@ buttonpress(XEvent *e) | |
click = ClkWinTitle; | |
} else if ((c = wintoclient(ev->window))) { | |
focus(c); | |
+ restack(selmon); | |
+ XAllowEvents(dpy, ReplayPointer, CurrentTime); | |
click = ClkClientWin; | |
} | |
for (i = 0; i < LENGTH(buttons); i++) | |
t@@ -932,17 +934,16 @@ grabbuttons(Client *c, int focused) | |
unsigned int i, j; | |
unsigned int modifiers[] = { 0, LockMask, numlockmask, numlock… | |
XUngrabButton(dpy, AnyButton, AnyModifier, c->win); | |
- if (focused) { | |
- for (i = 0; i < LENGTH(buttons); i++) | |
- if (buttons[i].click == ClkClientWin) | |
- for (j = 0; j < LENGTH(modifiers); j++) | |
- XGrabButton(dpy, buttons[i].bu… | |
- buttons[i].mask | … | |
- c->win, False, BUT… | |
- GrabModeAsync, Gra… | |
- } else | |
+ if (!focused) | |
XGrabButton(dpy, AnyButton, AnyModifier, c->win, False, | |
- BUTTONMASK, GrabModeAsync, GrabModeSync, N… | |
+ BUTTONMASK, GrabModeSync, GrabModeSync, No… | |
+ for (i = 0; i < LENGTH(buttons); i++) | |
+ if (buttons[i].click == ClkClientWin) | |
+ for (j = 0; j < LENGTH(modifiers); j++) | |
+ XGrabButton(dpy, buttons[i].button, | |
+ buttons[i].mask | modifier… | |
+ c->win, False, BUTTONMASK, | |
+ GrabModeAsync, GrabModeSyn… | |
} | |
} | |