1// Copyright (C) 2018 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
3#ifndef QXCBEVENTDISPATCHER_H
4#define QXCBEVENTDISPATCHER_H
5
6#include <QtCore/QObject>
7#include <QtCore/QEventLoop>
8
9#include <QtCore/private/qeventdispatcher_unix_p.h>
10#if QT_CONFIG(glib)
11#include <QtCore/private/qeventdispatcher_glib_p.h>
12#include <glib.h>
13#endif
14
15QT_BEGIN_NAMESPACE
16
17class QXcbConnection;
18
19class QXcbUnixEventDispatcher : public QEventDispatcherUNIX
20{
21 Q_OBJECT
22public:
23 explicit QXcbUnixEventDispatcher(QXcbConnection *connection, QObject *parent = nullptr);
24 ~QXcbUnixEventDispatcher();
25 bool processEvents(QEventLoop::ProcessEventsFlags flags) override;
26
27private:
28 QXcbConnection *m_connection;
29};
30
31#if QT_CONFIG(glib)
32
33struct XcbEventSource;
34class QXcbGlibEventDispatcherPrivate;
35
36class QXcbGlibEventDispatcher : public QEventDispatcherGlib
37{
38 Q_OBJECT
39 Q_DECLARE_PRIVATE(QXcbGlibEventDispatcher)
40
41public:
42 explicit QXcbGlibEventDispatcher(QXcbConnection *connection, QObject *parent = nullptr);
43 ~QXcbGlibEventDispatcher();
44
45 bool processEvents(QEventLoop::ProcessEventsFlags flags) override;
46 QEventLoop::ProcessEventsFlags flags() const { return m_flags; }
47
48private:
49 XcbEventSource *m_xcbEventSource;
50 GSourceFuncs m_xcbEventSourceFuncs;
51 QEventLoop::ProcessEventsFlags m_flags;
52};
53
54class QXcbGlibEventDispatcherPrivate : public QEventDispatcherGlibPrivate
55{
56 Q_DECLARE_PUBLIC(QXcbGlibEventDispatcher)
57
58public:
59 QXcbGlibEventDispatcherPrivate();
60};
61
62#endif // QT_CONFIG(glib)
63
64class QXcbEventDispatcher
65{
66public:
67 static QAbstractEventDispatcher *createEventDispatcher(QXcbConnection *connection);
68};
69
70QT_END_NAMESPACE
71
72#endif // QXCBEVENTDISPATCHER_H
73

source code of qtbase/src/plugins/platforms/xcb/qxcbeventdispatcher.h