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 QFBSCREEN_P_H |
5 | #define QFBSCREEN_P_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 <qpa/qplatformscreen.h> |
19 | #include <QtCore/QTimer> |
20 | #include <QtCore/QSize> |
21 | #include "qfbcursor_p.h" |
22 | |
23 | QT_BEGIN_NAMESPACE |
24 | |
25 | class QFbWindow; |
26 | class QFbCursor; |
27 | class QPainter; |
28 | class QFbBackingStore; |
29 | |
30 | class QFbScreen : public QObject, public QPlatformScreen |
31 | { |
32 | Q_OBJECT |
33 | |
34 | public: |
35 | enum Flag { |
36 | DontForceFirstWindowToFullScreen = 0x01 |
37 | }; |
38 | Q_DECLARE_FLAGS(Flags, Flag) |
39 | |
40 | QFbScreen(); |
41 | ~QFbScreen(); |
42 | |
43 | virtual bool initialize(); |
44 | |
45 | QRect geometry() const override { return mGeometry; } |
46 | int depth() const override { return mDepth; } |
47 | QImage::Format format() const override { return mFormat; } |
48 | QSizeF physicalSize() const override { return mPhysicalSize; } |
49 | QPlatformCursor *cursor() const override { return mCursor; } |
50 | |
51 | QWindow *topWindow() const; |
52 | QWindow *topLevelAt(const QPoint & p) const override; |
53 | |
54 | // compositor api |
55 | virtual void addWindow(QFbWindow *window); |
56 | virtual void removeWindow(QFbWindow *window); |
57 | virtual void raise(QFbWindow *window); |
58 | virtual void lower(QFbWindow *window); |
59 | virtual void topWindowChanged(QWindow *) {} |
60 | virtual int windowCount() const; |
61 | virtual Flags flags() const; |
62 | |
63 | void addPendingBackingStore(QFbBackingStore *bs) { mPendingBackingStores << bs; } |
64 | |
65 | void scheduleUpdate(); |
66 | |
67 | public slots: |
68 | virtual void setDirty(const QRect &rect); |
69 | void setPhysicalSize(const QSize &size); |
70 | void setGeometry(const QRect &rect); |
71 | |
72 | protected: |
73 | virtual QRegion doRedraw(); |
74 | |
75 | void initializeCompositor(); |
76 | bool event(QEvent *event) override; |
77 | |
78 | QFbWindow *windowForId(WId wid) const; |
79 | |
80 | QList<QFbWindow *> mWindowStack; |
81 | QRegion mRepaintRegion; |
82 | bool mUpdatePending; |
83 | |
84 | QFbCursor *mCursor; |
85 | QRect mGeometry; |
86 | int mDepth; |
87 | QImage::Format mFormat; |
88 | QSizeF mPhysicalSize; |
89 | QImage mScreenImage; |
90 | |
91 | private: |
92 | QPainter *mPainter; |
93 | QList<QFbBackingStore*> mPendingBackingStores; |
94 | |
95 | friend class QFbWindow; |
96 | }; |
97 | |
98 | Q_DECLARE_OPERATORS_FOR_FLAGS(QFbScreen::Flags) |
99 | |
100 | QT_END_NAMESPACE |
101 | |
102 | #endif // QFBSCREEN_P_H |
103 |