Changeset View
Changeset View
Standalone View
Standalone View
src/server/surfacerole.cpp
1 | /* | 1 | /* | ||
---|---|---|---|---|---|
2 | SPDX-FileCopyrightText: 2019 Vlad Zahorodnii <vlad.zahorodnii@kde.org> | 2 | SPDX-FileCopyrightText: 2019 Vlad Zahorodnii <vlad.zahorodnii@kde.org> | ||
3 | 3 | | |||
4 | SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL | 4 | SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL | ||
5 | */ | 5 | */ | ||
6 | 6 | | |||
7 | #include "surfacerole_p.h" | 7 | #include "surfacerole_p.h" | ||
8 | #include "surface_interface_p.h" | 8 | #include "surface_interface_p.h" | ||
9 | #include "surface_interface.h" | 9 | #include "surface_interface.h" | ||
10 | 10 | | |||
11 | namespace KWayland | 11 | namespace KWayland | ||
12 | { | 12 | { | ||
13 | namespace Server | 13 | namespace Server | ||
14 | { | 14 | { | ||
15 | 15 | | |||
16 | SurfaceRole::SurfaceRole() | ||||
17 | { | ||||
18 | } | ||||
19 | | ||||
16 | SurfaceRole::SurfaceRole(SurfaceInterface *surface) | 20 | SurfaceRole::SurfaceRole(SurfaceInterface *surface) | ||
17 | : m_surface(surface) | 21 | : m_surface(surface) | ||
18 | { | 22 | { | ||
19 | m_surface->d_func()->role = this; | 23 | m_surface->d_func()->role = this; | ||
20 | } | 24 | } | ||
21 | 25 | | |||
22 | SurfaceRole::~SurfaceRole() | 26 | SurfaceRole::~SurfaceRole() | ||
23 | { | 27 | { | ||
24 | // Lifetime of the surface role is not bounded to the associated surface. | 28 | // Lifetime of the surface role is not bounded to the associated surface. | ||
25 | if (m_surface) { | 29 | if (m_surface) { | ||
26 | m_surface->d_func()->role = nullptr; | 30 | m_surface->d_func()->role = nullptr; | ||
27 | } | 31 | } | ||
28 | } | 32 | } | ||
29 | 33 | | |||
34 | void SurfaceRole::setSurface(SurfaceInterface *surface) | ||||
35 | { | ||||
36 | m_surface = surface; | ||||
37 | if (m_surface) { | ||||
38 | m_surface->d_func()->role = this; | ||||
39 | } | ||||
40 | } | ||||
41 | | ||||
30 | } | 42 | } | ||
31 | } | 43 | } |