| 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 <QtGui/private/qtguiglobal_p.h> |
| 9 |
#include <qpa/qplatformintegration.h> |
| 10 |
#include <qpa/qplatformscreen.h> |
| 11 |
|
| 12 |
#include "qxcbexport.h" |
| 13 |
|
| 14 |
#include <xcb/xcb.h> |
| 15 |
|
| 16 |
QT_BEGIN_NAMESPACE |
| 17 |
|
| 18 |
class QXcbConnection; |
| 19 |
class QAbstractEventDispatcher; |
| 20 |
class QXcbNativeInterface; |
| 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 |
QPlatformPixmap *createPlatformPixmap(QPlatformPixmap::PixelType type) const override; |
| 29 |
QPlatformWindow *createPlatformWindow(QWindow *window) const override; |
| 30 |
QPlatformWindow *createForeignWindow(QWindow *window, WId nativeHandle) const override; |
| 31 |
#ifndef QT_NO_OPENGL |
| 32 |
QPlatformOpenGLContext *createPlatformOpenGLContext(QOpenGLContext *context) const override; |
| 33 |
#endif |
| 34 |
QPlatformBackingStore *createPlatformBackingStore(QWindow *window) const override; |
| 35 |
|
| 36 |
QPlatformOffscreenSurface *createPlatformOffscreenSurface(QOffscreenSurface *surface) const override; |
| 37 |
|
| 38 |
bool hasCapability(Capability cap) const override; |
| 39 |
QAbstractEventDispatcher *createEventDispatcher() const override; |
| 40 |
void initialize() override; |
| 41 |
|
| 42 |
void moveToScreen(QWindow *window, int screen); |
| 43 |
|
| 44 |
QPlatformFontDatabase *fontDatabase() const override; |
| 45 |
|
| 46 |
QPlatformNativeInterface *nativeInterface()const override; |
| 47 |
|
| 48 |
#ifndef QT_NO_CLIPBOARD |
| 49 |
QPlatformClipboard *clipboard() const override; |
| 50 |
#endif |
| 51 |
#if QT_CONFIG(draganddrop) |
| 52 |
QPlatformDrag *drag() const override; |
| 53 |
#endif |
| 54 |
|
| 55 |
QPlatformInputContext *inputContext() const override; |
| 56 |
|
| 57 |
#ifndef QT_NO_ACCESSIBILITY |
| 58 |
QPlatformAccessibility *accessibility() const override; |
| 59 |
#endif |
| 60 |
|
| 61 |
QPlatformServices *services() const override; |
| 62 |
|
| 63 |
Qt::KeyboardModifiers queryKeyboardModifiers() const override; |
| 64 |
QList<int> possibleKeys(const QKeyEvent *e) const override; |
| 65 |
|
| 66 |
QStringList themeNames() const override; |
| 67 |
QPlatformTheme *createPlatformTheme(const QString &name) const override; |
| 68 |
QVariant styleHint(StyleHint hint) const override; |
| 69 |
|
| 70 |
bool hasDefaultConnection() const { return !m_connections.isEmpty(); } |
| 71 |
QXcbConnection *defaultConnection() const { return m_connections.first(); } |
| 72 |
|
| 73 |
QByteArray wmClass() const; |
| 74 |
|
| 75 |
#if QT_CONFIG(xcb_sm) |
| 76 |
QPlatformSessionManager *createPlatformSessionManager(const QString &id, const QString &key) const override; |
| 77 |
#endif |
| 78 |
|
| 79 |
void sync() override; |
| 80 |
|
| 81 |
void beep() const override; |
| 82 |
|
| 83 |
bool nativePaintingEnabled() const; |
| 84 |
|
| 85 |
#if QT_CONFIG(vulkan) |
| 86 |
QPlatformVulkanInstance *createPlatformVulkanInstance(QVulkanInstance *instance) const override; |
| 87 |
#endif |
| 88 |
|
| 89 |
static QXcbIntegration *instance() { return m_instance; } |
| 90 |
|
| 91 |
private: |
| 92 |
QList<QXcbConnection *> m_connections; |
| 93 |
|
| 94 |
QScopedPointer<QPlatformFontDatabase> m_fontDatabase; |
| 95 |
QScopedPointer<QXcbNativeInterface> m_nativeInterface; |
| 96 |
|
| 97 |
QScopedPointer<QPlatformInputContext> m_inputContext; |
| 98 |
|
| 99 |
#ifndef QT_NO_ACCESSIBILITY |
| 100 |
mutable QScopedPointer<QPlatformAccessibility> m_accessibility; |
| 101 |
#endif |
| 102 |
|
| 103 |
QScopedPointer<QPlatformServices> m_services; |
| 104 |
|
| 105 |
mutable QByteArray m_wmClass; |
| 106 |
const char *m_instanceName; |
| 107 |
bool m_canGrab; |
| 108 |
xcb_visualid_t m_defaultVisualId; |
| 109 |
|
| 110 |
static QXcbIntegration *m_instance; |
| 111 |
}; |
| 112 |
|
| 113 |
QT_END_NAMESPACE |
| 114 |
|
| 115 |
#endif |