[Xcb] More on types and xml-xcb
Josh Triplett
josh.trip at verizon.net
Wed Apr 6 20:06:34 PDT 2005
Jeremy Kolb wrote:
> I just added support for float and double in c-client.xsl... I hope you
> don't mind Josh :)
Not a problem at all. The only reasons they weren't there already were
that 1) they weren't in any of the previous protocol descriptions we've
encountered, and 2) I thought there was some rule somewhere about not
putting floats in the X protocol. I suppose the latter may be because X
predates standardized floating point representation?
The main reason for having the core type definitions defined there in
the first place was to avoid the previous behavior, which was to assume
a core type after failing to find a type throughout all the other
descriptions. This was slow and error-prone.
Also, I've been meaning to move the core type definitions into an
external XML file, something like "core.xml" or "builtin.xml". That
would make changing them easier, and make things easier for non-XCB
software such as Xamine as well.
> This brings me to another point. I've run into this a few times with
> type names. For instance if I want "XCBGlxPixmap" and there's already
> an XCBPixmap #defined in xproto.h I get an error about Pixmap being
> defined multiple times. Can we add an option so that it uses the "newly
> defined" type instead? Maybe something like <xidtype name="Pixmap"
> newname="true"/> or something? I guess it would also have to go in
> enums, structs, typedefs as well.
>
> Since PIXMAP and Pixmap are already used I'd have to use something like
> GLXPIXMAP which will give me XCBGlxGLXPIXMAP which is kind of cumbersome.
>
> Any thoughts on this?
It's a known issue that needs to be resolved. For example, see Shape,
which has types SHAPE_OP and SHAPE_KIND, which expand to
XCBShapeSHAPE_{OP,KIND}. The only reason these weren't shortened to
"OP" and "KIND" was the concern about using up the name "OP". At the
moment, XML-XCB has no way to say "I want the OP type from shape" or "I
want the Pixmap type from glx"; it just looks for all the types, and
complains if it doesn't find exactly one definition.
My current plan to fix this is to retain the behavior of searching
everything by default (and complaining in the face of ambiguity), but
allowing you to specify a specific namespace for disambiguation. For
example, <field type="shape::OP" ... /> or <field type="glx::Pixmap" ...
/>. (Suggestions for better syntax are certainly welcome, if you don't
like that.)
For now, I'm just going to make file-scope namespaces, which you can
refer to using the value from the "header" field of the xcb tag in that
file (which is also the basename of the file without the .xml
extension). In the long-term, it *might* be useful to have explicit
namespaces instead.
- Josh Triplett
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 251 bytes
Desc: OpenPGP digital signature
Url : http://lists.freedesktop.org/archives/xcb/attachments/20050406/582a57cb/signature.pgp
More information about the xcb
mailing list