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 QVariant styleHint(QPlatformIntegration::StyleHint hint) const override;
80
81 QFbVtHandler *vtHandler() { return m_vtHandler.data(); }
82
83 QPointer<QWindow> pointerWindow() { return m_pointerWindow; }
84 void setPointerWindow(QWindow *pointerWindow) { m_pointerWindow = pointerWindow; }
85
86#if QT_CONFIG(evdev)
87 void loadKeymap(const QString &filename) override;
88 void switchLang() override;
89#endif
90
91protected:
92 virtual void createInputHandlers();
93 QEvdevKeyboardManager *m_kbdMgr;
94
95private:
96 EGLNativeDisplayType nativeDisplay() const;
97
98 EGLDisplay m_display;
99 QPlatformInputContext *m_inputContext;
100 QScopedPointer<QPlatformFontDatabase> m_fontDb;
101 QScopedPointer<QPlatformServices> m_services;
102 QScopedPointer<QFbVtHandler> m_vtHandler;
103 QPointer<QWindow> m_pointerWindow;
104 bool m_disableInputHandlers;
105};
106
107QT_END_NAMESPACE
108
109#endif // QEGLFSINTEGRATION_H
110

Provided by KDAB

Privacy Policy
Learn Advanced QML with KDAB
Find out more

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