Improve code of funcs "setclientstate" and "setfocus"

This commit is contained in:
Alex Kotov 2021-11-20 22:22:30 +05:00
parent 11479d361f
commit 1cbd188b5b
Signed by: kotovalexarian
GPG Key ID: 553C0EBBEB5D5F08
1 changed files with 21 additions and 5 deletions

View File

@ -1249,8 +1249,16 @@ void setclientstate(Client *c, long state)
{
long data[] = { state, None };
XChangeProperty(dpy, c->win, atoms->wmatom[WMState], atoms->wmatom[WMState], 32,
PropModeReplace, (unsigned char *)data, 2);
XChangeProperty(
dpy,
c->win,
atoms->wmatom[WMState],
atoms->wmatom[WMState],
32,
PropModeReplace,
(unsigned char*)data,
2
);
}
int sendevent(Client *c, Atom proto)
@ -1281,10 +1289,18 @@ void setfocus(Client *c)
{
if (!c->neverfocus) {
XSetInputFocus(dpy, c->win, RevertToPointerRoot, CurrentTime);
XChangeProperty(dpy, root, atoms->netatom[NetActiveWindow],
XA_WINDOW, 32, PropModeReplace,
(unsigned char *) &(c->win), 1);
XChangeProperty(
dpy,
root,
atoms->netatom[NetActiveWindow],
XA_WINDOW,
32,
PropModeReplace,
(unsigned char*)&(c->win),
1
);
}
sendevent(c, atoms->wmatom[WMTakeFocus]);
}