kwin/src/wayland/region_interface.cpp
Vlad Zahorodnii 16db81b5cc Make RegionInterface private
If a Wayland protocol deals with regions, they will be exposed as
QRegion objects in public API. Therefore, it makes sense to make
RegionInterface private as it's an implementation detail and it's
not intended to be used in public api.

The corresponding test was dropped because the CompositorInterface
no longer emits a signal to indicate that a wl_region has been created.
It should be also noted that wl_region stuff is already tested via
other means, e.g. surface damage, etc.
2021-03-15 16:28:30 +00:00

48 lines
1.1 KiB
C++

/*
SPDX-FileCopyrightText: 2014 Martin Gräßlin <mgraesslin@kde.org>
SPDX-FileCopyrightText: 2020 Vlad Zahorodnii <vlad.zahorodnii@kde.org>
SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL
*/
#include "region_interface_p.h"
#include "utils.h"
namespace KWaylandServer
{
RegionInterface::RegionInterface(wl_resource *resource)
: QtWaylandServer::wl_region(resource)
{
}
void RegionInterface::region_destroy_resource(Resource *)
{
delete this;
}
void RegionInterface::region_destroy(Resource *resource)
{
wl_resource_destroy(resource->handle);
}
void RegionInterface::region_add(Resource *, int32_t x, int32_t y, int32_t width, int32_t height)
{
m_region += QRegion(x, y, width, height);
}
void RegionInterface::region_subtract(Resource *, int32_t x, int32_t y, int32_t width, int32_t height)
{
m_region -= QRegion(x, y, width, height);
}
QRegion RegionInterface::region() const
{
return m_region;
}
RegionInterface *RegionInterface::get(wl_resource *native)
{
return resource_cast<RegionInterface *>(native);
}
} // namespace KWaylandServer