X-Git-Url: http://git.demorecorder.com/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Fxcb.h;h=3d193e1823ccd929810b61c0da9ae4b9a6ba7a90;hb=ac17ae62fe1a3a29991e36e35eeee838ac4acb00;hp=9920c85336caa5fa46b25609a5b6a1ac2584c9da;hpb=4142e34695310c20a8a30af64e0b40842bfb5dbe;p=free-sw%2Fxcb%2Flibxcb diff --git a/src/xcb.h b/src/xcb.h index 9920c85..3d193e1 100644 --- a/src/xcb.h +++ b/src/xcb.h @@ -25,13 +25,18 @@ * authorization from the authors. */ -#ifndef __XCB_H -#define __XCB_H +#ifndef __XCB_H__ +#define __XCB_H__ #include -/* TODO: check for stdint in config? (HAVE_STDINT) fallback? */ +#if defined(__solaris__) +#include +#else #include +#endif +/* FIXME: these names conflict with those defined in Xmd.h. */ +#ifndef XMD_H typedef uint8_t BYTE; typedef uint8_t BOOL; typedef uint8_t CARD8; @@ -40,22 +45,16 @@ typedef uint32_t CARD32; typedef int8_t INT8; typedef int16_t INT16; typedef int32_t INT32; +#endif /* XMD_H */ -#include #include #include + #ifdef __cplusplus extern "C" { #endif -#if (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 1)) -#define deprecated __attribute__((__deprecated__)) -#else -#define deprecated -#endif - - /** * @file xcb.h */ @@ -80,11 +79,6 @@ extern "C" { #define XCB_TYPE_PAD(T,I) (-(I) & (sizeof(T) > 4 ? 3 : sizeof(T) - 1)) - -/** XCBNone is the universal null resource or null atom parameter value for many core X requests */ -#define XCBNone 0L - - /* Opaque structures */ /** @@ -156,11 +150,23 @@ typedef struct { } XCBVoidCookie; -/* Include the generated xproto and xcb_types headers. */ -#include "xcb_types.h" +/* Include the generated xproto header. */ #include "xproto.h" +/** XCBNone is the universal null resource or null atom parameter value for many core X requests */ +#define XCBNone 0L + +/** XCBCopyFromParent can be used for many CreateWindow parameters */ +#define XCBCopyFromParent 0L + +/** XCBCurrentTime can be used in most requests that take an XCBTIMESTAMP */ +#define XCBCurrentTime 0L + +/** XCBNoSymbol fills in unused entries in XCBKEYSYM tables */ +#define XCBNoSymbol 0L + + /* xcb_auth.c */ /** @@ -175,17 +181,6 @@ typedef struct XCBAuthInfo { char *data; /**< Data interpreted in a protocol-specific manner. */ } XCBAuthInfo; -/** - * @brief Gets authorization information. - * @param fd: The file descriptor. - * @param info: The authorisation info to set. - * @return @c 0 on failure, 1 otherwise. - * - * @deprecated This function is deprecated. It must not be used in - * newly written code. - */ -int XCBGetAuthInfo(int fd, XCBAuthInfo *info) deprecated; - /* xcb_out.c */ @@ -220,16 +215,6 @@ CARD32 XCBGetMaximumRequestLength(XCBConnection *c); /* xcb_in.c */ -/** - * @brief Returns the next event or error from the server. - * @param c: The connection to the X server. - * @return The next event from the server. - * - * @deprecated This function is deprecated. It must not be used in - * newly written code. - */ -XCBGenericEvent *XCBWaitEvent(XCBConnection *c) deprecated; - /** * @brief Returns the next event or error from the server. * @param c: The connection to the X server. @@ -259,18 +244,22 @@ XCBGenericEvent *XCBWaitForEvent(XCBConnection *c); XCBGenericEvent *XCBPollForEvent(XCBConnection *c, int *error); /** - * @brief Returns the last sequence number that the server is known to - * have processed. + * @brief Return the error for a request, or NULL if none can ever arrive. * @param c: The connection to the X server. - * @return The last sequence number. + * @param cookie: The request cookie. + * @return The error for the request, or NULL if none can ever arrive. * - * Returns the last sequence number that the server is known to have - * processed. This function enables applications to determine whether - * forcing a cookie is going to block. + * The XCBVoidCookie cookie supplied to this function must have resulted from + * a call to XCB[RequestName]Checked(). This function will block until one of + * two conditions happens. If an error is received, it will be returned. If + * a reply to a subsequent request has already arrived, no error can arrive + * for this request, so this function will return NULL. * - * @todo review that function. + * Note that this function will perform a sync if needed to ensure that the + * sequence number will advance beyond that provided in cookie; this is a + * convenience to avoid races in determining whether the sync is needed. */ -unsigned int XCBGetRequestRead(XCBConnection *c); +XCBGenericError *XCBRequestCheck(XCBConnection *c, XCBVoidCookie cookie); /* xcb_ext.c */ @@ -284,7 +273,7 @@ typedef struct XCBExtension XCBExtension; /**< Opaque structure used as key for * @brief Caches reply information from QueryExtension requests. * @param c: The connection. * @param ext: The extension data. - * @return A pointer to a XCBConnSetupSuccessRep pointer. + * @return A pointer to the XCBQueryExtensionRep for the extension. * * This function is the primary interface to the "extension cache", * which caches reply information from QueryExtension @@ -317,7 +306,7 @@ void XCBPrefetchExtensionData(XCBConnection *c, XCBExtension *ext); /** * @brief Access the data returned by the server. * @param c: The connection. - * @return A pointer to a XCBConnSetupSuccessRep pointer. + * @return A pointer to an XCBSetup structure. * * Accessor for the data returned by the server when the XCBConnection * was initialized. This data includes @@ -332,7 +321,7 @@ void XCBPrefetchExtensionData(XCBConnection *c, XCBExtension *ext); * * The result must not be freed. */ -const XCBConnSetupSuccessRep *XCBGetSetup(XCBConnection *c); +const XCBSetup *XCBGetSetup(XCBConnection *c); /** * @brief Access the file descriptor of the connection. @@ -344,6 +333,21 @@ const XCBConnSetupSuccessRep *XCBGetSetup(XCBConnection *c); */ int XCBGetFileDescriptor(XCBConnection *c); +/** + * @brief Test whether the connection has shut down due to a fatal error. + * @param c: The connection. + * @return 1 if the connection is in an error state; 0 otherwise. + * + * Some errors that occur in the context of an XCBConnection + * are unrecoverable. When such an error occurs, the + * connection is shut down and further operations on the + * XCBConnection have no effect. + * + * @todo Other functions should document the conditions in + * which they shut down the connection. + */ +int XCBConnectionHasError(XCBConnection *c); + /** * @brief Connects to the X server. * @param fd: The file descriptor. @@ -390,47 +394,6 @@ void XCBDisconnect(XCBConnection *c); */ int XCBParseDisplay(const char *name, char **host, int *display, int *screen); -/** - * @brief Open a connection to the X server. - * @param host: The host name. - * @param display: The display number. - * @return The file descriptor. - * - * @deprecated This function is deprecated. It must not be used in - * newly written code. - */ -int XCBOpen(const char *host, int display) deprecated; - -/** - * @brief Open a connection to the X server. - * @param host: The host name. - * @param port: The TCP port. - * @return The file descriptor. - * - * @deprecated This function is deprecated. It must not be used in - * newly written code. - */ -int XCBOpenTCP(const char *host, unsigned short port) deprecated; - -/** - * @brief Connects to the X server. - * @param file: The file name. - * @return The file descriptor. - * - * @deprecated This function is deprecated. It must not be used in - * newly written code. - */ -int XCBOpenUnix(const char *file) deprecated; - -/** - * @brief Connects to the X server. - * @return A newly allocated XCBConnection structure. - * - * @deprecated This function is deprecated. It must not be used in - * newly written code. - */ -XCBConnection *XCBConnectBasic(void) deprecated; - /** * @brief Connects to the X server. * @param displayname: The name of the display. @@ -459,26 +422,14 @@ XCBConnection *XCBConnect(const char *displayname, int *screenp); */ XCBConnection *XCBConnectToDisplayWithAuthInfo(const char *display, XCBAuthInfo *auth, int *screen); -/** - * @brief Ensures that all events and errors are avalaible in XCB. - * @param c: The connection to the X server. - * @param e: A pointer to an error. - * @return @c 1 on success, @c 0 otherwise. - * - * Blocks the calling thread for the duration of one round trip to the - * server, ensuring that all events and errors caused by previous - * requests are available to XCB. - */ -int XCBSync(XCBConnection *c, XCBGenericError **e); - /** * @} */ - #ifdef __cplusplus } #endif -#endif + +#endif /* __XCB_H__ */