Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
qwaylandabstractdecoration.cpp
Go to the documentation of this file.
1// Copyright (C) 2016 Robin Burchell <robin.burchell@viroteck.net>
2// Copyright (C) 2016 The Qt Company Ltd.
3// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
4
6
7#include <private/qobject_p.h>
12
13#include <QtGui/QImage>
14
16
17namespace QtWaylandClient {
18
20{
21 Q_DECLARE_PUBLIC(QWaylandAbstractDecoration)
22
23public:
26
27 QWindow *m_window = nullptr;
28 QWaylandWindow *m_wayland_window = nullptr;
29
30 bool m_isDirty = true;
32
34};
35
36QWaylandAbstractDecorationPrivate::QWaylandAbstractDecorationPrivate()
37 : m_decorationContentImage(nullptr)
38{
39}
40
44
49
53
54// we do this as a setter to get around plugin factory creates not really
55// being a great way to pass arguments
57{
59
60 // double initialization is probably not great
62
63 d->m_window = window->window();
65}
66
67// Creates regions like this on the outside of a rectangle with inner size \a size
68// -----
69// | |
70// -----
71// I.e. the top and bottom extends into the corners
72static QRegion marginsRegion(const QSize &size, const QMargins &margins)
73{
74 QRegion r;
75
76 r += QRect(0, 0, size.width(), margins.top()); // top
77 r += QRect(0, size.height()-margins.bottom(), size.width(), margins.bottom()); //bottom
78 r += QRect(0, margins.top(), margins.left(), size.height()); //left
79 r += QRect(size.width()-margins.left(), margins.top(), margins.right(), size.height()-margins.top()); // right
80 return r;
81}
82
84{
86 if (d->m_isDirty) {
87 // Update the decoration backingstore
88
92 // Only scale by buffer scale, not QT_SCALE_FACTOR etc.
96
98 for (QRect r : damage)
100
101 d->m_isDirty = false;
102 }
103
105}
106
112
118
127
136
143
149
155
161
163{
165 return d->m_isDirty;
166}
167
173
179
180}
181
182QT_END_NAMESPACE
183
184#include "moc_qwaylandabstractdecoration_p.cpp"
Combined button and popup list for selecting options.
static QRegion marginsRegion(const QSize &size, const QMargins &margins)