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// Qt-Security score:significant reason:default
5
7
8#include <private/qobject_p.h>
13
14#include <QtGui/QImage>
15
17
18namespace QtWaylandClient {
19
21{
22 Q_DECLARE_PUBLIC(QWaylandAbstractDecoration)
23
24public:
27
28 QWindow *m_window = nullptr;
29 QWaylandWindow *m_wayland_window = nullptr;
30
31 bool m_isDirty = true;
33
35};
36
37QWaylandAbstractDecorationPrivate::QWaylandAbstractDecorationPrivate()
38 : m_decorationContentImage(nullptr)
39{
40}
41
45
50
54
55// we do this as a setter to get around plugin factory creates not really
56// being a great way to pass arguments
58{
60
61 // double initialization is probably not great
63
64 d->m_window = window->window();
66}
67
68// Creates regions like this on the outside of a rectangle with inner size \a size
69// -----
70// | |
71// -----
72// I.e. the top and bottom extends into the corners
73static QRegion marginsRegion(const QSize &size, const QMargins &margins)
74{
75 QRegion r;
76
77 r += QRect(0, 0, size.width(), margins.top()); // top
78 r += QRect(0, size.height()-margins.bottom(), size.width(), margins.bottom()); //bottom
79 r += QRect(0, margins.top(), margins.left(), size.height()); //left
80 r += QRect(size.width()-margins.left(), margins.top(), margins.right(), size.height()-margins.top()); // right
81 return r;
82}
83
85{
87 if (d->m_isDirty) {
88 // Update the decoration backingstore
89
93 // Only scale by buffer scale, not QT_SCALE_FACTOR etc.
97
99 for (QRect r : damage)
101
102 d->m_isDirty = false;
103 }
104
106}
107
113
119
128
137
144
150
156
162
164{
166 return d->m_isDirty;
167}
168
174
180
181}
182
183QT_END_NAMESPACE
184
185#include "moc_qwaylandabstractdecoration_p.cpp"
Combined button and popup list for selecting options.
static QRegion marginsRegion(const QSize &size, const QMargins &margins)