12.07.2015 Views

Xlib − C Language X Interface

Xlib − C Language X Interface

Xlib − C Language X Interface

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

<strong>Xlib</strong> − C LibraryX11, Release 6.7 DRAFTtypedef struct _DoSomethingReq {CARD8 reqType; /* X_DoSomething */CARD8 someDatum; /* used differently in different requests */CARD16 length B16; /* total # of bytes in request, divided by 4 */.../* request-specific data */...}xDoSomethingReq;If a core protocol request has a single 32-bit argument, you need not declare a request structure inyour extension header file. Instead, such requests use the xResourceReq structure in. This structure is used for any request whose single argument is a Window,Pixmap, Drawable, GContext, Font, Cursor, Colormap, Atom, or VisualID.typedef struct _ResourceReq {CARD8 reqType; /* the request type, e.g. X_DoSomething */BYTE pad; /* not used */CARD16 length B16; /* 2 (= total # of bytes in request, divided by 4) */CARD32 id B32; /* the Window, Drawable, Font, GContext, etc. */}xResourceReq;If convenient, you can do something similar in your extension header file.In both of these structures, the reqType field identifies the type of the request (for example,X_MapWindow orX_CreatePixmap). The length field tells how long the request is in units of4-byte longwords. This length includes both the request structure itself and any variable-lengthdata, such as strings or lists, that follow the request structure. Request structures come in differentsizes, but all requests are padded to be multiples of four bytes long.Afew protocol requests take noarguments at all. Instead, they use the xReq structure in, which contains only a reqType and a length (and a pad byte).If the protocol request requires a reply, then also contains a reply structure typedef:typedef struct _DoSomethingReply {BYTE type; /* always X_Reply */BYTE someDatum; /* used differently in different requests */CARD16 sequenceNumber B16; /* # of requests sent so far */CARD32 length B32; /* # of additional bytes, divided by 4 */.../* request-specific data */...}xDoSomethingReply;Most of these reply structures are 32 bytes long. If there are not that many reply values, then theycontain a sufficient number of pad fields to bring them up to 32 bytes. The length field is the totalnumber of bytes in the request minus 32, divided by 4. This length will be nonzero only if:454

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!