Skip to content
Snippets Groups Projects
Commit 56d3ea12 authored by Derek Foreman's avatar Derek Foreman
Browse files

xcb-client-helper: Call xcb_wait_for_event directly


We're currently calling ppoll() before calling xcb_wait_for_event(), which
may be due to initially trying to make this non-blocking.

However, xcb_wait_for_event() reads all events available - even if there
are more than one.

There are a handful of X properties we're sent that we don't explicitly
ask for, and if these end up in the same read, we could theoretically
end up in a poll() with nothing coming in.

Drop the extra ppoll() and just let xcb_wait_for_event() do the blocking
for us.

I'm hoping this fixes the occasional timeout in the xwayland test, but
it's a reasonable code simplification even if it doesn't.

Signed-off-by: default avatarDerek Foreman <derek.foreman@collabora.com>
parent 2d3cca3d
No related branches found
No related tags found
1 merge request!1496xcb-client-helper: Call xcb_wait_for_event directly
......@@ -380,23 +380,6 @@ window_x11_unmap(struct window_x11 *window)
xcb_flush(window->conn->connection);
}
static xcb_generic_event_t *
poll_for_event(xcb_connection_t *conn)
{
int fd = xcb_get_file_descriptor(conn);
struct pollfd pollfds = {};
int rpol;
pollfds.fd = fd;
pollfds.events = POLLIN;
rpol = ppoll(&pollfds, 1, NULL, NULL);
if (rpol > 0 && (pollfds.revents & POLLIN))
return xcb_wait_for_event(conn);
return NULL;
}
static void
window_x11_set_cursor(struct window_x11 *window, const char *cursor_name)
{
......@@ -478,7 +461,7 @@ handle_events_x11(struct window_x11 *window)
break;
}
ev = poll_for_event(window->conn->connection);
ev = xcb_wait_for_event(window->conn->connection);
if (!ev) {
fprintf(stderr, "Error, no event received, "
"although we requested for one!\n");
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment