6#include <QtCore/QCoreApplication>
8#include <qpa/qwindowsysteminterface.h>
34 QXcbGlibEventDispatcher *dispatcher;
35 QXcbGlibEventDispatcherPrivate *dispatcher_p;
39static gboolean xcbSourcePrepare(GSource *
source, gint *
timeout)
42 auto xcbEventSource =
reinterpret_cast<XcbEventSource *
>(
source);
43 return xcbEventSource->dispatcher_p->wakeUpCalled;
46static gboolean xcbSourceCheck(GSource *
source)
48 return xcbSourcePrepare(
source,
nullptr);
51static gboolean xcbSourceDispatch(GSource *
source, GSourceFunc, gpointer)
53 auto xcbEventSource =
reinterpret_cast<XcbEventSource *
>(
source);
54 QEventLoop::ProcessEventsFlags
flags = xcbEventSource->dispatcher->flags();
55 xcbEventSource->connection->processXcbEvents(
flags);
64 Q_D(QXcbGlibEventDispatcher);
66 m_xcbEventSourceFuncs.prepare = xcbSourcePrepare;
67 m_xcbEventSourceFuncs.check = xcbSourceCheck;
68 m_xcbEventSourceFuncs.dispatch = xcbSourceDispatch;
69 m_xcbEventSourceFuncs.finalize =
nullptr;
71 GSource *
source = g_source_new(&m_xcbEventSourceFuncs,
sizeof(XcbEventSource));
72 g_source_set_name(
source,
"[Qt] XcbEventSource");
73 m_xcbEventSource =
reinterpret_cast<XcbEventSource *
>(
source);
75 m_xcbEventSource->dispatcher =
this;
76 m_xcbEventSource->dispatcher_p = d_func();
79 g_source_set_can_recurse(&m_xcbEventSource->source,
true);
80 g_source_attach(&m_xcbEventSource->source,
d->mainContext);
83QXcbGlibEventDispatcherPrivate::QXcbGlibEventDispatcherPrivate()
87QXcbGlibEventDispatcher::~QXcbGlibEventDispatcher()
89 g_source_destroy(&m_xcbEventSource->source);
90 g_source_unref(&m_xcbEventSource->source);
93bool QXcbGlibEventDispatcher::processEvents(QEventLoop::ProcessEventsFlags
flags)
105 qCDebug(lcQpaXcb,
"using glib dispatcher");
106 return new QXcbGlibEventDispatcher(
connection);
110 qCDebug(lcQpaXcb,
"using unix dispatcher");
117#include "moc_qxcbeventdispatcher.cpp"
static bool versionSupported()
bool processEvents(QEventLoop::ProcessEventsFlags flags) override
Processes pending events that match flags until there are no more events to process.
bool processEvents(QEventLoop::ProcessEventsFlags flags) override
Processes pending events that match flags until there are no more events to process.
static bool sendWindowSystemEvents(QEventLoop::ProcessEventsFlags flags)
void processXcbEvents(QEventLoop::ProcessEventsFlags flags)
static QAbstractEventDispatcher * createEventDispatcher(QXcbConnection *connection)
~QXcbUnixEventDispatcher()
bool processEvents(QEventLoop::ProcessEventsFlags flags) override
Processes pending events that match flags until there are no more events to process.
QXcbUnixEventDispatcher(QXcbConnection *connection, QObject *parent=nullptr)
Combined button and popup list for selecting options.
DBusConnection * connection
#define qCDebug(category,...)
GLbitfield GLuint64 timeout
[4]
GLsizei GLsizei GLchar * source
Q_CORE_EXPORT bool qEnvironmentVariableIsEmpty(const char *varName) noexcept
IUIAutomationTreeWalker __RPC__deref_out_opt IUIAutomationElement ** parent