Merge pull request #6311 from cbdevnet/master

Have dolphin-emu-nogui conform to the _NET_WM_PID protocol
This commit is contained in:
Léo Lam 2018-02-03 10:42:49 +01:00 committed by GitHub
commit 2ab29e8284
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
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 #if HAVE_X11
#include <X11/Xatom.h>
#include <X11/Xlib.h> #include <X11/Xlib.h>
#include <X11/keysym.h> #include <X11/keysym.h>
#include "UICommon/X11Utils.h" #include "UICommon/X11Utils.h"
#ifndef HOST_NAME_MAX
#include <climits>
#define HOST_NAME_MAX _POSIX_HOST_NAME_MAX
#endif
class PlatformX11 : public Platform class PlatformX11 : public Platform
{ {
@ -172,6 +177,16 @@ class PlatformX11 : public Platform
Atom wmProtocols[1]; Atom wmProtocols[1];
wmProtocols[0] = XInternAtom(dpy, "WM_DELETE_WINDOW", True); wmProtocols[0] = XInternAtom(dpy, "WM_DELETE_WINDOW", True);
XSetWMProtocols(dpy, win, wmProtocols, 1); 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); XMapRaised(dpy, win);
XFlush(dpy); XFlush(dpy);
s_window_handle = (void*)win; s_window_handle = (void*)win;