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 QEGLFSINTEGRATION_H
5#define QEGLFSINTEGRATION_H
6
7//
8// W A R N I N G
9// -------------
10//
11// This file is not part of the Qt API. It exists purely as an
12// implementation detail. This header file may change from version to
13// version without notice, or even be removed.
14//
15// We mean it.
16//
17
18#include "qeglfsglobal_p.h"
19#include <QtCore/QPointer>
20#include <QtCore/QVariant>
21#include <QtGui/QWindow>
22#include <qpa/qplatformintegration.h>
23#include <qpa/qplatformnativeinterface.h>
24#include <qpa/qplatformopenglcontext.h>
25#include <qpa/qplatformscreen.h>
26#include <QtGui/private/qkeymapper_p.h>
27
28QT_BEGIN_NAMESPACE
29
30class QEglFSWindow;
31class QEglFSContext;
32class QFbVtHandler;
33class QEvdevKeyboardManager;
34
35class Q_EGLFS_EXPORT QEglFSIntegration : public QPlatformIntegration, public QPlatformNativeInterface
36#if QT_CONFIG(evdev)
37 , public QNativeInterface::Private::QEvdevKeyMapper
38#endif
39#ifndef QT_NO_OPENGL
40 , public QNativeInterface::Private::QEGLIntegration
41#endif
42{
43public:
44 QEglFSIntegration();
45
46 void initialize() override;
47 void destroy() override;
48
49 EGLDisplay display() const { return m_display; }
50
51 QAbstractEventDispatcher *createEventDispatcher() const override;
52 QPlatformFontDatabase *fontDatabase() const override;
53 QPlatformServices *services() const override;
54 QPlatformInputContext *inputContext() const override { return m_inputContext; }
55 QPlatformTheme *createPlatformTheme(const QString &name) const override;
56
57 QPlatformWindow *createPlatformWindow(QWindow *window) const override;
58 QPlatformBackingStore *createPlatformBackingStore(QWindow *window) const override;
59#ifndef QT_NO_OPENGL
60 QPlatformOpenGLContext *createPlatformOpenGLContext(QOpenGLContext *context) const override;
61 QOpenGLContext *createOpenGLContext(EGLContext context, EGLDisplay display, QOpenGLContext *shareContext) const override;
62 QPlatformOffscreenSurface *createPlatformOffscreenSurface(QOffscreenSurface *surface) const override;
63#endif
64 bool hasCapability(QPlatformIntegration::Capability cap) const override;
65
66 QPlatformNativeInterface *nativeInterface() const override;
67
68 // QPlatformNativeInterface
69 void *nativeResourceForIntegration(const QByteArray &resource) override;
70 void *nativeResourceForScreen(const QByteArray &resource, QScreen *screen) override;
71 void *nativeResourceForWindow(const QByteArray &resource, QWindow *window) override;
72#ifndef QT_NO_OPENGL
73 void *nativeResourceForContext(const QByteArray &resource, QOpenGLContext *context) override;
74#endif
75 NativeResourceForContextFunction nativeResourceFunctionForContext(const QByteArray &resource) override;
76
77 QFunctionPointer platformFunction(const QByteArray &function) const override;
78
79 QFbVtHandler *vtHandler() { return m_vtHandler.data(); }
80
81 QPointer<QWindow> pointerWindow() { return m_pointerWindow; }
82 void setPointerWindow(QWindow *pointerWindow) { m_pointerWindow = pointerWindow; }
83
84#if QT_CONFIG(evdev)
85 void loadKeymap(const QString &filename) override;
86 void switchLang() override;
87#endif
88
89protected:
90 virtual void createInputHandlers();
91 QEvdevKeyboardManager *m_kbdMgr;
92
93private:
94 EGLNativeDisplayType nativeDisplay() const;
95
96 EGLDisplay m_display;
97 QPlatformInputContext *m_inputContext;
98 QScopedPointer<QPlatformFontDatabase> m_fontDb;
99 QScopedPointer<QPlatformServices> m_services;
100 QScopedPointer<QFbVtHandler> m_vtHandler;
101 QPointer<QWindow> m_pointerWindow;
102 bool m_disableInputHandlers;
103};
104
105QT_END_NAMESPACE
106
107#endif // QEGLFSINTEGRATION_H
108

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