diff options
author | Campbell Barton <ideasman42@gmail.com> | 2015-02-19 01:19:12 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2015-02-19 01:54:11 +0300 |
commit | 5ed2cc80708b5a9b5c5185ffb50b9d214ba5d0a2 (patch) | |
tree | c68224a0dace4c48aadea54921ec76b9a6436abd /intern/ghost | |
parent | f0527d963180e7f88cd8f89dde82512a38382abc (diff) |
Fix T43652: X11 "_NET_WM_PID" not set by Ghost
D1107 by @kevindietrich
Diffstat (limited to 'intern/ghost')
-rw-r--r-- | intern/ghost/intern/GHOST_WindowX11.cpp | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/intern/ghost/intern/GHOST_WindowX11.cpp b/intern/ghost/intern/GHOST_WindowX11.cpp index f4b9b84ba9a..613b4dfe4be 100644 --- a/intern/ghost/intern/GHOST_WindowX11.cpp +++ b/intern/ghost/intern/GHOST_WindowX11.cpp @@ -56,6 +56,9 @@ #include <cstring> #include <cstdio> +/* gethostname */ +#include <unistd.h> + #include <algorithm> #include <string> @@ -71,6 +74,9 @@ typedef struct { #define MWM_HINTS_DECORATIONS (1L << 1) +#ifndef HOST_NAME_MAX +# define HOST_NAME_MAX 64 +#endif // #define GHOST_X11_GRAB @@ -504,6 +510,30 @@ GHOST_WindowX11( BLENDER_ICON_48x48x32[0] * BLENDER_ICON_48x48x32[1] + 2); } + /* set the process ID (_NET_WM_PID) */ + { + Atom _NET_WM_PID = XInternAtom(m_display, "_NET_WM_PID", False); + pid_t pid = getpid(); + XChangeProperty(m_display, m_window, _NET_WM_PID, XA_CARDINAL, + 32, PropModeReplace, (unsigned char *)&pid, 1); + } + + + /* set the hostname (WM_CLIENT_MACHINE) */ + { + char hostname[HOST_NAME_MAX]; + char *text_array[1]; + XTextProperty text_prop; + + gethostname(hostname, sizeof(hostname)); + hostname[sizeof(hostname) - 1] = '\0'; + text_array[0] = hostname; + + XStringListToTextProperty(text_array, 1, &text_prop); + XSetWMClientMachine(m_display, m_window, &text_prop); + XFree(text_prop.value); + } + #ifdef WITH_X11_XINPUT initXInputDevices(); |