Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

grabbutons() now takes client as param instead of window #170

Merged
merged 1 commit into from
Jun 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions dwm.c
Original file line number Diff line number Diff line change
Expand Up @@ -1307,7 +1307,7 @@ focus(Client *c)
detachfocus(c);
attachfocus(c);

grabbuttons(c->win, 1);
grabbuttons(c, 1);
XCBSetWindowBorder(_wm.dpy, c->win, c->bcol);
setfocus(c);
}
Expand Down Expand Up @@ -1420,15 +1420,15 @@ getrootptr(i16 *x, i16 *y)
}

void
grabbuttons(XCBWindow win, uint8_t focused)
grabbuttons(Client *c, uint8_t focused)
{
u16 i, j;
/* numlock is int */
int modifiers[4] = { 0, XCB_MOD_MASK_LOCK, _wm.numlockmask, _wm.numlockmask|XCB_MOD_MASK_LOCK};
XCBUngrabButton(_wm.dpy, XCB_BUTTON_INDEX_ANY, XCB_BUTTON_MASK_ANY, win);
XCBUngrabButton(_wm.dpy, XCB_BUTTON_INDEX_ANY, XCB_BUTTON_MASK_ANY, c->win);
if (!focused)
{
XCBGrabButton(_wm.dpy, XCB_BUTTON_INDEX_ANY, XCB_MOD_MASK_ANY, win, False, BUTTONMASK,
XCBGrabButton(_wm.dpy, XCB_BUTTON_INDEX_ANY, XCB_MOD_MASK_ANY, c->win, False, BUTTONMASK,
XCB_GRAB_MODE_SYNC, XCB_GRAB_MODE_SYNC, XCB_NONE, XCB_NONE);
}
for (i = 0; i < LENGTH(buttons); i++)
Expand All @@ -1437,7 +1437,7 @@ grabbuttons(XCBWindow win, uint8_t focused)
{
XCBGrabButton(_wm.dpy, buttons[i].button,
buttons[i].mask | modifiers[j],
win, False, BUTTONMASK,
c->win, False, BUTTONMASK,
XCB_GRAB_MODE_ASYNC, XCB_GRAB_MODE_SYNC,
XCB_NONE, XCB_NONE);
}
Expand Down Expand Up @@ -1756,7 +1756,7 @@ managereply(XCBWindow win, XCBCookie requests[ManageCookieLAST])
updatemotifhints(c, motifreply);
updateicon(c, iconreply);
XCBSelectInput(_wm.dpy, win, inputmask);
grabbuttons(win, 0);
grabbuttons(c, 0);

if(!c->desktop)
{ c->desktop = _wm.selmon->desksel;
Expand Down Expand Up @@ -3732,7 +3732,7 @@ unfocus(Client *c, uint8_t setfocus)
if(!c)
{ return;
}
grabbuttons(c->win, 0);
grabbuttons(c, 0);
XCBSetWindowBorder(_wm.dpy, c->win, c->bcol);
if(setfocus)
{
Expand Down
2 changes: 1 addition & 1 deletion dwm.h
Original file line number Diff line number Diff line change
Expand Up @@ -524,7 +524,7 @@ uint32_t *geticonprop(XCBWindowProperty *iconreply);
/* Grabs a win buttons.
* Basically this just allows us to receive button press/release events from windows.
*/
void grabbuttons(XCBWindow win, uint8_t focused);
void grabbuttons(Client *c, uint8_t focused);
/* Grabs a windows keys.
* Basically this just allows us to receive/intercept key press/release events.
*
Expand Down