| 1 |
// Copyright (C) 2016 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 |
|
| 4 |
#ifndef QXCBINTEGRATION_H |
| 5 |
#define QXCBINTEGRATION_H |
| 6 |
|
| 7 |
#include <QtGui/private/qtguiglobal_p.h> |
| 8 |
#include <qpa/qplatformintegration.h> |
| 9 |
#include <qpa/qplatformscreen.h> |
| 10 |
#include <qpa/qplatformopenglcontext.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 |
#ifndef QT_NO_OPENGL |
| 24 |
# if QT_CONFIG(xcb_glx_plugin) |
| 25 |
, public QNativeInterface::Private::QGLXIntegration |
| 26 |
# endif |
| 27 |
# if QT_CONFIG(egl) |
| 28 |
, public QNativeInterface::Private::QEGLIntegration |
| 29 |
# endif |
| 30 |
#endif |
| 31 |
{ |
| 32 |
public: |
| 33 |
QXcbIntegration(const QStringList ¶meters, int &argc, char **argv); |
| 34 |
~QXcbIntegration(); |
| 35 |
|
| 36 |
QPlatformPixmap *createPlatformPixmap(QPlatformPixmap::PixelType type) const override; |
| 37 |
QPlatformWindow *createPlatformWindow(QWindow *window) const override; |
| 38 |
QPlatformWindow *createForeignWindow(QWindow *window, WId nativeHandle) const override; |
| 39 |
#ifndef QT_NO_OPENGL |
| 40 |
QPlatformOpenGLContext *createPlatformOpenGLContext(QOpenGLContext *context) const override; |
| 41 |
# if QT_CONFIG(xcb_glx_plugin) |
| 42 |
QOpenGLContext *createOpenGLContext(GLXContext context, void *visualInfo, QOpenGLContext *shareContext) const override; |
| 43 |
# endif |
| 44 |
# if QT_CONFIG(egl) |
| 45 |
QOpenGLContext *createOpenGLContext(EGLContext context, EGLDisplay display, QOpenGLContext *shareContext) const override; |
| 46 |
# endif |
| 47 |
#endif |
| 48 |
QPlatformBackingStore *createPlatformBackingStore(QWindow *window) const override; |
| 49 |
|
| 50 |
QPlatformOffscreenSurface *createPlatformOffscreenSurface(QOffscreenSurface *surface) const override; |
| 51 |
|
| 52 |
bool hasCapability(Capability cap) const override; |
| 53 |
QAbstractEventDispatcher *createEventDispatcher() const override; |
| 54 |
void initialize() override; |
| 55 |
|
| 56 |
void moveToScreen(QWindow *window, int screen); |
| 57 |
|
| 58 |
QPlatformFontDatabase *fontDatabase() const override; |
| 59 |
|
| 60 |
QPlatformNativeInterface *nativeInterface()const override; |
| 61 |
|
| 62 |
#ifndef QT_NO_CLIPBOARD |
| 63 |
QPlatformClipboard *clipboard() const override; |
| 64 |
#endif |
| 65 |
#if QT_CONFIG(draganddrop) |
| 66 |
QPlatformDrag *drag() const override; |
| 67 |
#endif |
| 68 |
|
| 69 |
QPlatformInputContext *inputContext() const override; |
| 70 |
|
| 71 |
#if QT_CONFIG(accessibility) |
| 72 |
QPlatformAccessibility *accessibility() const override; |
| 73 |
#endif |
| 74 |
|
| 75 |
QPlatformServices *services() const override; |
| 76 |
|
| 77 |
QPlatformKeyMapper *keyMapper() const override; |
| 78 |
|
| 79 |
QStringList themeNames() const override; |
| 80 |
QPlatformTheme *createPlatformTheme(const QString &name) const override; |
| 81 |
QVariant styleHint(StyleHint hint) const override; |
| 82 |
|
| 83 |
bool hasConnection() const { return m_connection; } |
| 84 |
QXcbConnection *connection() const { return m_connection; } |
| 85 |
|
| 86 |
QByteArray wmClass() const; |
| 87 |
|
| 88 |
#if QT_CONFIG(xcb_sm) |
| 89 |
QPlatformSessionManager *createPlatformSessionManager(const QString &id, const QString &key) const override; |
| 90 |
#endif |
| 91 |
|
| 92 |
void sync() override; |
| 93 |
|
| 94 |
void beep() const override; |
| 95 |
|
| 96 |
bool nativePaintingEnabled() const; |
| 97 |
|
| 98 |
#if QT_CONFIG(vulkan) |
| 99 |
QPlatformVulkanInstance *createPlatformVulkanInstance(QVulkanInstance *instance) const override; |
| 100 |
#endif |
| 101 |
|
| 102 |
static QXcbIntegration *instance() { return m_instance; } |
| 103 |
|
| 104 |
void setApplicationBadge(qint64 number) override; |
| 105 |
|
| 106 |
private: |
| 107 |
QXcbConnection *m_connection = nullptr; |
| 108 |
|
| 109 |
QScopedPointer<QPlatformFontDatabase> m_fontDatabase; |
| 110 |
QScopedPointer<QXcbNativeInterface> m_nativeInterface; |
| 111 |
|
| 112 |
QScopedPointer<QPlatformInputContext> m_inputContext; |
| 113 |
|
| 114 |
#if QT_CONFIG(accessibility) |
| 115 |
mutable QScopedPointer<QPlatformAccessibility> m_accessibility; |
| 116 |
#endif |
| 117 |
|
| 118 |
QScopedPointer<QPlatformServices> m_services; |
| 119 |
|
| 120 |
mutable QByteArray m_wmClass; |
| 121 |
const char *m_instanceName; |
| 122 |
bool m_canGrab; |
| 123 |
xcb_visualid_t m_defaultVisualId; |
| 124 |
|
| 125 |
static QXcbIntegration *m_instance; |
| 126 |
}; |
| 127 |
|
| 128 |
QT_END_NAMESPACE |
| 129 |
|
| 130 |
#endif |