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.
This commit is contained in:
parent
2952b68db8
commit
022d076054
9
dwm.c
9
dwm.c
|
@ -446,6 +446,8 @@ buttonpress(XEvent *e)
|
||||||
click = ClkWinTitle;
|
click = ClkWinTitle;
|
||||||
} else if ((c = wintoclient(ev->window))) {
|
} else if ((c = wintoclient(ev->window))) {
|
||||||
focus(c);
|
focus(c);
|
||||||
|
restack(selmon);
|
||||||
|
XAllowEvents(dpy, ReplayPointer, CurrentTime);
|
||||||
click = ClkClientWin;
|
click = ClkClientWin;
|
||||||
}
|
}
|
||||||
for (i = 0; i < LENGTH(buttons); i++)
|
for (i = 0; i < LENGTH(buttons); i++)
|
||||||
|
@ -932,7 +934,9 @@ grabbuttons(Client *c, int focused)
|
||||||
unsigned int i, j;
|
unsigned int i, j;
|
||||||
unsigned int modifiers[] = { 0, LockMask, numlockmask, numlockmask|LockMask };
|
unsigned int modifiers[] = { 0, LockMask, numlockmask, numlockmask|LockMask };
|
||||||
XUngrabButton(dpy, AnyButton, AnyModifier, c->win);
|
XUngrabButton(dpy, AnyButton, AnyModifier, c->win);
|
||||||
if (focused) {
|
if (!focused)
|
||||||
|
XGrabButton(dpy, AnyButton, AnyModifier, c->win, False,
|
||||||
|
BUTTONMASK, GrabModeSync, GrabModeSync, None, None);
|
||||||
for (i = 0; i < LENGTH(buttons); i++)
|
for (i = 0; i < LENGTH(buttons); i++)
|
||||||
if (buttons[i].click == ClkClientWin)
|
if (buttons[i].click == ClkClientWin)
|
||||||
for (j = 0; j < LENGTH(modifiers); j++)
|
for (j = 0; j < LENGTH(modifiers); j++)
|
||||||
|
@ -940,9 +944,6 @@ grabbuttons(Client *c, int focused)
|
||||||
buttons[i].mask | modifiers[j],
|
buttons[i].mask | modifiers[j],
|
||||||
c->win, False, BUTTONMASK,
|
c->win, False, BUTTONMASK,
|
||||||
GrabModeAsync, GrabModeSync, None, None);
|
GrabModeAsync, GrabModeSync, None, None);
|
||||||
} else
|
|
||||||
XGrabButton(dpy, AnyButton, AnyModifier, c->win, False,
|
|
||||||
BUTTONMASK, GrabModeAsync, GrabModeSync, None, None);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user