[Xcb] XCBImage

Jamey Sharp jamey at minilop.net
Fri Mar 4 12:33:10 PST 2005

On Fri, Mar 04, 2005 at 08:45:50PM +0100, Vincent Torri wrote:
> hey,

Hi Vincent!

> a question of design: in Xlib, a XImage stores the shm info.
> Is it better to do the same, so that the shm informations are not passed
> to the different functions ?
> Or should i ask the user to pass these informations to the functions ?
> I would prefer the second choice, but feel free to convince me to do like
> Xlib ;)

Argue in *support* of an Xlib design decision? Me? ;-)

The XCBShmSEG XID and the base address of the associated segment are
tied together with the address of the XCBImage data. (These correspond
to the shmseg and shmaddr fields of XShmSegmentInfo. The other two
fields of XShmSegmentInfo only matter for ShmAttach, though, which
surely doesn't need a structure to have its arguments passed in.) I
think it'd only make the interface error-prone to expect the application
to keep track of those values separately.

I am inclined to store these values differently than Xlib does, though.
XCBShmCreateImage should return an XCBShmImage structure, which should
contain an XCBImage and these two extra values. Your version of
XCBShmPutImage et al should only accept an XCBShmImage. Xlib just
assumes that the (void *obdata) in the XImage handed to it is an
XShmSegmentInfo, but we can get the C compiler to check for us.

Does that seem reasonable?


More information about the xcb mailing list