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 QEGLFSWINDOW_H |
5 | #define QEGLFSWINDOW_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 "qeglfsintegration_p.h" |
20 | #include "qeglfsscreen_p.h" |
21 | |
22 | #include <qpa/qplatformwindow.h> |
23 | #ifndef QT_NO_OPENGL |
24 | # include <QtOpenGL/private/qopenglcompositor_p.h> |
25 | #endif |
26 | |
27 | QT_BEGIN_NAMESPACE |
28 | |
29 | class QOpenGLCompositorBackingStore; |
30 | class QPlatformTextureList; |
31 | |
32 | #ifndef QT_NO_OPENGL |
33 | class Q_EGLFS_EXPORT QEglFSWindow : public QPlatformWindow, public QOpenGLCompositorWindow |
34 | #else |
35 | class Q_EGLFS_EXPORT QEglFSWindow : public QPlatformWindow |
36 | #endif |
37 | { |
38 | public: |
39 | QEglFSWindow(QWindow *w); |
40 | ~QEglFSWindow(); |
41 | |
42 | void create(); |
43 | void destroy(); |
44 | |
45 | void setGeometry(const QRect &) override; |
46 | QRect geometry() const override; |
47 | void setVisible(bool visible) override; |
48 | void requestActivateWindow() override; |
49 | void raise() override; |
50 | void lower() override; |
51 | |
52 | void propagateSizeHints() override { } |
53 | void setMask(const QRegion &) override { } |
54 | bool setKeyboardGrabEnabled(bool) override { return false; } |
55 | bool setMouseGrabEnabled(bool) override { return false; } |
56 | void setOpacity(qreal) override; |
57 | WId winId() const override; |
58 | |
59 | QSurfaceFormat format() const override; |
60 | |
61 | EGLNativeWindowType eglWindow() const; |
62 | EGLSurface surface() const; |
63 | QEglFSScreen *screen() const override; |
64 | |
65 | bool hasNativeWindow() const { return m_flags.testFlag(flag: HasNativeWindow); } |
66 | |
67 | void invalidateSurface() override; |
68 | virtual void resetSurface(); |
69 | |
70 | bool isRaster() const; |
71 | |
72 | #ifndef QT_NO_OPENGL |
73 | QOpenGLCompositorBackingStore *backingStore() { return m_backingStore; } |
74 | void setBackingStore(QOpenGLCompositorBackingStore *backingStore); |
75 | QWindow *sourceWindow() const override; |
76 | const QPlatformTextureList *textures() const override; |
77 | void endCompositing() override; |
78 | #endif |
79 | |
80 | protected: |
81 | #ifndef QT_NO_OPENGL |
82 | QOpenGLCompositorBackingStore *m_backingStore; |
83 | QOpenGLContext *m_rasterCompositingContext; |
84 | #endif |
85 | WId m_winId; |
86 | |
87 | EGLSurface m_surface; |
88 | EGLNativeWindowType m_window; |
89 | |
90 | EGLConfig m_config; |
91 | QSurfaceFormat m_format; |
92 | |
93 | enum Flag { |
94 | Created = 0x01, |
95 | HasNativeWindow = 0x02 |
96 | }; |
97 | Q_DECLARE_FLAGS(Flags, Flag) |
98 | Flags m_flags; |
99 | }; |
100 | |
101 | QT_END_NAMESPACE |
102 | |
103 | #endif // QEGLFSWINDOW_H |
104 |