Qt 6.x
The Qt SDK
Loading...
Searching...
No Matches
qwaylandshmbackingstore_p.h
Go to the documentation of this file.
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 QWAYLANDSHMBACKINGSTORE_H
5#define QWAYLANDSHMBACKINGSTORE_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 <QtWaylandClient/private/qwaylandbuffer_p.h>
19
20#include <qpa/qplatformbackingstore.h>
21#include <QtGui/QImage>
22#include <qpa/qplatformwindow.h>
23#include <QMutex>
24
25#include <list>
26
28
29namespace QtWaylandClient {
30
31class QWaylandDisplay;
32class QWaylandAbstractDecoration;
33class QWaylandWindow;
34
35class Q_WAYLANDCLIENT_EXPORT QWaylandShmBuffer : public QWaylandBuffer {
36public:
39 ~QWaylandShmBuffer() override;
40 QSize size() const override { return mImage.size(); }
41 int scale() const override { return int(mImage.devicePixelRatio()); }
42 QImage *image() { return &mImage; }
43
44 QImage *imageInsideMargins(const QMargins &margins);
45private:
46 QImage mImage;
47 struct wl_shm_pool *mShmPool = nullptr;
48 QMargins mMargins;
49 QImage *mMarginsImage = nullptr;
50};
51
52class Q_WAYLANDCLIENT_EXPORT QWaylandShmBackingStore : public QPlatformBackingStore
53{
54public:
56 ~QWaylandShmBackingStore() override;
57
58 QPaintDevice *paintDevice() override;
59 void flush(QWindow *window, const QRegion &region, const QPoint &offset) override;
60 void resize(const QSize &size, const QRegion &staticContents) override;
61 void resize(const QSize &size);
62 void beginPaint(const QRegion &region) override;
63 void endPaint() override;
64
65 QWaylandAbstractDecoration *windowDecoration() const;
66
67 QMargins windowDecorationMargins() const;
68 QImage *entireSurface() const;
69 QImage *contentSurface() const;
70 void ensureSize();
71
72 QWaylandWindow *waylandWindow() const;
74
75#if QT_CONFIG(opengl)
76 QImage toImage() const override;
77#endif
78
79private:
80 void updateDecorations();
81 QWaylandShmBuffer *getBuffer(const QSize &size);
82
83 QWaylandDisplay *mDisplay = nullptr;
84 std::list<QWaylandShmBuffer *> mBuffers;
85 QWaylandShmBuffer *mFrontBuffer = nullptr;
86 QWaylandShmBuffer *mBackBuffer = nullptr;
87 bool mPainting = false;
88 bool mPendingFlush = false;
89 QRegion mPendingRegion;
90 QMutex mMutex;
91
92 QSize mRequestedSize;
93 Qt::WindowFlags mCurrentWindowFlags;
94};
95
96}
97
99
100#endif
\inmodule QtGui
Definition qimage.h:37
Format
The following image formats are available in Qt.
Definition qimage.h:41
\inmodule QtCore
Definition qmargins.h:23
\inmodule QtCore
Definition qmutex.h:285
The QPlatformBackingStore class provides the drawing area for top-level windows.
\inmodule QtCore\reentrant
Definition qpoint.h:23
The QRegion class specifies a clip region for a painter.
Definition qregion.h:27
\inmodule QtCore
Definition qsize.h:25
\inmodule QtGui
Definition qwindow.h:63
a resize(100000)
struct wl_display * display
Definition linuxdmabuf.h:41
Combined button and popup list for selecting options.
GLenum GLuint GLintptr GLsizeiptr size
[1]
GLenum GLuint GLintptr offset
GLint GLsizei GLsizei GLenum format
GLenum GLenum GLenum GLenum GLenum scale
double qreal
Definition qtypes.h:92
aWidget window() -> setWindowTitle("New Window Title")
[2]