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 | |
15 | QT_BEGIN_NAMESPACE |
16 | |
17 | class QXcbConnection; |
18 | |
19 | class QXcbUnixEventDispatcher : public QEventDispatcherUNIX |
20 | { |
21 | Q_OBJECT |
22 | public: |
23 | explicit QXcbUnixEventDispatcher(QXcbConnection *connection, QObject *parent = nullptr); |
24 | ~QXcbUnixEventDispatcher(); |
25 | bool processEvents(QEventLoop::ProcessEventsFlags flags) override; |
26 | |
27 | private: |
28 | QXcbConnection *m_connection; |
29 | }; |
30 | |
31 | #if QT_CONFIG(glib) |
32 | |
33 | struct XcbEventSource; |
34 | class QXcbGlibEventDispatcherPrivate; |
35 | |
36 | class QXcbGlibEventDispatcher : public QEventDispatcherGlib |
37 | { |
38 | Q_OBJECT |
39 | Q_DECLARE_PRIVATE(QXcbGlibEventDispatcher) |
40 | |
41 | public: |
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 | |
48 | private: |
49 | XcbEventSource *m_xcbEventSource; |
50 | GSourceFuncs m_xcbEventSourceFuncs; |
51 | QEventLoop::ProcessEventsFlags m_flags; |
52 | }; |
53 | |
54 | class QXcbGlibEventDispatcherPrivate : public QEventDispatcherGlibPrivate |
55 | { |
56 | Q_DECLARE_PUBLIC(QXcbGlibEventDispatcher) |
57 | |
58 | public: |
59 | QXcbGlibEventDispatcherPrivate(); |
60 | }; |
61 | |
62 | #endif // QT_CONFIG(glib) |
63 | |
64 | class QXcbEventDispatcher |
65 | { |
66 | public: |
67 | static QAbstractEventDispatcher *createEventDispatcher(QXcbConnection *connection); |
68 | }; |
69 | |
70 | QT_END_NAMESPACE |
71 | |
72 | #endif // QXCBEVENTDISPATCHER_H |
73 |