Provide a "has error" property for XCBConnection.
This commit is contained in:
parent
df7fb77d6e
commit
ac17ae62fe
15
src/xcb.h
15
src/xcb.h
|
@ -333,6 +333,21 @@ const XCBSetup *XCBGetSetup(XCBConnection *c);
|
||||||
*/
|
*/
|
||||||
int XCBGetFileDescriptor(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.
|
* @brief Connects to the X server.
|
||||||
* @param fd: The file descriptor.
|
* @param fd: The file descriptor.
|
||||||
|
|
|
@ -187,6 +187,12 @@ int XCBGetFileDescriptor(XCBConnection *c)
|
||||||
return c->fd;
|
return c->fd;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int XCBConnectionHasError(XCBConnection *c)
|
||||||
|
{
|
||||||
|
/* doesn't need locking because it's read and written atomically. */
|
||||||
|
return c->has_error;
|
||||||
|
}
|
||||||
|
|
||||||
XCBConnection *XCBConnectToFD(int fd, XCBAuthInfo *auth_info)
|
XCBConnection *XCBConnectToFD(int fd, XCBAuthInfo *auth_info)
|
||||||
{
|
{
|
||||||
XCBConnection* c;
|
XCBConnection* c;
|
||||||
|
|
|
@ -142,6 +142,8 @@ void _xcb_ext_destroy(XCBConnection *c);
|
||||||
/* xcb_conn.c */
|
/* xcb_conn.c */
|
||||||
|
|
||||||
struct XCBConnection {
|
struct XCBConnection {
|
||||||
|
int has_error;
|
||||||
|
|
||||||
/* constant data */
|
/* constant data */
|
||||||
XCBSetup *setup;
|
XCBSetup *setup;
|
||||||
int fd;
|
int fd;
|
||||||
|
|
Loading…
Reference in New Issue