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

source code of qtbase/src/platformsupport/fbconvenience/qfbscreen_p.h