Merge pull request #5756 from Q3CPMA/master

Set _NET_WM_PID
This commit is contained in:
Twinaphex 2017-11-23 22:10:25 +01:00 committed by GitHub
commit 60726b78b6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -21,6 +21,8 @@
#include <sys/types.h>
#include <sys/wait.h>
#include <unistd.h>
#include <X11/Xatom.h>
#ifdef HAVE_CONFIG_H
@ -155,9 +157,27 @@ static void x11_set_window_class(Display *dpy, Window win)
XSetClassHint(dpy, win, &hint);
}
static void x11_set_window_pid(Display *dpy, Window win)
{
pid_t pid = getpid();
char hostname[HOST_NAME_MAX + 1];
XChangeProperty(dpy, win, XInternAtom(dpy, "_NET_WM_PID", False),
XA_CARDINAL, 32, PropModeReplace, (unsigned char *)&pid, 1);
if(gethostname(hostname, HOST_NAME_MAX + 1) == -1)
RARCH_WARN("Failed to get hostname.\n");
else
{
XChangeProperty(dpy, win, XA_WM_CLIENT_MACHINE, XA_STRING, 8,
PropModeReplace, (unsigned char *)hostname, strlen(hostname));
}
}
void x11_set_window_attr(Display *dpy, Window win)
{
x11_set_window_class(dpy, win);
x11_set_window_pid(dpy, win);
}
static void xdg_screensaver_inhibit(Window wnd)