[vlc-devel] commit: XCB: set WM_CLIENT_MACHINE properly ( Rémi Denis-Courmont )

git version control git at videolan.org
Wed Apr 15 21:36:11 CEST 2009


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Wed Apr 15 22:35:51 2009 +0300| [607f8a8a453fefbe51f1a19849c107f1eb823ba6] | committer: Rémi Denis-Courmont 

XCB: set WM_CLIENT_MACHINE properly

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=607f8a8a453fefbe51f1a19849c107f1eb823ba6
---

 modules/video_output/xcb/window.c |   16 ++++++++++++++++
 1 files changed, 16 insertions(+), 0 deletions(-)

diff --git a/modules/video_output/xcb/window.c b/modules/video_output/xcb/window.c
index 5cf4b4b..e35fa6b 100644
--- a/modules/video_output/xcb/window.c
+++ b/modules/video_output/xcb/window.c
@@ -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;




More information about the vlc-devel mailing list