[vlc-commits] commit: skins2(Linux): _WM_NET_PID requires WM_CLIENT_MACHINE to be set ( Erwan Tulou )

git at videolan.org git at videolan.org
Wed May 5 00:16:32 CEST 2010


vlc/vlc-1.1 | branch: master | Erwan Tulou <erwan10 at videolan.org> | Mon May  3 15:22:41 2010 +0200| [974faceb34dfeffa1f9ecf242989f6e87aab7778] | committer: Jean-Baptiste Kempf 

skins2(Linux): _WM_NET_PID requires WM_CLIENT_MACHINE to be set

code inspired from xcb.c
(cherry picked from commit aa8b54178110b9862105b31836ddec332469c12d)

Signed-off-by: Jean-Baptiste Kempf <jb at videolan.org>

> http://git.videolan.org/gitweb.cgi/vlc/vlc-1.1.git/?a=commit;h=974faceb34dfeffa1f9ecf242989f6e87aab7778
---

 modules/gui/skins2/x11/x11_window.cpp |   19 +++++++++++++++++++
 1 files changed, 19 insertions(+), 0 deletions(-)

diff --git a/modules/gui/skins2/x11/x11_window.cpp b/modules/gui/skins2/x11/x11_window.cpp
index f45609c..84b2449 100644
--- a/modules/gui/skins2/x11/x11_window.cpp
+++ b/modules/gui/skins2/x11/x11_window.cpp
@@ -164,6 +164,25 @@ X11Window::X11Window( intf_thread_t *pIntf, GenericWindow &rWindow,
     classhint.res_class = (char*) "Vlc";
     XSetClassHint( XDISPLAY, m_wnd, &classhint );
 
+    // initialize WM_CLIENT_MACHINE
+    char* hostname = NULL;
+    long host_name_max = sysconf( _SC_HOST_NAME_MAX );
+    if( host_name_max <= 0 )
+        host_name_max = _POSIX_HOST_NAME_MAX;
+    hostname = new char[host_name_max];
+    if( hostname && gethostname( hostname, host_name_max ) == 0 )
+    {
+        hostname[host_name_max - 1] = '\0';
+
+        XTextProperty textprop;
+        textprop.value = (unsigned char *) hostname;
+        textprop.encoding = XA_STRING;
+        textprop.format = 8;
+        textprop.nitems = strlen( hostname );
+        XSetWMClientMachine( XDISPLAY, m_wnd, &textprop);
+    }
+    delete hostname;
+
     // initialize EWMH pid
     pid_t pid = getpid();
     XChangeProperty( XDISPLAY, m_wnd, NET_WM_PID, XA_CARDINAL, 32,



More information about the vlc-commits mailing list