| 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 override; |
| 29 |
QPlatformWindow *createForeignWindow(QWindow *window, WId nativeHandle) const override; |
| 30 |
#ifndef QT_NO_OPENGL |
| 31 |
QPlatformOpenGLContext *createPlatformOpenGLContext(QOpenGLContext *context) const override; |
| 32 |
#endif |
| 33 |
QPlatformBackingStore *createPlatformBackingStore(QWindow *window) const override; |
| 34 |
|
| 35 |
QPlatformOffscreenSurface *createPlatformOffscreenSurface(QOffscreenSurface *surface) const override; |
| 36 |
|
| 37 |
bool hasCapability(Capability cap) const override; |
| 38 |
QAbstractEventDispatcher *createEventDispatcher() const override; |
| 39 |
void initialize() override; |
| 40 |
|
| 41 |
void moveToScreen(QWindow *window, int screen); |
| 42 |
|
| 43 |
QPlatformFontDatabase *fontDatabase() const override; |
| 44 |
|
| 45 |
QPlatformNativeInterface *nativeInterface()const override; |
| 46 |
|
| 47 |
#ifndef QT_NO_CLIPBOARD |
| 48 |
QPlatformClipboard *clipboard() const override; |
| 49 |
#endif |
| 50 |
#ifndef QT_NO_DRAGANDDROP |
| 51 |
QPlatformDrag *drag() const override; |
| 52 |
#endif |
| 53 |
|
| 54 |
QPlatformInputContext *inputContext() const override; |
| 55 |
|
| 56 |
#ifndef QT_NO_ACCESSIBILITY |
| 57 |
QPlatformAccessibility *accessibility() const override; |
| 58 |
#endif |
| 59 |
|
| 60 |
QPlatformServices *services() const override; |
| 61 |
|
| 62 |
Qt::KeyboardModifiers queryKeyboardModifiers() const override; |
| 63 |
QList<int> possibleKeys(const QKeyEvent *e) const override; |
| 64 |
|
| 65 |
QStringList themeNames() const override; |
| 66 |
QPlatformTheme *createPlatformTheme(const QString &name) const override; |
| 67 |
QVariant styleHint(StyleHint hint) const override; |
| 68 |
|
| 69 |
QXcbConnection *defaultConnection() const { return m_connections.first(); } |
| 70 |
|
| 71 |
QByteArray wmClass() const; |
| 72 |
|
| 73 |
#if !defined(QT_NO_SESSIONMANAGER) && defined(XCB_USE_SM) |
| 74 |
QPlatformSessionManager *createPlatformSessionManager(const QString &id, const QString &key) const override; |
| 75 |
#endif |
| 76 |
|
| 77 |
void sync() override; |
| 78 |
|
| 79 |
void beep() const override; |
| 80 |
|
| 81 |
static QXcbIntegration *instance() { return m_instance; } |
| 82 |
|
| 83 |
private: |
| 84 |
QList<QXcbConnection *> m_connections; |
| 85 |
|
| 86 |
QScopedPointer<QPlatformFontDatabase> m_fontDatabase; |
| 87 |
QScopedPointer<QXcbNativeInterface> m_nativeInterface; |
| 88 |
|
| 89 |
QScopedPointer<QPlatformInputContext> m_inputContext; |
| 90 |
|
| 91 |
#ifndef QT_NO_ACCESSIBILITY |
| 92 |
mutable QScopedPointer<QPlatformAccessibility> m_accessibility; |
| 93 |
#endif |
| 94 |
|
| 95 |
QScopedPointer<QPlatformServices> m_services; |
| 96 |
|
| 97 |
friend class QXcbConnection; // access QPlatformIntegration::screenAdded() |
| 98 |
|
| 99 |
mutable QByteArray m_wmClass; |
| 100 |
const char *m_instanceName; |
| 101 |
bool m_canGrab; |
| 102 |
xcb_visualid_t m_defaultVisualId; |
| 103 |
|
| 104 |
static QXcbIntegration *m_instance; |
| 105 |
}; |
| 106 |
|
| 107 |
QT_END_NAMESPACE |
| 108 |
|
| 109 |
#endif |