| 1 |
// Copyright (C) 2016 The Qt Company Ltd. |
| 2 |
// |
| 3 |
// SPDX-License-Identifier: LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only |
| 4 |
|
| 5 |
#ifndef QXCBINTEGRATION_H |
| 6 |
#define QXCBINTEGRATION_H |
| 7 |
|
| 8 |
#include <qpa/qplatformintegration.h> |
| 9 |
#include <qpa/qplatformscreen.h> |
| 10 |
|
| 11 |
#include "qxcbexport.h" |
| 12 |
|
| 13 |
#include <xcb/xcb.h> |
| 14 |
|
| 15 |
QT_BEGIN_NAMESPACE |
| 16 |
|
| 17 |
class QXcbConnection; |
| 18 |
class QAbstractEventDispatcher; |
| 19 |
class QXcbNativeInterface; |
| 20 |
class QXcbScreen; |
| 21 |
|
| 22 |
class Q_XCB_EXPORT QXcbIntegration : public QPlatformIntegration |
| 23 |
{ |
| 24 |
public: |
| 25 |
QXcbIntegration(const QStringList ¶meters, int &argc, char **argv); |
| 26 |
~QXcbIntegration(); |
| 27 |
|
| 28 |
QPlatformWindow *createPlatformWindow(QWindow *window) const Q_DECL_OVERRIDE; |
| 29 |
#ifndef QT_NO_OPENGL |
| 30 |
QPlatformOpenGLContext *createPlatformOpenGLContext(QOpenGLContext *context) const Q_DECL_OVERRIDE; |
| 31 |
#endif |
| 32 |
QPlatformBackingStore *createPlatformBackingStore(QWindow *window) const Q_DECL_OVERRIDE; |
| 33 |
|
| 34 |
QPlatformOffscreenSurface *createPlatformOffscreenSurface(QOffscreenSurface *surface) const Q_DECL_OVERRIDE; |
| 35 |
|
| 36 |
bool hasCapability(Capability cap) const Q_DECL_OVERRIDE; |
| 37 |
QAbstractEventDispatcher *createEventDispatcher() const Q_DECL_OVERRIDE; |
| 38 |
void initialize() Q_DECL_OVERRIDE; |
| 39 |
|
| 40 |
void moveToScreen(QWindow *window, int screen); |
| 41 |
|
| 42 |
QPlatformFontDatabase *fontDatabase() const Q_DECL_OVERRIDE; |
| 43 |
|
| 44 |
QPlatformNativeInterface *nativeInterface()const Q_DECL_OVERRIDE; |
| 45 |
|
| 46 |
#ifndef QT_NO_CLIPBOARD |
| 47 |
QPlatformClipboard *clipboard() const Q_DECL_OVERRIDE; |
| 48 |
#endif |
| 49 |
#ifndef QT_NO_DRAGANDDROP |
| 50 |
QPlatformDrag *drag() const Q_DECL_OVERRIDE; |
| 51 |
#endif |
| 52 |
|
| 53 |
QPlatformInputContext *inputContext() const Q_DECL_OVERRIDE; |
| 54 |
|
| 55 |
#ifndef QT_NO_ACCESSIBILITY |
| 56 |
QPlatformAccessibility *accessibility() const Q_DECL_OVERRIDE; |
| 57 |
#endif |
| 58 |
|
| 59 |
QPlatformServices *services() const Q_DECL_OVERRIDE; |
| 60 |
|
| 61 |
Qt::KeyboardModifiers queryKeyboardModifiers() const Q_DECL_OVERRIDE; |
| 62 |
QList<int> possibleKeys(const QKeyEvent *e) const Q_DECL_OVERRIDE; |
| 63 |
|
| 64 |
QStringList themeNames() const Q_DECL_OVERRIDE; |
| 65 |
QPlatformTheme *createPlatformTheme(const QString &name) const Q_DECL_OVERRIDE; |
| 66 |
QVariant styleHint(StyleHint hint) const Q_DECL_OVERRIDE; |
| 67 |
|
| 68 |
QXcbConnection *defaultConnection() const { return m_connections.first(); } |
| 69 |
|
| 70 |
QByteArray wmClass() const; |
| 71 |
|
| 72 |
#if !defined(QT_NO_SESSIONMANAGER) && defined(XCB_USE_SM) |
| 73 |
QPlatformSessionManager *createPlatformSessionManager(const QString &id, const QString &key) const Q_DECL_OVERRIDE; |
| 74 |
#endif |
| 75 |
|
| 76 |
void sync() Q_DECL_OVERRIDE; |
| 77 |
|
| 78 |
void beep() const Q_DECL_OVERRIDE; |
| 79 |
|
| 80 |
static QXcbIntegration *instance() { return m_instance; } |
| 81 |
|
| 82 |
private: |
| 83 |
QList<QXcbConnection *> m_connections; |
| 84 |
|
| 85 |
QScopedPointer<QPlatformFontDatabase> m_fontDatabase; |
| 86 |
QScopedPointer<QXcbNativeInterface> m_nativeInterface; |
| 87 |
|
| 88 |
QScopedPointer<QPlatformInputContext> m_inputContext; |
| 89 |
|
| 90 |
#ifndef QT_NO_ACCESSIBILITY |
| 91 |
mutable QScopedPointer<QPlatformAccessibility> m_accessibility; |
| 92 |
#endif |
| 93 |
|
| 94 |
QScopedPointer<QPlatformServices> m_services; |
| 95 |
|
| 96 |
friend class QXcbConnection; // access QPlatformIntegration::screenAdded() |
| 97 |
|
| 98 |
mutable QByteArray m_wmClass; |
| 99 |
const char *m_instanceName; |
| 100 |
bool m_canGrab; |
| 101 |
xcb_visualid_t m_defaultVisualId; |
| 102 |
|
| 103 |
static QXcbIntegration *m_instance; |
| 104 |
}; |
| 105 |
|
| 106 |
QT_END_NAMESPACE |
| 107 |
|
| 108 |
#endif |