Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Toggle main menu visibility
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
6
#
include
"qwaylandabstractdecoration_p.h"
7
8
#
include
<
private
/
qobject_p
.
h
>
9
#
include
"qwaylandwindow_p.h"
10
#
include
"qwaylandshellsurface_p.h"
11
#
include
"qwaylandinputdevice_p.h"
12
#
include
"qwaylandscreen_p.h"
13
14
#
include
<
QtGui
/
QImage
>
15
16
QT_BEGIN_NAMESPACE
17
18
namespace
QtWaylandClient
{
19
20
class
QWaylandAbstractDecorationPrivate
:
public
QObjectPrivate
21
{
22
Q_DECLARE_PUBLIC(QWaylandAbstractDecoration)
23
24
public
:
25
QWaylandAbstractDecorationPrivate
();
26
~
QWaylandAbstractDecorationPrivate
()
override
;
27
28
QWindow *
m_window
=
nullptr
;
29
QWaylandWindow *
m_wayland_window
=
nullptr
;
30
31
bool
m_isDirty
=
true
;
32
QImage
m_decorationContentImage
;
33
34
Qt
::
MouseButtons
m_mouseButtons
=
Qt
::
NoButton
;
35
};
36
37
QWaylandAbstractDecorationPrivate
::QWaylandAbstractDecorationPrivate()
38
: m_decorationContentImage(
nullptr
)
39
{
40
}
41
42
QWaylandAbstractDecorationPrivate
::~
QWaylandAbstractDecorationPrivate
()
43
{
44
}
45
46
QWaylandAbstractDecoration
::
QWaylandAbstractDecoration
(
QObject
*
parent
)
47
:
QObject
(*
new
QWaylandAbstractDecorationPrivate
,
parent
)
48
{
49
}
50
51
QWaylandAbstractDecoration
::~
QWaylandAbstractDecoration
()
52
{
53
}
54
55
// we do this as a setter to get around plugin factory creates not really
56
// being a great way to pass arguments
57
void
QWaylandAbstractDecoration
::
setWaylandWindow
(
QWaylandWindow
*
window
)
58
{
59
Q_D
(
QWaylandAbstractDecoration
);
60
61
// double initialization is probably not great
62
Q_ASSERT
(!
d
->
m_window
&& !
d
->
m_wayland_window
);
63
64
d
->
m_window
=
window
->
window
();
65
d
->
m_wayland_window
=
window
;
66
}
67
68
void
QWaylandAbstractDecoration
::
update
()
69
{
70
Q_D
(
QWaylandAbstractDecoration
);
71
d
->
m_isDirty
=
true
;
72
}
73
74
void
QWaylandAbstractDecoration
::
setMouseButtons
(
Qt
::
MouseButtons
mb
)
75
{
76
Q_D
(
QWaylandAbstractDecoration
);
77
d
->
m_mouseButtons
=
mb
;
78
}
79
80
void
QWaylandAbstractDecoration
::
startResize
(
QWaylandInputDevice
*
inputDevice
,
Qt
::
Edges
edges
,
Qt
::
MouseButtons
buttons
)
81
{
82
Q_D
(
QWaylandAbstractDecoration
);
83
if
(
isLeftClicked
(
buttons
) &&
d
->
m_wayland_window
->
shellSurface
()) {
84
d
->
m_wayland_window
->
shellSurface
()->
resize
(
inputDevice
,
edges
);
85
inputDevice
->
removeMouseButtonFromState
(
Qt
::
LeftButton
);
86
}
87
}
88
89
void
QWaylandAbstractDecoration
::
startMove
(
QWaylandInputDevice
*
inputDevice
,
Qt
::
MouseButtons
buttons
)
90
{
91
Q_D
(
QWaylandAbstractDecoration
);
92
if
(
isLeftClicked
(
buttons
) &&
d
->
m_wayland_window
->
shellSurface
()) {
93
d
->
m_wayland_window
->
shellSurface
()->
move
(
inputDevice
);
94
inputDevice
->
removeMouseButtonFromState
(
Qt
::
LeftButton
);
95
}
96
}
97
98
void
QWaylandAbstractDecoration
::
showWindowMenu
(
QWaylandInputDevice
*
inputDevice
)
99
{
100
Q_D
(
QWaylandAbstractDecoration
);
101
if
(
auto
*
s
=
d
->
m_wayland_window
->
shellSurface
())
102
s
->
showWindowMenu
(
inputDevice
);
103
}
104
105
bool
QWaylandAbstractDecoration
::
isLeftClicked
(
Qt
::
MouseButtons
newMouseButtonState
)
106
{
107
Q_D
(
QWaylandAbstractDecoration
);
108
return
!(
d
->
m_mouseButtons
&
Qt
::
LeftButton
) && (
newMouseButtonState
&
Qt
::
LeftButton
);
109
}
110
111
bool
QWaylandAbstractDecoration
::
isRightClicked
(
Qt
::
MouseButtons
newMouseButtonState
)
112
{
113
Q_D
(
QWaylandAbstractDecoration
);
114
return
!(
d
->
m_mouseButtons
&
Qt
::
RightButton
) && (
newMouseButtonState
&
Qt
::
RightButton
);
115
}
116
117
bool
QWaylandAbstractDecoration
::
isLeftReleased
(
Qt
::
MouseButtons
newMouseButtonState
)
118
{
119
Q_D
(
QWaylandAbstractDecoration
);
120
return
(
d
->
m_mouseButtons
&
Qt
::
LeftButton
) && !(
newMouseButtonState
&
Qt
::
LeftButton
);
121
}
122
123
bool
QWaylandAbstractDecoration
::
isDirty
()
const
124
{
125
Q_D
(
const
QWaylandAbstractDecoration
);
126
return
d
->
m_isDirty
;
127
}
128
129
void
QWaylandAbstractDecoration
::
resetDirty
()
130
{
131
Q_D
(
QWaylandAbstractDecoration
);
132
d
->
m_isDirty
=
false
;
133
}
134
135
QWindow
*
QWaylandAbstractDecoration
::
window
()
const
136
{
137
Q_D
(
const
QWaylandAbstractDecoration
);
138
return
d
->
m_window
;
139
}
140
141
QWaylandWindow
*
QWaylandAbstractDecoration
::
waylandWindow
()
const
142
{
143
Q_D
(
const
QWaylandAbstractDecoration
);
144
return
d
->
m_wayland_window
;
145
}
146
147
}
148
149
QT_END_NAMESPACE
150
151
#
include
"moc_qwaylandabstractdecoration_p.cpp"
QtWaylandClient::QWaylandAbstractDecorationPrivate
Definition
qwaylandabstractdecoration.cpp:21
QtWaylandClient::QWaylandAbstractDecorationPrivate::m_isDirty
bool m_isDirty
Definition
qwaylandabstractdecoration.cpp:31
QtWaylandClient::QWaylandAbstractDecorationPrivate::m_wayland_window
QWaylandWindow * m_wayland_window
Definition
qwaylandabstractdecoration.cpp:29
QtWaylandClient::QWaylandAbstractDecorationPrivate::m_mouseButtons
Qt::MouseButtons m_mouseButtons
Definition
qwaylandabstractdecoration.cpp:34
QtWaylandClient::QWaylandAbstractDecorationPrivate::~QWaylandAbstractDecorationPrivate
~QWaylandAbstractDecorationPrivate() override
Definition
qwaylandabstractdecoration.cpp:42
QtWaylandClient::QWaylandAbstractDecorationPrivate::m_window
QWindow * m_window
Definition
qwaylandabstractdecoration.cpp:28
QtWaylandClient::QWaylandAbstractDecorationPrivate::m_decorationContentImage
QImage m_decorationContentImage
Definition
qwaylandabstractdecoration.cpp:32
QT_BEGIN_NAMESPACE
Combined button and popup list for selecting options.
Definition
qsequentialanimationgroup.cpp:47
QtWaylandClient
Definition
qwaylandclientextension.h:16
qtbase
src
plugins
platforms
wayland
qwaylandabstractdecoration.cpp
Generated on
for Qt by
1.18.0