1 | /**************************************************************************** |
2 | ** |
3 | ** Copyright (C) 2016 The Qt Company Ltd. |
4 | ** Contact: https://www.qt.io/licensing/ |
5 | ** |
6 | ** This file is part of the plugins of the Qt Toolkit. |
7 | ** |
8 | ** $QT_BEGIN_LICENSE:LGPL$ |
9 | ** Commercial License Usage |
10 | ** Licensees holding valid commercial Qt licenses may use this file in |
11 | ** accordance with the commercial license agreement provided with the |
12 | ** Software or, alternatively, in accordance with the terms contained in |
13 | ** a written agreement between you and The Qt Company. For licensing terms |
14 | ** and conditions see https://www.qt.io/terms-conditions. For further |
15 | ** information use the contact form at https://www.qt.io/contact-us. |
16 | ** |
17 | ** GNU Lesser General Public License Usage |
18 | ** Alternatively, this file may be used under the terms of the GNU Lesser |
19 | ** General Public License version 3 as published by the Free Software |
20 | ** Foundation and appearing in the file LICENSE.LGPL3 included in the |
21 | ** packaging of this file. Please review the following information to |
22 | ** ensure the GNU Lesser General Public License version 3 requirements |
23 | ** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. |
24 | ** |
25 | ** GNU General Public License Usage |
26 | ** Alternatively, this file may be used under the terms of the GNU |
27 | ** General Public License version 2.0 or (at your option) the GNU General |
28 | ** Public license version 3 or any later version approved by the KDE Free |
29 | ** Qt Foundation. The licenses are as published by the Free Software |
30 | ** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 |
31 | ** included in the packaging of this file. Please review the following |
32 | ** information to ensure the GNU General Public License requirements will |
33 | ** be met: https://www.gnu.org/licenses/gpl-2.0.html and |
34 | ** https://www.gnu.org/licenses/gpl-3.0.html. |
35 | ** |
36 | ** $QT_END_LICENSE$ |
37 | ** |
38 | ****************************************************************************/ |
39 | |
40 | #ifndef QEGLFSINTEGRATION_H |
41 | #define QEGLFSINTEGRATION_H |
42 | |
43 | // |
44 | // W A R N I N G |
45 | // ------------- |
46 | // |
47 | // This file is not part of the Qt API. It exists purely as an |
48 | // implementation detail. This header file may change from version to |
49 | // version without notice, or even be removed. |
50 | // |
51 | // We mean it. |
52 | // |
53 | |
54 | #include "qeglfsglobal_p.h" |
55 | #include <QtCore/QPointer> |
56 | #include <QtCore/QVariant> |
57 | #include <QtGui/QWindow> |
58 | #include <qpa/qplatformintegration.h> |
59 | #include <qpa/qplatformnativeinterface.h> |
60 | #include <qpa/qplatformopenglcontext.h> |
61 | #include <qpa/qplatformscreen.h> |
62 | #include <QtGui/private/qkeymapper_p.h> |
63 | |
64 | QT_BEGIN_NAMESPACE |
65 | |
66 | class QEglFSWindow; |
67 | class QEglFSContext; |
68 | class QFbVtHandler; |
69 | class QEvdevKeyboardManager; |
70 | |
71 | class Q_EGLFS_EXPORT QEglFSIntegration : public QPlatformIntegration, public QPlatformNativeInterface |
72 | #if QT_CONFIG(evdev) |
73 | , public QNativeInterface::Private::QEvdevKeyMapper |
74 | #endif |
75 | #ifndef QT_NO_OPENGL |
76 | , public QNativeInterface::Private::QEGLIntegration |
77 | #endif |
78 | { |
79 | public: |
80 | QEglFSIntegration(); |
81 | |
82 | void initialize() override; |
83 | void destroy() override; |
84 | |
85 | EGLDisplay display() const { return m_display; } |
86 | |
87 | QAbstractEventDispatcher *createEventDispatcher() const override; |
88 | QPlatformFontDatabase *fontDatabase() const override; |
89 | QPlatformServices *services() const override; |
90 | QPlatformInputContext *inputContext() const override { return m_inputContext; } |
91 | QPlatformTheme *createPlatformTheme(const QString &name) const override; |
92 | |
93 | QPlatformWindow *createPlatformWindow(QWindow *window) const override; |
94 | QPlatformBackingStore *createPlatformBackingStore(QWindow *window) const override; |
95 | #ifndef QT_NO_OPENGL |
96 | QPlatformOpenGLContext *createPlatformOpenGLContext(QOpenGLContext *context) const override; |
97 | QOpenGLContext *createOpenGLContext(EGLContext context, EGLDisplay display, QOpenGLContext *shareContext) const override; |
98 | QPlatformOffscreenSurface *createPlatformOffscreenSurface(QOffscreenSurface *surface) const override; |
99 | #endif |
100 | #if QT_CONFIG(vulkan) |
101 | QPlatformVulkanInstance *createPlatformVulkanInstance(QVulkanInstance *instance) const override; |
102 | #endif |
103 | bool hasCapability(QPlatformIntegration::Capability cap) const override; |
104 | |
105 | QPlatformNativeInterface *nativeInterface() const override; |
106 | |
107 | // QPlatformNativeInterface |
108 | void *nativeResourceForIntegration(const QByteArray &resource) override; |
109 | void *nativeResourceForScreen(const QByteArray &resource, QScreen *screen) override; |
110 | void *nativeResourceForWindow(const QByteArray &resource, QWindow *window) override; |
111 | #ifndef QT_NO_OPENGL |
112 | void *nativeResourceForContext(const QByteArray &resource, QOpenGLContext *context) override; |
113 | #endif |
114 | NativeResourceForContextFunction nativeResourceFunctionForContext(const QByteArray &resource) override; |
115 | |
116 | QFunctionPointer platformFunction(const QByteArray &function) const override; |
117 | |
118 | QFbVtHandler *vtHandler() { return m_vtHandler.data(); } |
119 | |
120 | QPointer<QWindow> pointerWindow() { return m_pointerWindow; } |
121 | void setPointerWindow(QWindow *pointerWindow) { m_pointerWindow = pointerWindow; } |
122 | |
123 | #if QT_CONFIG(evdev) |
124 | void loadKeymap(const QString &filename) override; |
125 | void switchLang() override; |
126 | #endif |
127 | |
128 | private: |
129 | EGLNativeDisplayType nativeDisplay() const; |
130 | void createInputHandlers(); |
131 | |
132 | EGLDisplay m_display; |
133 | QPlatformInputContext *m_inputContext; |
134 | QScopedPointer<QPlatformFontDatabase> m_fontDb; |
135 | QScopedPointer<QPlatformServices> m_services; |
136 | QScopedPointer<QFbVtHandler> m_vtHandler; |
137 | QEvdevKeyboardManager *m_kbdMgr; |
138 | QPointer<QWindow> m_pointerWindow; |
139 | bool m_disableInputHandlers; |
140 | }; |
141 | |
142 | QT_END_NAMESPACE |
143 | |
144 | #endif // QEGLFSINTEGRATION_H |
145 | |