The EMWH protocol states that the X11 client should set the _NET_WM_PID property to contain the process ID of the client owning the window.
This definition however predates the ability to have sandboxed applications, where the client itself doesn't know its actual PID in the global PID namespace.
As a result, a sandboxed application cannot set its _NET_WM_PID property correctly.
To avoid that issue, the Xserver can detect whenever that property is set and change the value to the actual PID determined from the socket with the local client on the fly.
Signed-off-by: Olivier Fourdan email@example.com