summaryrefslogtreecommitdiff
path: root/src/xcb.h
diff options
context:
space:
mode:
authorArvind Umrao <arvind.umrao@oracle.com>2011-11-04 15:42:05 +0530
committerJulien Danjou <julien@danjou.info>2012-01-11 18:01:29 +0100
commit769acff0da8b9859ebdf052dce80045465c7598c (patch)
treeda557d02c65a7f3ba8dfd73284c0300f780593a1 /src/xcb.h
parent9b4d6f30a339e2d18ebaea98149da81aba453216 (diff)
Added more error states and removed global error_connection
Fixes: https://bugs.freedesktop.org/show_bug.cgi?id=41443 Fixes: https://bugs.freedesktop.org/show_bug.cgi?id=42304 I have added more xcb connection error states at xcb.h header. Also I have removed global error_connection variable, and added an interface that returns connection error state. TBD: I will segregate errors states in a separate header file and try to provide more precise error states, in future. Also I will give patch for libX11, in that patch xcb_connection_t::has_error will be passed to default io handler of libX11. This value can then be used for displaying error messages. Reviewed-by: Rami Ylimäki <rami.ylimaki@vincit.fi> Reviewed-by: Uli Schlachter <psychon@znc.in> Signed-off-by: Arvind Umrao <arvind.umrao@oracle.com>
Diffstat (limited to 'src/xcb.h')
-rw-r--r--src/xcb.h24
1 files changed, 21 insertions, 3 deletions
diff --git a/src/xcb.h b/src/xcb.h
index 3ee7965..44f650a 100644
--- a/src/xcb.h
+++ b/src/xcb.h
@@ -69,6 +69,21 @@ extern "C" {
/** X_TCP_PORT + display number = server port for TCP transport */
#define X_TCP_PORT 6000
+/** xcb connection errors because of socket, pipe and other stream errors. */
+#define XCB_CONN_ERROR 1
+
+/** xcb connection shutdown because of extension not sppported */
+#define XCB_CONN_CLOSED_EXT_NOTSUPPORTED 2
+
+/** malloc(), calloc() and realloc() error upon failure, for eg ENOMEM */
+#define XCB_CONN_CLOSED_MEM_INSUFFICIENT 3
+
+/** Connection closed, exceeding request length that server accepts. */
+#define XCB_CONN_CLOSED_REQ_LEN_EXCEED 4
+
+/** Connection closed, error during parsing display string. */
+#define XCB_CONN_CLOSED_PARSE_ERR 5
+
#define XCB_TYPE_PAD(T,I) (-(I) & (sizeof(T) > 4 ? 3 : sizeof(T) - 1))
/* Opaque structures */
@@ -396,15 +411,18 @@ int xcb_get_file_descriptor(xcb_connection_t *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.
+ * @return > 0 if the connection is in an error state; 0 otherwise.
*
* Some errors that occur in the context of an xcb_connection_t
* are unrecoverable. When such an error occurs, the
* connection is shut down and further operations on the
* xcb_connection_t have no effect.
*
- * @todo Other functions should document the conditions in
- * which they shut down the connection.
+ * @return XCB_CONN_ERROR, because of socket errors, pipe errors or other stream errors.
+ * @return XCB_CONN_CLOSED_EXT_NOTSUPPORTED, when extension not supported.
+ * @return XCB_CONN_CLOSED_MEM_INSUFFICIENT, when memory not available.
+ * @return XCB_CONN_CLOSED_REQ_LEN_EXCEED, exceeding request length that server accepts.
+ * @return XCB_CONN_CLOSED_PARSE_ERR, error during parsing display string.
*/
int xcb_connection_has_error(xcb_connection_t *c);