From 82ed0423a13d7fe8d3a8bd26f9f7df7093ee63f1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kristian=20H=C3=B8gsberg?= Date: Mon, 25 Apr 2011 15:41:59 -0400 Subject: [PATCH] compositor-x11: Only use xcb_poll_for_queued_event if we have it Otherwise we can just fall back to xcb_poll_for_event, and just do a harmless read on the socket. --- compositor/compositor-x11.c | 4 ++++ configure.ac | 9 +++++++++ 2 files changed, 13 insertions(+) diff --git a/compositor/compositor-x11.c b/compositor/compositor-x11.c index 2f02ec37..1996737a 100644 --- a/compositor/compositor-x11.c +++ b/compositor/compositor-x11.c @@ -383,7 +383,11 @@ x11_compositor_next_event(struct x11_compositor *c, if (mask & WL_EVENT_READABLE) { *event = xcb_poll_for_event(c->conn); } else { +#ifdef HAVE_XCB_POLL_FOR_QUEUED_EVENT *event = xcb_poll_for_queued_event(c->conn); +#else + *event = xcb_poll_for_event(c->conn); +#endif } return *event != NULL; diff --git a/configure.ac b/configure.ac index 8873bd04..8c5a8af9 100644 --- a/configure.ac +++ b/configure.ac @@ -21,6 +21,15 @@ LT_INIT PKG_PROG_PKG_CONFIG() +PKG_CHECK_MODULES([XCB], xcb) +xcb_save_LIBS=$LIBS +xcb_save_CFLAGS=$CFLAGS +CFLAGS=$XCB_CFLAGS +LIBS=$XCB_LIBS +AC_CHECK_FUNCS([xcb_poll_for_queued_event]) +LIBS=$xcb_save_LIBS +CFLAGS=$xcb_save_CFLAGS + AC_CHECK_FUNC([dlopen], [], AC_CHECK_LIB([dl], [dlopen], DLOPEN_LIBS="-ldl")) AC_SUBST(DLOPEN_LIBS)