[Xcb] Proposal to re-encapsulate xcb_generate_id()
Ian Osgood
iano at quirkster.com
Fri Nov 10 08:58:07 PST 2006
We exposed xcb_generate_id in the last set of release candidates.
I propose a modification to the code generation to encapsulate
xcb_generate_id() within the object creation protocol.
The description would add an an optional boolean attribute to the XID
parameter to be generated, turning it from an "in" to an "out"
parameter. For example:
<request name="CreateWindow" opcode="1">
<field type="CARD8" name="depth" />
<field type="WINDOW" name="wid" generated="true" />
...
Would generate the prototype and function:
xcb_void_cookie_t
xcb_create_window (xcb_connection_t *c /**< */,
uint8_t depth /**< */,
xcb_window_t *wid /**< */, /* WAS: wid */
...
{
...
xcb_out.depth = depth;
xcb_out.wid = *wid = xcb_generate_id(c); /* WAS: = wid; */
...
}
Advantages:
* Less boilerplate for clients to write.
* Documents the semantics of the X protocol.
* xcb_generate_id() can be moved back into xcbext.h
* Closer to how Xlib handles object creation.
What do folks think about this?
Ian
More information about the Xcb
mailing list