void *ret = 0;
if(e)
*e = 0;
+ if(c->has_error)
+ return 0;
pthread_mutex_lock(&c->iolock);
int XCBPollForReply(XCBConnection *c, unsigned int request, void **reply, XCBGenericError **error)
{
int ret;
+ if(c->has_error)
+ {
+ *reply = 0;
+ if(error)
+ *error = 0;
+ return 1; /* would not block */
+ }
assert(reply != 0);
pthread_mutex_lock(&c->iolock);
ret = poll_for_reply(c, request, reply, error);
XCBGenericEvent *XCBWaitForEvent(XCBConnection *c)
{
XCBGenericEvent *ret;
+ if(c->has_error)
+ return 0;
pthread_mutex_lock(&c->iolock);
/* get_event returns 0 on empty list. */
while(!(ret = get_event(c)))
XCBGenericEvent *XCBPollForEvent(XCBConnection *c, int *error)
{
- XCBGenericEvent *ret = 0;
- int success;
- pthread_mutex_lock(&c->iolock);
- /* FIXME: follow X meets Z architecture changes. */
- success = _xcb_in_read(c);
- if(success)
- ret = get_event(c);
- pthread_mutex_unlock(&c->iolock);
- if(success)
+ if(!c->has_error)
{
- if(error)
- *error = 0;
- return ret;
+ XCBGenericEvent *ret = 0;
+ int success;
+ pthread_mutex_lock(&c->iolock);
+ /* FIXME: follow X meets Z architecture changes. */
+ success = _xcb_in_read(c);
+ if(success)
+ ret = get_event(c);
+ pthread_mutex_unlock(&c->iolock);
+ if(success)
+ {
+ if(error)
+ *error = 0;
+ return ret;
+ }
}
if(error)
*error = -1;
* XCBGetInputFocusReply, and XCBWaitForReply. */
XCBGenericError *ret;
void *reply;
+ if(c->has_error)
+ return 0;
if(XCB_SEQUENCE_COMPARE(cookie.sequence,>,c->in.request_expected)
&& XCB_SEQUENCE_COMPARE(cookie.sequence,>,c->in.request_completed))
{