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/qplatformscreen.h>
61
62QT_BEGIN_NAMESPACE
63
64class QEglFSWindow;
65class QEglFSContext;
66class QFbVtHandler;
67class QEvdevKeyboardManager;
68
69class Q_EGLFS_EXPORT QEglFSIntegration : public QPlatformIntegration, public QPlatformNativeInterface
70{
71public:
72 QEglFSIntegration();
73
74 void initialize() override;
75 void destroy() override;
76
77 EGLDisplay display() const { return m_display; }
78
79 QAbstractEventDispatcher *createEventDispatcher() const override;
80 QPlatformFontDatabase *fontDatabase() const override;
81 QPlatformServices *services() const override;
82 QPlatformInputContext *inputContext() const override { return m_inputContext; }
83 QPlatformTheme *createPlatformTheme(const QString &name) const override;
84
85 QPlatformWindow *createPlatformWindow(QWindow *window) const override;
86 QPlatformBackingStore *createPlatformBackingStore(QWindow *window) const override;
87#ifndef QT_NO_OPENGL
88 QPlatformOpenGLContext *createPlatformOpenGLContext(QOpenGLContext *context) const override;
89 QPlatformOffscreenSurface *createPlatformOffscreenSurface(QOffscreenSurface *surface) const override;
90#endif
91#if QT_CONFIG(vulkan)
92 QPlatformVulkanInstance *createPlatformVulkanInstance(QVulkanInstance *instance) const override;
93#endif
94 bool hasCapability(QPlatformIntegration::Capability cap) const override;
95
96 QPlatformNativeInterface *nativeInterface() const override;
97
98 // QPlatformNativeInterface
99 void *nativeResourceForIntegration(const QByteArray &resource) override;
100 void *nativeResourceForScreen(const QByteArray &resource, QScreen *screen) override;
101 void *nativeResourceForWindow(const QByteArray &resource, QWindow *window) override;
102#ifndef QT_NO_OPENGL
103 void *nativeResourceForContext(const QByteArray &resource, QOpenGLContext *context) override;
104#endif
105 NativeResourceForContextFunction nativeResourceFunctionForContext(const QByteArray &resource) override;
106
107 QFunctionPointer platformFunction(const QByteArray &function) const override;
108
109 QFbVtHandler *vtHandler() { return m_vtHandler.data(); }
110
111 QPointer<QWindow> pointerWindow() { return m_pointerWindow; }
112 void setPointerWindow(QWindow *pointerWindow) { m_pointerWindow = pointerWindow; }
113
114private:
115 EGLNativeDisplayType nativeDisplay() const;
116 void createInputHandlers();
117 static void loadKeymapStatic(const QString &filename);
118 static void switchLangStatic();
119
120 EGLDisplay m_display;
121 QPlatformInputContext *m_inputContext;
122 QScopedPointer<QPlatformFontDatabase> m_fontDb;
123 QScopedPointer<QPlatformServices> m_services;
124 QScopedPointer<QFbVtHandler> m_vtHandler;
125 QEvdevKeyboardManager *m_kbdMgr;
126 QPointer<QWindow> m_pointerWindow;
127 bool m_disableInputHandlers;
128};
129
130QT_END_NAMESPACE
131
132#endif // QEGLFSINTEGRATION_H
133

source code of qtbase/src/plugins/platforms/eglfs/api/qeglfsintegration_p.h