summaryrefslogtreecommitdiff
path: root/src/xcbext.h
diff options
context:
space:
mode:
authorChristian Linhart <chris@demorecorder.com>2015-04-29 09:11:37 +0200
committerChristian Linhart <chris@demorecorder.com>2015-04-08 11:55:48 +0200
commitcb621341a62e6d2233db3e337611f6fdd4f675a6 (patch)
treef50f034344e974fa95fe72274290abb8a5b3bbfd /src/xcbext.h
parentc49aa985941112be05599032b9bb45b2652301ce (diff)
expose 64-bit sequence numbers for XLib
While XCB uses 64-bit sequence number internally, it only exposes "unsigned int" so that, on 32-bit architecture, Xlib based applications may see their sequence number wrap which causes the connection to the X server to be lost. Expose 64-bit sequence number from XCB API so that Xlib and others can use it even on 32-bit environment. This implies the following API addition: xcb_send_request64() xcb_discard_reply64() xcb_wait_for_reply64() xcb_poll_for_reply64() Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=71338 Reviewed-by: Uli Schlachter <psychon@znc.in> Signed-off-by: Christian Linhart <chris@demorecorder.com> Signed-off-by: Olivier Fourdan <ofourdan@redhat.com>
Diffstat (limited to 'src/xcbext.h')
-rw-r--r--src/xcbext.h54
1 files changed, 54 insertions, 0 deletions
diff --git a/src/xcbext.h b/src/xcbext.h
index 7587513..b2575f7 100644
--- a/src/xcbext.h
+++ b/src/xcbext.h
@@ -83,6 +83,30 @@ enum xcb_send_request_flags_t {
unsigned int xcb_send_request(xcb_connection_t *c, int flags, struct iovec *vector, const xcb_protocol_request_t *request);
/**
+ * @brief Send a request to the server, with 64-bit sequence number returned.
+ * @param c: The connection to the X server.
+ * @param flags: A combination of flags from the xcb_send_request_flags_t enumeration.
+ * @param vector: Data to send; must have two iovecs before start for internal use.
+ * @param request: Information about the request to be sent.
+ * @return The request's sequence number on success, 0 otherwise.
+ *
+ * This function sends a new request to the X server. The data of the request is
+ * given as an array of @c iovecs in the @p vector argument. The length of that
+ * array and the neccessary management information are given in the @p request
+ * argument.
+ *
+ * When this function returns, the request might or might not be sent already.
+ * Use xcb_flush() to make sure that it really was sent.
+ *
+ * Please note that this function is not the prefered way for sending requests.
+ * It's better to use the generated wrapper functions.
+ *
+ * Please note that xcb might use index -1 and -2 of the @p vector array internally,
+ * so they must be valid!
+ */
+uint64_t xcb_send_request64(xcb_connection_t *c, int flags, struct iovec *vector, const xcb_protocol_request_t *request);
+
+/**
* @brief Send a file descriptor to the server in the next call to xcb_send_request.
* @param c: The connection to the X server.
* @param fd: The file descriptor to send.
@@ -162,6 +186,21 @@ int xcb_writev(xcb_connection_t *c, struct iovec *vector, int count, uint64_t re
void *xcb_wait_for_reply(xcb_connection_t *c, unsigned int request, xcb_generic_error_t **e);
/**
+ * @brief Wait for the reply of a given request, with 64-bit sequence number
+ * @param c: The connection to the X server.
+ * @param request: 64-bit sequence number of the request as returned by xcb_send_request64().
+ * @param e: Location to store errors in, or NULL. Ignored for unchecked requests.
+ *
+ * Returns the reply to the given request or returns null in the event of
+ * errors. Blocks until the reply or error for the request arrives, or an I/O
+ * error occurs.
+ *
+ * Unlike its xcb_wait_for_reply() counterpart, the given sequence number is not
+ * automatically "widened" to 64-bit.
+ */
+void *xcb_wait_for_reply64(xcb_connection_t *c, uint64_t request, xcb_generic_error_t **e);
+
+/**
* @brief Poll for the reply of a given request.
* @param c: The connection to the X server.
* @param request: Sequence number of the request as returned by xcb_send_request().
@@ -174,6 +213,21 @@ void *xcb_wait_for_reply(xcb_connection_t *c, unsigned int request, xcb_generic_
int xcb_poll_for_reply(xcb_connection_t *c, unsigned int request, void **reply, xcb_generic_error_t **error);
/**
+ * @brief Poll for the reply of a given request, with 64-bit sequence number.
+ * @param c: The connection to the X server.
+ * @param request: 64-bit sequence number of the request as returned by xcb_send_request().
+ * @param reply: Location to store the reply in, must not be NULL.
+ * @param e: Location to store errors in, or NULL. Ignored for unchecked requests.
+ * @return 1 when the reply to the request was returned, else 0.
+ *
+ * Checks if the reply to the given request already received. Does not block.
+ *
+ * Unlike its xcb_poll_for_reply() counterpart, the given sequence number is not
+ * automatically "widened" to 64-bit.
+ */
+int xcb_poll_for_reply64(xcb_connection_t *c, uint64_t request, void **reply, xcb_generic_error_t **error);
+
+/**
* @brief Don't use this, only needed by the generated code.
* @param c: The connection to the X server.
* @param reply: A reply that was received from the server