]> git.sesse.net Git - vlc/commitdiff
XCB: set WM_CLIENT_MACHINE properly
authorRémi Denis-Courmont <remi@remlab.net>
Wed, 15 Apr 2009 19:35:51 +0000 (22:35 +0300)
committerRémi Denis-Courmont <remi@remlab.net>
Wed, 15 Apr 2009 19:35:51 +0000 (22:35 +0300)
modules/video_output/xcb/window.c

index 5cf4b4b813748edfe69fcdee902284ac73d7de4a..e35fa6b1654e6162fa8d257e5ce23f66bd267b2a 100644 (file)
@@ -27,6 +27,8 @@
 #include <stdarg.h>
 #include <assert.h>
 #include <poll.h>
+#include <unistd.h> /* gethostname() */
+#include <limits.h> /* HOST_NAME_MAX */
 
 #include <xcb/xcb.h>
 #include <xcb/xcb_aux.h>
@@ -80,6 +82,19 @@ void set_ascii_prop (xcb_connection_t *conn, xcb_window_t window,
                          XA_STRING, 8, strlen (value), value);
 }
 
+static inline
+void set_hostname_prop (xcb_connection_t *conn, xcb_window_t window)
+{
+    char hostname[HOST_NAME_MAX];
+
+    if (gethostname (hostname, sizeof (hostname)) == 0)
+    {
+        hostname[sizeof (hostname) - 1] = '\0';
+        set_ascii_prop (conn, window, XA_WM_CLIENT_MACHINE, hostname);
+    }
+}
+
+
 /**
  * Create an X11 window.
  */
@@ -133,6 +148,7 @@ static int Open (vlc_object_t *obj)
                     pgettext ("ASCII VLC", "VLC"));
     xcb_change_property (conn, XCB_PROP_MODE_REPLACE, window, XA_WM_CLASS,
                          XA_STRING, 8, 8, "vlc\0VLC");
+    set_hostname_prop (conn, window);
 
     wnd->handle.xid = window;
     wnd->p_sys = p_sys;