]> git.sesse.net Git - vlc/commitdiff
skins2(Linux): _WM_NET_PID requires WM_CLIENT_MACHINE to be set
authorErwan Tulou <erwan10@videolan.org>
Mon, 3 May 2010 13:22:41 +0000 (15:22 +0200)
committerErwan Tulou <erwan10@videolan.org>
Mon, 3 May 2010 13:28:08 +0000 (15:28 +0200)
code inspired from xcb.c

modules/gui/skins2/x11/x11_window.cpp

index f45609c200991b1ebf1a26c4b327c9764b99456c..84b24497381c5a40700dac6078599d0d2dcd6b39 100644 (file)
@@ -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,