Skip to content

Commit

Permalink
Merge pull request #6311 from cbdevnet/master
Browse files Browse the repository at this point in the history
Have dolphin-emu-nogui conform to the _NET_WM_PID protocol
  • Loading branch information
leoetlino committed Feb 3, 2018
2 parents cf5bf38 + 6182ab6 commit 2ab29e8
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions Source/Core/DolphinNoGUI/MainNoGUI.cpp
Expand Up @@ -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
{
Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit 2ab29e8

Please sign in to comment.