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

Provided by KDAB

Privacy Policy
Start learning QML with our Intro Training
Find out more

source code of qtbase/src/plugins/platforms/xcb/qxcbintegration.h