[Xcb] question about atoms

Barton C Massey bart at cs.pdx.edu
Thu May 5 13:39:52 PDT 2005


The "obvious" thing to do with XCB types containing a magic
zero is the same thing that's done with pixmaps, windows,
and drawables: the union thing.  Let's continue with the
atom example.  Note that if all the routines that accept
atoms can gracefully accept 0 as well, it's not worth the
bother.  Otherwise, you might do something like.

  typedef enum {
    XCBATOMANYval = 0
  } XCBATOMANY;

  typedef union {
    XCBATOMANY any;
    XCBATOM atom;
  } XCBATOMABLE;

and now you can have routines that take XCBATOM or
XCBATOMABLE as needed.  Ugly, but reasonably effective.

Or you could just do the obvious Xlib-style hack. :-)

	Bart

In message <1115322654.7251.11.camel at id.minilop.net> you wrote:
> On Thu, 2005-05-05 at 21:07 +0200, Vincent Torri wrote:
> > hello,
> 
> Hi Vincent!
> 
> > in Xlib, AnyPropertyType defines a atom which value is 0. But in
> > xcb_atoms, there is not such an atom. Jamey, is it normal ?
> 
> Um...
> 
> Well, technically, there is no atom 0; that's why it doesn't appear in
> xcb_atoms. But in some places you're allowed to specify an atom value of
> 0, so Xlib provides a name for it.
> 
> XCB doesn't currently make it easy to deal with these special zero
> values. (They appear in other places in the protocol, not just for
> atoms.) I'd appreciate suggestions on how to fit these cases into XCB's
> type system, since C doesn't have Nickle's ability to handle structure
> literals. :-)  Bart? Keith?
> 
> In the meantime, I guess you should declare these sorts of values as you
> need them:
> 
> 	XCBATOM AnyPropertyType = { 0 };
> 
> --Jamey
> 
> _______________________________________________
> xcb mailing list
> xcb at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/xcb


More information about the xcb mailing list