| 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 |
|
| 28 |
QT_BEGIN_NAMESPACE |
| 29 |
|
| 30 |
class QEglFSWindow; |
| 31 |
class QEglFSContext; |
| 32 |
class QFbVtHandler; |
| 33 |
#if QT_CONFIG(evdev) |
| 34 |
class QEvdevKeyboardManager; |
| 35 |
#elif QT_CONFIG(vxworksevdev) |
| 36 |
class QVxKeyboardManager; |
| 37 |
#endif |
| 38 |
|
| 39 |
class Q_EGLFS_EXPORT QEglFSIntegration : public QPlatformIntegration, public QPlatformNativeInterface |
| 40 |
#if QT_CONFIG(evdev) |
| 41 |
, public QNativeInterface::Private::QEvdevKeyMapper |
| 42 |
#elif QT_CONFIG(vxworksevdev) |
| 43 |
, public QNativeInterface::Private::QVxKeyMapper |
| 44 |
#endif |
| 45 |
#ifndef QT_NO_OPENGL |
| 46 |
, public QNativeInterface::Private::QEGLIntegration |
| 47 |
#endif |
| 48 |
{ |
| 49 |
public: |
| 50 |
QEglFSIntegration(); |
| 51 |
|
| 52 |
void initialize() override; |
| 53 |
void destroy() override; |
| 54 |
|
| 55 |
EGLDisplay display() const { return m_display; } |
| 56 |
|
| 57 |
QAbstractEventDispatcher *createEventDispatcher() const override; |
| 58 |
QPlatformFontDatabase *fontDatabase() const override; |
| 59 |
QPlatformServices *services() const override; |
| 60 |
QPlatformInputContext *inputContext() const override { return m_inputContext; } |
| 61 |
QPlatformTheme *createPlatformTheme(const QString &name) const override; |
| 62 |
|
| 63 |
QPlatformWindow *createPlatformWindow(QWindow *window) const override; |
| 64 |
QPlatformBackingStore *createPlatformBackingStore(QWindow *window) const override; |
| 65 |
#ifndef QT_NO_OPENGL |
| 66 |
QPlatformOpenGLContext *createPlatformOpenGLContext(QOpenGLContext *context) const override; |
| 67 |
QOpenGLContext *createOpenGLContext(EGLContext context, EGLDisplay display, QOpenGLContext *shareContext) const override; |
| 68 |
QPlatformOffscreenSurface *createPlatformOffscreenSurface(QOffscreenSurface *surface) const override; |
| 69 |
#endif |
| 70 |
bool hasCapability(QPlatformIntegration::Capability cap) const override; |
| 71 |
|
| 72 |
QPlatformNativeInterface *nativeInterface() const override; |
| 73 |
|
| 74 |
// QPlatformNativeInterface |
| 75 |
void *nativeResourceForIntegration(const QByteArray &resource) override; |
| 76 |
void *nativeResourceForScreen(const QByteArray &resource, QScreen *screen) override; |
| 77 |
void *nativeResourceForWindow(const QByteArray &resource, QWindow *window) override; |
| 78 |
#ifndef QT_NO_OPENGL |
| 79 |
void *nativeResourceForContext(const QByteArray &resource, QOpenGLContext *context) override; |
| 80 |
#endif |
| 81 |
NativeResourceForContextFunction nativeResourceFunctionForContext(const QByteArray &resource) override; |
| 82 |
|
| 83 |
QFunctionPointer platformFunction(const QByteArray &function) const override; |
| 84 |
|
| 85 |
QVariant styleHint(QPlatformIntegration::StyleHint hint) const override; |
| 86 |
|
| 87 |
QFbVtHandler *vtHandler() { return m_vtHandler.data(); } |
| 88 |
|
| 89 |
QPointer<QWindow> pointerWindow() { return m_pointerWindow; } |
| 90 |
void setPointerWindow(QWindow *pointerWindow) { m_pointerWindow = pointerWindow; } |
| 91 |
|
| 92 |
#if QT_CONFIG(evdev) || QT_CONFIG(vxworksevdev) |
| 93 |
void loadKeymap(const QString &filename) override; |
| 94 |
void switchLang() override; |
| 95 |
#endif |
| 96 |
|
| 97 |
protected: |
| 98 |
virtual void createInputHandlers(); |
| 99 |
#if QT_CONFIG(evdev) |
| 100 |
QEvdevKeyboardManager *m_kbdMgr = nullptr; |
| 101 |
#elif QT_CONFIG(vxworksevdev) |
| 102 |
QVxKeyboardManager *m_kbdMgr = nullptr; |
| 103 |
#endif |
| 104 |
|
| 105 |
private: |
| 106 |
EGLNativeDisplayType nativeDisplay() const; |
| 107 |
|
| 108 |
EGLDisplay m_display; |
| 109 |
QPlatformInputContext *m_inputContext; |
| 110 |
QScopedPointer<QPlatformFontDatabase> m_fontDb; |
| 111 |
mutable QScopedPointer<QPlatformServices> m_services; |
| 112 |
QScopedPointer<QFbVtHandler> m_vtHandler; |
| 113 |
QPointer<QWindow> m_pointerWindow; |
| 114 |
bool m_disableInputHandlers; |
| 115 |
}; |
| 116 |
|
| 117 |
QT_END_NAMESPACE |
| 118 |
|
| 119 |
#endif // QEGLFSINTEGRATION_H |