Fixes compilation on FreeBSD (and hopefully on other POSIX platforms)
This commit is contained in:
parent
6c69002ab4
commit
fa3aab9768
|
@ -21,6 +21,7 @@
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <sys/wait.h>
|
#include <sys/wait.h>
|
||||||
|
|
||||||
|
#include <errno.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
|
||||||
#include <X11/Xatom.h>
|
#include <X11/Xatom.h>
|
||||||
|
@ -159,19 +160,27 @@ static void x11_set_window_class(Display *dpy, Window win)
|
||||||
|
|
||||||
static void x11_set_window_pid(Display *dpy, Window win)
|
static void x11_set_window_pid(Display *dpy, Window win)
|
||||||
{
|
{
|
||||||
|
long scret;
|
||||||
|
char *hostname;
|
||||||
pid_t pid = getpid();
|
pid_t pid = getpid();
|
||||||
char hostname[HOST_NAME_MAX + 1];
|
|
||||||
|
|
||||||
XChangeProperty(dpy, win, XInternAtom(dpy, "_NET_WM_PID", False),
|
XChangeProperty(dpy, win, XInternAtom(dpy, "_NET_WM_PID", False),
|
||||||
XA_CARDINAL, 32, PropModeReplace, (unsigned char *)&pid, 1);
|
XA_CARDINAL, 32, PropModeReplace, (unsigned char *)&pid, 1);
|
||||||
|
|
||||||
if(gethostname(hostname, HOST_NAME_MAX + 1) == -1)
|
errno = 0;
|
||||||
RARCH_WARN("Failed to get hostname.\n");
|
if((scret = sysconf(_SC_HOST_NAME_MAX)) == -1 && errno)
|
||||||
else
|
return;
|
||||||
{
|
if((hostname = malloc(scret + 1)) == NULL)
|
||||||
XChangeProperty(dpy, win, XA_WM_CLIENT_MACHINE, XA_STRING, 8,
|
return;
|
||||||
PropModeReplace, (unsigned char *)hostname, strlen(hostname));
|
|
||||||
}
|
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));
|
||||||
|
}
|
||||||
|
free(hostname);
|
||||||
}
|
}
|
||||||
|
|
||||||
void x11_set_window_attr(Display *dpy, Window win)
|
void x11_set_window_attr(Display *dpy, Window win)
|
||||||
|
|
Loading…
Reference in New Issue