Re: NET_WM_PID is broken (was: NET_WM_PID and client leader)



On 2 Aug 2001, Havoc Pennington wrote:

> 
> Mathias Hasselmann <mathias hasselmann gmx de> writes: 
> > 
> > 	IMHO the spec should request explicitly that WM_CLIENT_MACHINE is
> > set to a well defined value.
> > 
> 
> Sounds good. Can you propose some wording on this?

	Attached you'll find a patch against wmspec.sgml (as available on
www.freedesktop.org).


Ciao,
Mathias
-- 
WWW:           http://www.informatik.hu-berlin.de/~hasselma/
PGP/GnuPG:     1024-Bit DSA: ID 55E572F3, 1024-Bit RSA: ID EAAF7CF1
--- wm-spec.sgml,v1.1	Mon Aug  6 17:53:32 2001
+++ wm-spec.sgml	Mon Aug  6 19:15:01 2001
@@ -788,6 +788,16 @@
 respond to the _NET_WM_PING protocol.
 		</para>
 	<para>
+If set, the ICCCM specified property WM_CLIENT_NAME(STRING) also MUST be set.
+Whilest the ICCCM only requests that WM_CLIENT_NAME is set <quote>
+to a string that forms the name of the machine running the client as seen 
+from the machine running the server</quote> conformance to this specification
+requires that:  WM_CLIENT_NAME SHALL be set to the value returned by
+gethostname(2).  When gethostname is not available on the client's platform
+WM_CLIENT_NAME must be set to the value of the nodename field of struct
+utsname as returned by uname(2).
+	</para>
+	<para>
 See also the implementation notes on <link linkend="KILLINGWINDOWS">killing hung processes</link>.
 	</para>
 	</sect2>
@@ -1093,7 +1103,41 @@
 	<sect2 id="KILLINGWINDOWS">
 		<title>Killing Hung Processes</title>
 		<para>
-If processes fail to respond to the _NET_WM_PING protocol _NET_WM_PID may be used in combination with the ICCCM specified WM_CLIENT_MACHINE(STRING) to attempt to kill a process. 
+If processes fail to respond to the _NET_WM_PING protocol _NET_WM_PID may be
+used in combination with the ICCCM specified WM_CLIENT_MACHINE(STRING) to 
+attempt to kill a process.
+		</para>
+		<para>
+Example about how to retrieve a value for WM_CLIENT_MACHINE:
+		</para>
+		<para>
+	<programlisting><![CDATA[
+int net_get_hostname (char *buf, size_t maxlen)
+{
+#ifdef HAVE_GETHOSTNAME
+	if (buf == NULL) return 0;
+
+	gethostname (buf, maxlen);
+	buf [maxlen - 1] = '\0';
+
+	return strlen(buf);
+#else
+	struct utsname name;
+	size_t len;
+
+	if (buf == NULL) return 0;
+
+	uname (&name);
+	len = strlen (name.nodename);
+
+	if (len >= maxlen) len = maxlen - 1;
+	strncpy (buf, name.nodename, len);
+	buf[len] = '\0';
+
+	return len;
+#endif
+}
+]]></programlisting>
 		</para>
 	</sect2>
 	</Sect1>
@@ -1166,7 +1210,18 @@
 	</sect1>
   <Sect1>
     <title>Change history</title>
-    <sect2>
+	    <sect2>
+		<title>Changes since 1.1</title>
+		<itemizedlist>
+			<listitem><para>
+Changed WM_CLIENT_NAME(STRING) from suggested to required for _NET_WM_PID.
+			</para></listitem>
+			<listitem><para>
+Specification and sample code for the content of WM_CLIENT_NAME(STRING).
+			</para></listitem>
+	</itemizedlist>
+	</sect2>
+	<sect2>
 		<title>Changes since 1.0pre5</title>
 		<itemizedlist>
 			<listitem><para>


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]