Correct setting of _NET_WM_PID

The property _NET_WM_PID is a CARDINAL which per definition has format
32, whatever the size of pid_t may be.
CARDINALS (and other format 32 items) must always be passed to Xlib in
long's, whatever the size of long may be.
This commit is contained in:
Kim Woelders 2022-03-31 06:34:04 +02:00 committed by N-R-K
parent bf6c062779
commit e9468d3d36

View file

@ -189,7 +189,7 @@ void win_open(win_t *win)
int gmask;
XSizeHints sizehints;
XWMHints hints;
pid_t pid;
long pid;
char hostname[256];
XSetWindowAttributes attrs;
char res_class[] = RES_CLASS;
@ -247,7 +247,7 @@ void win_open(win_t *win)
/* set the _NET_WM_PID */
pid = getpid();
XChangeProperty(e->dpy, win->xwin, atoms[ATOM__NET_WM_PID], XA_CARDINAL,
sizeof(pid_t) * 8, PropModeReplace, (unsigned char *) &pid, 1);
32, PropModeReplace, (unsigned char *) &pid, 1);
if (gethostname(hostname, ARRLEN(hostname)) == 0) {
XTextProperty tp;
tp.value = (unsigned char *)hostname;