2020-03-15 15:19:28 +00:00
|
|
|
/*
|
|
|
|
SPDX-FileCopyrightText: 2019 Vlad Zahorodnii <vlad.zahorodnii@kde.org>
|
2019-09-05 10:57:35 +00:00
|
|
|
|
2020-03-15 15:19:28 +00:00
|
|
|
SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL
|
|
|
|
*/
|
2019-09-05 10:57:35 +00:00
|
|
|
|
|
|
|
#include "surfacerole_p.h"
|
|
|
|
#include "surface_interface_p.h"
|
|
|
|
#include "surface_interface.h"
|
|
|
|
|
2020-04-29 14:56:38 +00:00
|
|
|
namespace KWaylandServer
|
2019-09-05 10:57:35 +00:00
|
|
|
{
|
|
|
|
|
|
|
|
SurfaceRole::SurfaceRole(SurfaceInterface *surface)
|
|
|
|
: m_surface(surface)
|
|
|
|
{
|
|
|
|
m_surface->d_func()->role = this;
|
|
|
|
}
|
|
|
|
|
|
|
|
SurfaceRole::~SurfaceRole()
|
|
|
|
{
|
|
|
|
// Lifetime of the surface role is not bounded to the associated surface.
|
|
|
|
if (m_surface) {
|
|
|
|
m_surface->d_func()->role = nullptr;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-05-04 13:32:23 +00:00
|
|
|
SurfaceRole *SurfaceRole::get(SurfaceInterface *surface)
|
|
|
|
{
|
|
|
|
if (surface) {
|
|
|
|
return surface->d_func()->role;
|
|
|
|
}
|
|
|
|
|
|
|
|
return nullptr;
|
|
|
|
}
|
|
|
|
|
2019-09-05 10:57:35 +00:00
|
|
|
}
|