[Xcb] [patch] Define and use the opcode numbers.

Josh Triplett josh at freedesktop.org
Fri Aug 18 20:02:54 PDT 2006

Zephaniah E. Hull wrote:
> Hard coding the opcode numbers in the function just makes it harder to
> figure out what's going on, but much more to the point, not defining the
> opcodes in the header makes it impossible to use the generated headers
> instead of the x11proto headers in the server.
> This is bad, and the attached patch fixes it.

Looks like a good idea to me; very happy to hear that the headers could
get used in the server.  One comment below.

> diff --git a/xcb/src/c-client.xsl b/xcb/src/c-client.xsl
> index 218e093..598be4d 100644
> --- a/xcb/src/c-client.xsl
> +++ b/xcb/src/c-client.xsl
> @@ -235,7 +235,7 @@ authorization from the authors.
>        </xsl:attribute>
>        <field type="XCBConnection *" name="c" />
>        <xsl:apply-templates select="$req/*[not(self::reply)]" mode="param" />
> -      <do-request ref="XCB{$ext}{$req/@name}Req" opcode="{$req/@opcode}"
> +      <do-request ref="XCB{$ext}{$req/@name}Req" opcode="XCB_{$ext}{@name}"
>                    checked="{$checked}">

In the request-function template, you need to use $req/@name, not just
@name.  While it just so happens that the context node points to the
request node at the current callers of this function, the function
should not actually rely on this, but should instead use its $req
parameter to refer to the request node.  (In fact, in an alternate
implementation of this function, it got called from an xsl:for-each loop
instead, which changed the context; we switched to the current
implementation before committing to work around a bug in xsltproc.)

- Josh Triplett

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 252 bytes
Desc: OpenPGP digital signature
Url : http://lists.freedesktop.org/archives/xcb/attachments/20060818/5f5e0859/signature.pgp

More information about the Xcb mailing list