summaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2018-09-27Release libxcb 1.13.11.13.1Uli Schlachter
2018-08-21don't flag extra reply in xcb_take_socketErik Kurzinger
If any flags are specified in a call to xcb_take_socket, they should only be applied to replies for requests sent after that function returns (and until the socket is re-acquired by XCB). Previously, they would also be incorrectly applied to the reply for the last request sent before the socket was taken. For instance, in this example program the reply for the GetInputFocus request gets discarded, even though it was sent before the socket was taken. This results in the call to retrieve the reply hanging indefinitely. static void return_socket(void *closure) {} int main(void) { Display *dpy = XOpenDisplay(NULL); xcb_connection_t *c = XGetXCBConnection(dpy); xcb_get_input_focus_cookie_t cookie = xcb_get_input_focus_unchecked(c); xcb_flush(c); uint64_t seq; xcb_take_socket(c, return_socket, dpy, XCB_REQUEST_DISCARD_REPLY, &seq); xcb_generic_error_t *err; xcb_get_input_focus_reply(c, cookie, &err); } In practice, this has been causing intermittent KWin crashes when used in combination with the proprietary NVIDIA driver such as https://bugs.kde.org/show_bug.cgi?id=386370 since when Xlib fails to retrieve one of these incorrectly discarded replies it triggers an IO error. Signed-off-by: Erik Kurzinger <ekurzinger@nvidia.com> Signed-off-by: Uli Schlachter <psychon@znc.in>
2018-02-28Release libxcb 1.13libxcb-1.13Daniel Stone
Signed-off-by: Daniel Stone <daniels@collabora.com>
2017-06-05c_client: Add support for lists of FDsDaniel Stone
Matching xcbgen changes, add support having a ListType which contains file descriptors. Use this to send a variable number of FDs to the server, including when the list size is not fixed. Signed-off-by: Daniel Stone <daniels@collabora.com>
2017-06-05c_client: Don't serialise non-wire fieldsDaniel Stone
For when we have a variable-sized field followed by a fixed field, make sure we do not serialise non-wire fields. Signed-off-by: Daniel Stone <daniels@collabora.com>
2017-05-13enable xinput by defaultChristian Linhart
Support for the xinput extension is complete now, as far as I can tell. According to our discussion on the list, we enable it now. Signed-off-by: Christian Linhart <chris@demorecorder.com>
2017-05-13read from connection when polling special events and repliesDavid McFarland
Using the mesa vulkan driver, if you acquire an image from a swapchain using a finite timeout (x11_acquire_next_image_poll_x11), it will occasionally lock, calling xcb_poll_for_special_event in a loop until the timeout expires. Call _xcb_in_read() once from the polling functions for special events and replies, in the same way as xcb_poll_for_event. Signed-off-by: David McFarland <corngood@gmail.com> Signed-off-by: Uli Schlachter <psychon@znc.in>
2017-04-01Check strdup for NULL return value.Tobias Stoeckmann
_xcb_open does not check strdup's return value for NULL if launchd suport was configured. Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org> Signed-off-by: Uli Schlachter <psychon@znc.in>
2017-03-11add support for eventstructChristian Linhart
eventstruct allows to use events as part of requests. This is, e.g., needed by xcb_input_send_extension_event. Signed-off-by: Christian Linhart <chris@demorecorder.com>
2017-03-11optionally build the GE extensionChristian Linhart
xcb contains an xml-definition for the GenericEvent extension but this extension was neither generated nor built. This patch enables optional building of the GenericEvent extension with configure option --enable-ge By default, the GenericEvent extension is not built. Normally this is not needed by application programs because there is implicit support for the GE-extension for the specific events built with this extension. But it may be useful for X-protocol analyzers and stuff like that. Signed-off-by: Christian Linhart <chris@demorecorder.com>
2017-03-11move symbol lookup of sumof expr to the parserChristian Linhart
replace the complicated symboltable lookup for sumof expr by accessing the lenfield of the expr-object. This requires the corresponding patch for xcb/proto which sets the lenfield accordingly. This should be OK because for official releases we define that dependency in the build system. For getting versions off the HEAD of the git repo, it should be obvious that xcb/proto and xcb/libxcb have to be updated together. I have tested this patch and it generates exactly the same code as before. Tested-by: Christian Linhart <chris@demorecorder.com> Signed-off-by: Christian Linhart <chris@demorecorder.com>
2016-05-29Correct @param "e" to "error" in xcb_poll_for_reply*()Alan Coopersmith
Found by clang -Wdocumentation: ./xcbext.h:271:11: warning: parameter 'e' not found in the function declaration [-Wdocumentation] * @param e Location to store errors in, or NULL. Ignored for un... ^ ./xcbext.h:271:11: note: did you mean 'error'? * @param e Location to store errors in, or NULL. Ignored for un... ^ error ./xcbext.h:283:11: warning: parameter 'e' not found in the function declaration [-Wdocumentation] * @param e Location to store errors in, or NULL. Ignored for un... ^ ./xcbext.h:283:11: note: did you mean 'error'? * @param e Location to store errors in, or NULL. Ignored for un... ^ error Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com> Signed-off-by: Uli Schlachter <psychon@znc.in>
2016-05-29Remove : from @param names in manually written headersAlan Coopersmith
Makes style match the @param names in autogenerated headers and makes clang -Wdocumentation stop complaining about all of them: ./xcb.h:523:11: warning: parameter 'display:' not found in the function declaration [-Wdocumentation] * @param display: A pointer to the display number. ^~~~~~~~ ./xcb.h:523:11: note: did you mean 'display'? * @param display: A pointer to the display number. ^~~~~~~~ display Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com> Signed-off-by: Uli Schlachter <psychon@znc.in>
2016-05-28Fix inconsistent use of tabs vs. space.Thomas Klausner
Needed for at least python-3.5.x. Signed-off-by: Thomas Klausner <wiz@NetBSD.org> Signed-off-by: Uli Schlachter <psychon@znc.in>
2016-05-18Release libxcb 1.121.12Uli Schlachter
Signed-off-by: Uli Schlachter <psychon@znc.in>
2016-05-14Bump xcb-proto requirement to 1.12Uli Schlachter
This is needed due to various changes that were done to the XML schema. Signed-off-by: Uli Schlachter <psychon@znc.in>
2016-02-01Increase unix socket send buffer to at least 64KBMark Kettenis
Some systems (e.g. OpenBSD) have a rather small default socket send buffer size of 4KB. The result is that sending requests with a largish payload requires serveral writev(2) system calls. Make sure the socket send buffer is at least 64KB such that we're likely to succeed with a single system call for most requests. A similar change was made to the xtrans code some time ago. Signed-off-by: Mark Kettenis <kettenis@openbsd.org> Reviewed-by: Matthieu Herrb <matthieu@herrb.eu>
2016-02-01do not serialize pads by default anymoreChristian Linhart
Pads should not be serialized/deserialized to maintain ABI compatibility when adding explicit align pads. Therefore this pad switches off serialization of pads unless it is enforced by serialize=true in the xml-definition of that pad Signed-off-by: Christian Linhart <chris@demorecorder.com>
2016-01-06calculate lengthless listJaya Tiwari
Some rework done by Christian Linhart Signed-off-by: Jaya Tiwari <tiwari.jaya18@gmail.com> Signed-off-by: Christian Linhart <chris@demorecorder.com>
2016-01-06Fix handling of align-pads in end-iteratorsChristian Linhart
If a list is preceded by an align-pad, then accessor for the end-iterator returned a wrong value. Reason: the length of the align-iterator was added to a pointer of list-member type. Therefore, the length was multiplied by the size of the list-member type, due to C pointer arithmetic rules. This has looked like the following, e.g., in xcb_randr_get_crtc_transform_pending_params_end: i.data = ((xcb_render_fixed_t *) prev.data) + ((-prev.index) & (4 - 1)) + (R->pending_nparams); This bug was introduced with the following commit: http://cgit.freedesktop.org/xcb/libxcb/commit/?id=4033d39d4da21842bb1396a419dfc299591c3b1f The fix handles this by casting to char* before adding the align, and then casting the result to the member type. Signed-off-by: Christian Linhart <chris@demorecorder.com>
2016-01-06set the align-offset as provided by protoChristian Linhart
instead of using the lower bits of the pointer address. This fixes a bug reported by Peter Hutterer in off-list communication back in June 2015. This requires the alignment-checker patches in xcb/proto. Signed-off-by: Christian Linhart <chris@demorecorder.com>
2015-09-21Bump version to 1.11.90Adam Jackson
We've released 1.11.1 and new libX11 wants that or better. git master will suffice, so bump the version number ahead of 1.11 branch. Signed-off-by: Adam Jackson <ajax@redhat.com>
2015-08-13make lists after align-pads workChristian Linhart
Handle align-pads when generating an end-function in the same way as handling them when generating an accessor or iterator function. Signed-off-by: Christian Linhart <chris@demorecorder.com>
2015-07-04make support for server side stuff optionalChristian Linhart
and make it disabled by default with an EXPERIMENTAL warning reason: this feature is unfinished and we want to have flexibility for ABI/API changes, while still being able to make a release soon Signed-off-by: Christian Linhart <chris@demorecorder.com>
2015-07-04Link with winsock library for socket functions on MinGWJon TURNEY
Signed-off-by: Jon TURNEY <jon.turney@dronecode.org.uk>
2015-06-25Fix a thread hang with xcb_wait_for_special_event()Uli Schlachter
Consider the following: - Two threads are calling xcb_wait_for_special_event() and xcb_wait_for_reply() concurrently. - The thread doing xcb_wait_for_reply() wins the race and poll()s the socket for readability. - The other thread will be put to sleep on the special_event_cond of the special event (this is done in _xcb_conn_wait() via the argument xcb_wait_for_special_event() gives it). - The first thread gets its reply, but does not yet receive any special event. In this case, the first thread will return to its caller. On its way out, it will call _xcb_in_wake_up_next_reader(), but that function cannot wake up anything since so far it did not handle xcb_wait_for_special_event(). Thus, the first thread stays blocked on the condition variable and no thread tries to read from the socket. A test case demonstrating this problem is available at the bug report. Fix this similar to how we handle this with xcb_wait_for_reply(): The function wait_for_reply() adds an entry into a linked list of threads that wait for a reply. Via this list, _xcb_in_wake_up_next_reader() can wake up this thread so that it can call _xcb_conn_wait() again and then poll()s the socket. Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=84252 Signed-off-by: Uli Schlachter <psychon@znc.in> Tested-by: Michel Dänzer <michel.daenzer@amd.com>
2015-06-12Call _xcb_wake_up_next_reader from xcb_wait_for_special_eventMichel Dänzer
All functions calling _xcb_conn_wait() must make sure that waiting readers are woken up when we read a reply or event that they are waiting for. xcb_wait_for_special_event() did not do so. This adds the missing call to_xcb_in_wake_up_next_reader(). Fixes deadlock when waiting for a special event and concurrently processing the display connection queue in another thread. Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=84252 Tested-by: Thomas Daede <bztdlinux@gmail.com> Tested-by: Clément Guérin <geecko.dev@free.fr> Reviewed-by: Uli Schlachter <psychon@znc.in> Signed-off-by: Michel Dänzer <michel@daenzer.net> Signed-off-by: Uli Schlachter <psychon@znc.in>
2015-06-12send_fds(): Handle too many outstanding FDs to sendUli Schlachter
Before this patch, the following code caused an endless loop in send_fds(), because the queue of FDs to send was eventually full, but _xcb_out_flush_to() didn't make any progress, since there was no request to send: while (1) { xcb_send_fd(conn, dup(some_fd)); } Fix this by sending a sync when flushing didn't make any progress. That way we actually have something to send and can attach the pending FDs. Because send_fds() can now send requests, the code in xcb_send_request_with_fds64() has to be changed. It has to call send_fds() before it establishes a good sequence number for the request it wants to send. Signed-off-by: Uli Schlachter <psychon@znc.in>
2015-06-12Code generator: Use xcb_send_request_with_fds()Uli Schlachter
Signed-off-by: Uli Schlachter <psychon@znc.in>
2015-06-12Add xcb_send_request_with_fds() and *_with_fds64()Uli Schlachter
Doing xcb_send_fd(), xcb_send_request() is racy. If two threads do this at the same time, they could mix up their file descriptors. This commit makes it possibly to fix this race by providing a single function which does everything that is needed. Signed-off-by: Uli Schlachter <psychon@znc.in>
2015-06-12send_fds(): Make sure no other thread interrupts usUli Schlachter
Two threads trying to send fds at the same time could interfere. To guarantee a correct ordering, we have to use correct locking. The code in send_fds() missed one case: If there was another thread already writing requests, we slept on the "done with writing" condition variable (c->out.cond). This would allow other threads to re-acquire the iolock before us and could cause fds to be sent out of order. To fix this, at the beginning of send_fds() we now make sure that no other thread is already writing requests. This is what prepare_socket_request() does. Additionally, it gets the socket back in case xcb_take_socket() was called, which is a good thing, too, since fds are only sent with corresponding requests.
2015-06-12xcb_send_fd(): Always close fdsUli Schlachter
The API docs for xcb_send_fd() says "After this function returns, the file descriptor given is owned by xcb and will be closed eventually". Let the implementation live up to its documentation. We now also close fds if fd passing is unavailable (!HAVE_SENDMSG) and when the connection is in an error state. (This also does sneak in some preparatory functions for follow-up commits and thus does things in a more complicated way than really necessary.) Signed-off-by: Uli Schlachter <psychon@znc.in>
2015-05-30c_client.py: don't generate useless empty /** < */ commentsRan Benita
(This does not change doxygen's output or warnings). Signed-off-by: Ran Benita <ran234@gmail.com> Reviewed-by: Christian Linhart <chris@demorecorder.com>
2015-05-30c_client.py: use pattern matching with enumerate()Ran Benita
Signed-off-by: Ran Benita <ran234@gmail.com>
2015-04-08expose 64-bit sequence numbers for XLibChristian Linhart
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>
2015-04-29Escape \n to display properly in xcb-requests man pageAlan Coopersmith
In nroff, \n is a macro that "Interpolates number register x" (where x is the character following the \n sequence), thus the man page currently prints 0 instead of \n" in several lines, leading to output such as: printf("The _NET_WM_NAME atom has ID %u0, reply-⁠>atom); It needs to be escaped here, as \\n, as is done in other examples in this man page already. https://bugs.freedesktop.org/show_bug.cgi?id=90231 Reported-by: Stefan Merettig Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
2015-03-15c_client.py: make condition easier to follow in _c_complex()Ran Benita
Signed-off-by: Ran Benita <ran234@gmail.com> Reviewed-by: Christian Linhart <chris@demorecorder.com>
2015-03-15c_client.py: don't add /* <name> */ before references to 'S'Ran Benita
The name can be understood from the type of S already. For examples, look for 'S->' in xkb.c or xinput.c. Signed-off-by: Ran Benita <ran234@gmail.com> Reviewed-by: Christian Linhart <chris@demorecorder.com> Reviewed-by: Rémi Cardona <remi@gentoo.org>
2015-03-15c_client.py: remove duplicated `cookie_type` argument for requestsRan Benita
It is implied already inside the function by the `void` argument. Signed-off-by: Ran Benita <ran234@gmail.com> Reviewed-by: Christian Linhart <chris@demorecorder.com>
2015-03-15c_client.py: spell out keyword arguments in c_request() for clarityRan Benita
Signed-off-by: Ran Benita <ran234@gmail.com> Reviewed-by: Christian Linhart <chris@demorecorder.com>
2015-03-15c_client.py: simplify _c_reply_has_fds()Ran Benita
Signed-off-by: Ran Benita <ran234@gmail.com> Reviewed-by: Christian Linhart <chris@demorecorder.com>
2015-03-15c_client.py: remove commented debug statementsRan Benita
Signed-off-by: Ran Benita <ran234@gmail.com> Reviewed-by: Christian Linhart <chris@demorecorder.com>
2015-03-15c_client.py: use C99 initializers instead of commentsRan Benita
Signed-off-by: Ran Benita <ran234@gmail.com> Reviewed-by: Christian Linhart <chris@demorecorder.com>
2015-03-15c_client.py: remove end-of-function commentsRan Benita
Signed-off-by: Ran Benita <ran234@gmail.com> Reviewed-by: Christian Linhart <chris@demorecorder.com>
2015-03-15c_client.py: no need to compare bools to True/FalseRan Benita
Signed-off-by: Ran Benita <ran234@gmail.com> Reviewed-by: Christian Linhart <chris@demorecorder.com>
2015-03-15c_client.py: use "foo".join() instead of reduceRan Benita
Signed-off-by: Ran Benita <ran234@gmail.com> Reviewed-by: Christian Linhart <chris@demorecorder.com>
2015-03-15c_client.py: fix indentationRan Benita
(Also remove unnecessary parens around the condition). Signed-off-by: Ran Benita <ran234@gmail.com> Reviewed-by: Christian Linhart <chris@demorecorder.com>
2015-03-15c_client.py: use comprehensions instead of map/filterRan Benita
Signed-off-by: Ran Benita <ran234@gmail.com> Reviewed-by: Christian Linhart <chris@demorecorder.com>
2015-03-15c_client.py: use print as a function for python3 compatibilityRan Benita
This works for all python>=2.6, which is what configure requires. Signed-off-by: Ran Benita <ran234@gmail.com> Reviewed-by: Christian Linhart <chris@demorecorder.com>
2015-03-15c_client.py: fix pyflakes errorsRan Benita
c_client.py:2: 'from xml.etree.cElementTree import *' used; unable to detect undefined names c_client.py:3: 'basename' imported but unused c_client.py:9: 'time' imported but unused c_client.py:1437: local variable 'list_obj' is assigned to but never used c_client.py:1745: local variable 'varfield' is assigned to but never used c_client.py:2050: local variable 'length' is assigned to but never used c_client.py:2416: local variable 'R_obj' is assigned to but never used c_client.py:2441: local variable 'S_obj' is assigned to but never used Signed-off-by: Ran Benita <ran234@gmail.com> Reviewed-by: Christian Linhart <chris@demorecorder.com>