projects
/
free-sw
/
xcb
/
libxcb
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Provide a "has error" property for XCBConnection.
[free-sw/xcb/libxcb]
/
src
/
xcb_in.c
diff --git
a/src/xcb_in.c
b/src/xcb_in.c
index
d4dbb3f
..
eab8b1d
100644
(file)
--- a/
src/xcb_in.c
+++ b/
src/xcb_in.c
@@
-380,21
+380,27
@@
XCBGenericEvent *XCBWaitForEvent(XCBConnection *c)
XCBGenericEvent *XCBPollForEvent(XCBConnection *c, int *error)
{
XCBGenericEvent *ret = 0;
XCBGenericEvent *XCBPollForEvent(XCBConnection *c, int *error)
{
XCBGenericEvent *ret = 0;
+ int success;
pthread_mutex_lock(&c->iolock);
pthread_mutex_lock(&c->iolock);
- if(error)
- *error = 0;
/* FIXME: follow X meets Z architecture changes. */
/* FIXME: follow X meets Z architecture changes. */
- if(_xcb_in_read(c))
+ success = _xcb_in_read(c);
+ if(success)
ret = get_event(c);
ret = get_event(c);
- else if(error)
+ pthread_mutex_unlock(&c->iolock);
+ if(success)
+ {
+ if(error)
+ *error = 0;
+ return ret;
+ }
+ if(error)
*error = -1;
else
{
fprintf(stderr, "XCBPollForEvent: I/O error occured, but no handler provided.\n");
abort();
}
*error = -1;
else
{
fprintf(stderr, "XCBPollForEvent: I/O error occured, but no handler provided.\n");
abort();
}
- pthread_mutex_unlock(&c->iolock);
- return ret;
+ return 0;
}
XCBGenericError *XCBRequestCheck(XCBConnection *c, XCBVoidCookie cookie)
}
XCBGenericError *XCBRequestCheck(XCBConnection *c, XCBVoidCookie cookie)