dolphin-emu-nogui: Conform to the _NET_WM_PID protocol

This commit is contained in:
cbdev 2018-01-19 22:31:44 +01:00
parent 71b5519688
commit 6182ab6a6a
1 changed files with 15 additions and 0 deletions

View File

@ -141,9 +141,14 @@ void Host_UpdateProgressDialog(const char* caption, int position, int total)
}
#if HAVE_X11
#include <X11/Xatom.h>
#include <X11/Xlib.h>
#include <X11/keysym.h>
#include "UICommon/X11Utils.h"
#ifndef HOST_NAME_MAX
#include <climits>
#define HOST_NAME_MAX _POSIX_HOST_NAME_MAX
#endif
class PlatformX11 : public Platform
{
@ -172,6 +177,16 @@ class PlatformX11 : public Platform
Atom wmProtocols[1];
wmProtocols[0] = XInternAtom(dpy, "WM_DELETE_WINDOW", True);
XSetWMProtocols(dpy, win, wmProtocols, 1);
pid_t pid = getpid();
XChangeProperty(dpy, win, XInternAtom(dpy, "_NET_WM_PID", False), XA_CARDINAL, 32,
PropModeReplace, reinterpret_cast<unsigned char*>(&pid), 1);
char host_name[HOST_NAME_MAX] = "";
if (!gethostname(host_name, sizeof(host_name)))
{
XTextProperty wmClientMachine = {reinterpret_cast<unsigned char*>(host_name), XA_STRING, 8,
strlen(host_name)};
XSetWMClientMachine(dpy, win, &wmClientMachine);
}
XMapRaised(dpy, win);
XFlush(dpy);
s_window_handle = (void*)win;