summaryrefslogtreecommitdiffstats
path: root/src/plugins/platforms/xcb/qxcbconnection.cpp
diff options
context:
space:
mode:
authorThiago Macieira <thiago.macieira@intel.com>2015-07-15 10:40:29 -0700
committerThiago Macieira <thiago.macieira@intel.com>2015-07-28 21:12:35 +0000
commit3a63bb0ea755bb15c03a82192773c481d5ae8574 (patch)
tree4c444d7ca62f269c535252dcdad1414fb81a52d6 /src/plugins/platforms/xcb/qxcbconnection.cpp
parent0d7af31e83ec2de324546558e5c787e1d489cf5c (diff)
Let the linker find xcb_poll_for_queued_event for us
It's more efficient than we are. This also enables the code to work in the unlikely case of an ELF platform without RTLD_DEFAULT. Change-Id: Ib306f8f647014b399b87ffff13f12f8aeeb2589a Reviewed-by: Gatis Paeglis <gatis.paeglis@digia.com>
Diffstat (limited to 'src/plugins/platforms/xcb/qxcbconnection.cpp')
-rw-r--r--src/plugins/platforms/xcb/qxcbconnection.cpp15
1 files changed, 9 insertions, 6 deletions
diff --git a/src/plugins/platforms/xcb/qxcbconnection.cpp b/src/plugins/platforms/xcb/qxcbconnection.cpp
index 2158300591..d2e08aecee 100644
--- a/src/plugins/platforms/xcb/qxcbconnection.cpp
+++ b/src/plugins/platforms/xcb/qxcbconnection.cpp
@@ -55,7 +55,6 @@
#include <algorithm>
-#include <dlfcn.h>
#include <stdio.h>
#include <errno.h>
#include <xcb/shm.h>
@@ -77,6 +76,14 @@
#include <xcb/render.h>
#endif
+#if defined(Q_CC_GNU) && defined(Q_OF_ELF)
+static xcb_generic_event_t *local_xcb_poll_for_queued_event(xcb_connection_t *c)
+ __attribute__((weakref("xcb_poll_for_queued_event")));
+
+static inline void checkXcbPollForQueuedEvent()
+{ }
+#else
+#include <dlfcn.h>
typedef xcb_generic_event_t * (*XcbPollForQueuedEventFunctionPointer)(xcb_connection_t *c);
static XcbPollForQueuedEventFunctionPointer local_xcb_poll_for_queued_event;
@@ -85,12 +92,8 @@ static inline void checkXcbPollForQueuedEvent()
#ifdef RTLD_DEFAULT
local_xcb_poll_for_queued_event = (XcbPollForQueuedEventFunctionPointer)dlsym(RTLD_DEFAULT, "xcb_poll_for_queued_event");
#endif
-
-#ifdef Q_XCB_DEBUG
- if (local_xcb_poll_for_queued_event)
- qDebug("Using threaded event reader with xcb_poll_for_queued_event");
-#endif
}
+#endif
QT_BEGIN_NAMESPACE