2014-08-28 07:52:35 +00:00
|
|
|
/********************************************************************
|
2014-09-17 13:57:56 +00:00
|
|
|
Copyright 2014 Martin Gräßlin <mgraesslin@kde.org>
|
2014-08-28 07:52:35 +00:00
|
|
|
|
2014-09-17 13:57:56 +00:00
|
|
|
This library is free software; you can redistribute it and/or
|
|
|
|
modify it under the terms of the GNU Lesser General Public
|
|
|
|
License as published by the Free Software Foundation; either
|
|
|
|
version 2.1 of the License, or (at your option) version 3, or any
|
|
|
|
later version accepted by the membership of KDE e.V. (or its
|
|
|
|
successor approved by the membership of KDE e.V.), which shall
|
|
|
|
act as a proxy defined in Section 6 of version 3 of the license.
|
2014-08-28 07:52:35 +00:00
|
|
|
|
2014-09-17 13:57:56 +00:00
|
|
|
This library is distributed in the hope that it will be useful,
|
2014-08-28 07:52:35 +00:00
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
2014-09-17 13:57:56 +00:00
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
Lesser General Public License for more details.
|
2014-08-28 07:52:35 +00:00
|
|
|
|
2014-09-17 13:57:56 +00:00
|
|
|
You should have received a copy of the GNU Lesser General Public
|
|
|
|
License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
2014-08-28 07:52:35 +00:00
|
|
|
*********************************************************************/
|
|
|
|
#include "surface_interface.h"
|
2014-10-14 12:04:35 +00:00
|
|
|
#include "surface_interface_p.h"
|
2014-08-28 12:22:53 +00:00
|
|
|
#include "buffer_interface.h"
|
2014-08-28 07:52:35 +00:00
|
|
|
#include "compositor_interface.h"
|
2014-10-16 12:59:01 +00:00
|
|
|
#include "region_interface.h"
|
2014-10-14 12:04:35 +00:00
|
|
|
#include "subcompositor_interface.h"
|
|
|
|
#include "subsurface_interface_p.h"
|
2014-09-19 05:06:31 +00:00
|
|
|
// Wayland
|
|
|
|
#include <wayland-server.h>
|
2014-10-14 12:04:35 +00:00
|
|
|
// std
|
|
|
|
#include <algorithm>
|
2014-08-28 07:52:35 +00:00
|
|
|
|
2014-09-17 14:10:38 +00:00
|
|
|
namespace KWayland
|
2014-08-28 07:52:35 +00:00
|
|
|
{
|
2014-09-17 14:10:38 +00:00
|
|
|
namespace Server
|
2014-08-28 07:52:35 +00:00
|
|
|
{
|
|
|
|
|
2014-09-19 05:06:31 +00:00
|
|
|
QList<SurfaceInterface::Private*> SurfaceInterface::Private::s_allSurfaces;
|
|
|
|
|
|
|
|
SurfaceInterface::Private::Private(SurfaceInterface *q, CompositorInterface *c)
|
2014-11-14 08:45:02 +00:00
|
|
|
: Resource::Private(c)
|
2014-09-19 05:06:31 +00:00
|
|
|
, q(q)
|
2014-08-28 07:52:35 +00:00
|
|
|
{
|
2014-09-19 05:06:31 +00:00
|
|
|
s_allSurfaces << this;
|
2014-08-28 07:52:35 +00:00
|
|
|
}
|
|
|
|
|
2014-09-19 05:06:31 +00:00
|
|
|
SurfaceInterface::Private::~Private()
|
2014-08-28 07:52:35 +00:00
|
|
|
{
|
|
|
|
destroy();
|
2014-09-19 05:06:31 +00:00
|
|
|
s_allSurfaces.removeAll(this);
|
|
|
|
}
|
|
|
|
|
2014-10-14 12:04:35 +00:00
|
|
|
void SurfaceInterface::Private::addChild(QPointer< SubSurfaceInterface > subSurface)
|
|
|
|
{
|
|
|
|
pending.children.append(subSurface);
|
|
|
|
}
|
|
|
|
|
|
|
|
void SurfaceInterface::Private::removeChild(QPointer< SubSurfaceInterface > subSurface)
|
|
|
|
{
|
|
|
|
pending.children.removeAll(subSurface);
|
|
|
|
}
|
|
|
|
|
|
|
|
bool SurfaceInterface::Private::raiseChild(QPointer<SubSurfaceInterface> subsurface, SurfaceInterface *sibling)
|
|
|
|
{
|
|
|
|
auto it = std::find(pending.children.begin(), pending.children.end(), subsurface);
|
|
|
|
if (it == pending.children.end()) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
if (pending.children.count() == 1) {
|
|
|
|
// nothing to do
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
if (sibling == q) {
|
|
|
|
// it's to the parent, so needs to become last item
|
|
|
|
pending.children.append(*it);
|
|
|
|
pending.children.erase(it);
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
if (!sibling->subSurface()) {
|
|
|
|
// not a sub surface
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
auto siblingIt = std::find(pending.children.begin(), pending.children.end(), sibling->subSurface());
|
|
|
|
if (siblingIt == pending.children.end() || siblingIt == it) {
|
|
|
|
// not a sibling
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
auto value = (*it);
|
|
|
|
pending.children.erase(it);
|
|
|
|
// find the iterator again
|
|
|
|
siblingIt = std::find(pending.children.begin(), pending.children.end(), sibling->subSurface());
|
|
|
|
pending.children.insert(++siblingIt, value);
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool SurfaceInterface::Private::lowerChild(QPointer<SubSurfaceInterface> subsurface, SurfaceInterface *sibling)
|
|
|
|
{
|
|
|
|
auto it = std::find(pending.children.begin(), pending.children.end(), subsurface);
|
|
|
|
if (it == pending.children.end()) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
if (pending.children.count() == 1) {
|
|
|
|
// nothing to do
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
if (sibling == q) {
|
|
|
|
// it's to the parent, so needs to become first item
|
|
|
|
auto value = *it;
|
|
|
|
pending.children.erase(it);
|
|
|
|
pending.children.prepend(value);
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
if (!sibling->subSurface()) {
|
|
|
|
// not a sub surface
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
auto siblingIt = std::find(pending.children.begin(), pending.children.end(), sibling->subSurface());
|
|
|
|
if (siblingIt == pending.children.end() || siblingIt == it) {
|
|
|
|
// not a sibling
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
auto value = (*it);
|
|
|
|
pending.children.erase(it);
|
|
|
|
// find the iterator again
|
|
|
|
siblingIt = std::find(pending.children.begin(), pending.children.end(), sibling->subSurface());
|
|
|
|
pending.children.insert(siblingIt, value);
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2014-09-19 05:06:31 +00:00
|
|
|
SurfaceInterface *SurfaceInterface::Private::get(wl_resource *native)
|
|
|
|
{
|
|
|
|
auto it = std::find_if(s_allSurfaces.constBegin(), s_allSurfaces.constEnd(), [native](Private *s) {
|
2014-11-14 08:45:02 +00:00
|
|
|
return s->resource == native;
|
2014-09-19 05:06:31 +00:00
|
|
|
});
|
|
|
|
if (it == s_allSurfaces.constEnd()) {
|
|
|
|
return nullptr;
|
|
|
|
}
|
|
|
|
return (*it)->q;
|
|
|
|
}
|
|
|
|
|
|
|
|
const struct wl_surface_interface SurfaceInterface::Private::s_interface = {
|
|
|
|
destroyCallback,
|
|
|
|
attachCallback,
|
|
|
|
damageCallback,
|
|
|
|
frameCallaback,
|
|
|
|
opaqueRegionCallback,
|
|
|
|
inputRegionCallback,
|
|
|
|
commitCallback,
|
|
|
|
bufferTransformCallback,
|
|
|
|
bufferScaleCallback
|
|
|
|
};
|
|
|
|
|
|
|
|
SurfaceInterface::SurfaceInterface(CompositorInterface *parent)
|
2014-11-14 08:45:02 +00:00
|
|
|
: Resource(new Private(this, parent))
|
2014-09-19 05:06:31 +00:00
|
|
|
{
|
2014-08-28 07:52:35 +00:00
|
|
|
}
|
|
|
|
|
2014-09-19 05:06:31 +00:00
|
|
|
SurfaceInterface::~SurfaceInterface() = default;
|
|
|
|
|
|
|
|
void SurfaceInterface::Private::create(wl_client *c, quint32 version, quint32 id)
|
|
|
|
{
|
2014-11-14 08:45:02 +00:00
|
|
|
Q_ASSERT(!resource);
|
2014-09-19 05:06:31 +00:00
|
|
|
Q_ASSERT(!client);
|
|
|
|
client = c;
|
2014-11-14 08:45:02 +00:00
|
|
|
resource = wl_resource_create(client, &wl_surface_interface, version, id);
|
|
|
|
if (!resource) {
|
2014-08-28 07:52:35 +00:00
|
|
|
return;
|
|
|
|
}
|
2014-11-14 08:45:02 +00:00
|
|
|
wl_resource_set_implementation(resource, &s_interface, this, unbind);
|
2014-08-28 07:52:35 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void SurfaceInterface::frameRendered(quint32 msec)
|
|
|
|
{
|
2014-11-14 08:45:02 +00:00
|
|
|
Q_D();
|
2014-08-28 07:52:35 +00:00
|
|
|
// notify all callbacks
|
2014-09-19 05:06:31 +00:00
|
|
|
while (!d->current.callbacks.isEmpty()) {
|
|
|
|
wl_resource *r = d->current.callbacks.takeFirst();
|
2014-08-28 07:52:35 +00:00
|
|
|
wl_callback_send_done(r, msec);
|
|
|
|
wl_resource_destroy(r);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-09-19 05:06:31 +00:00
|
|
|
void SurfaceInterface::Private::unbind(wl_resource *r)
|
2014-08-28 07:52:35 +00:00
|
|
|
{
|
2014-11-14 09:20:43 +00:00
|
|
|
auto s = cast<Private>(r);
|
2014-11-14 08:45:02 +00:00
|
|
|
s->resource = nullptr;
|
2014-09-19 05:06:31 +00:00
|
|
|
s->q->deleteLater();
|
2014-08-28 07:52:35 +00:00
|
|
|
}
|
|
|
|
|
2014-09-19 05:06:31 +00:00
|
|
|
void SurfaceInterface::Private::destroy()
|
2014-08-28 07:52:35 +00:00
|
|
|
{
|
2014-09-19 05:06:31 +00:00
|
|
|
for (wl_resource *c : current.callbacks) {
|
2014-08-28 07:52:35 +00:00
|
|
|
wl_resource_destroy(c);
|
|
|
|
}
|
2014-09-19 05:06:31 +00:00
|
|
|
for (wl_resource *c : pending.callbacks) {
|
2014-08-28 07:52:35 +00:00
|
|
|
wl_resource_destroy(c);
|
|
|
|
}
|
2014-09-19 05:06:31 +00:00
|
|
|
if (current.buffer) {
|
|
|
|
current.buffer->unref();
|
2014-08-28 12:22:53 +00:00
|
|
|
}
|
2014-11-14 08:45:02 +00:00
|
|
|
if (resource) {
|
|
|
|
wl_resource_destroy(resource);
|
|
|
|
resource = nullptr;
|
2014-08-28 07:52:35 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-09-19 05:06:31 +00:00
|
|
|
void SurfaceInterface::Private::commit()
|
2014-08-28 07:52:35 +00:00
|
|
|
{
|
2014-09-19 05:06:31 +00:00
|
|
|
for (wl_resource *c : current.callbacks) {
|
2014-08-28 07:52:35 +00:00
|
|
|
wl_resource_destroy(c);
|
|
|
|
}
|
2014-10-16 12:59:01 +00:00
|
|
|
const bool opaqueRegionChanged = pending.opaqueIsSet;
|
|
|
|
const bool inputRegionChanged = pending.inputIsSet;
|
2014-09-19 05:06:31 +00:00
|
|
|
const bool scaleFactorChanged = current.scale != pending.scale;
|
|
|
|
const bool transformFactorChanged = current.transform != pending.transform;
|
|
|
|
if (current.buffer) {
|
|
|
|
current.buffer->unref();
|
2014-08-28 12:22:53 +00:00
|
|
|
}
|
2014-09-19 05:06:31 +00:00
|
|
|
if (pending.buffer) {
|
|
|
|
pending.buffer->ref();
|
2014-08-28 12:22:53 +00:00
|
|
|
}
|
2014-08-28 07:52:35 +00:00
|
|
|
// copy values
|
2014-09-19 05:06:31 +00:00
|
|
|
current = pending;
|
|
|
|
pending = State{};
|
2014-10-14 12:04:35 +00:00
|
|
|
pending.children = current.children;
|
2014-10-16 12:59:01 +00:00
|
|
|
pending.input = current.input;
|
|
|
|
pending.inputIsInfinite = current.inputIsInfinite;
|
|
|
|
pending.opaque = current.opaque;
|
2014-10-14 12:04:35 +00:00
|
|
|
// commit all subSurfaces to apply position changes
|
|
|
|
for (auto it = current.children.constBegin(); it != current.children.constEnd(); ++it) {
|
|
|
|
if (!(*it)) {
|
|
|
|
continue;
|
|
|
|
}
|
2014-11-14 08:45:02 +00:00
|
|
|
(*it)->d_func()->commit();
|
2014-10-14 12:04:35 +00:00
|
|
|
}
|
2014-08-28 07:52:35 +00:00
|
|
|
if (opaqueRegionChanged) {
|
2014-09-19 05:06:31 +00:00
|
|
|
emit q->opaqueChanged(current.opaque);
|
2014-08-28 07:52:35 +00:00
|
|
|
}
|
|
|
|
if (inputRegionChanged) {
|
2014-09-19 05:06:31 +00:00
|
|
|
emit q->inputChanged(current.input);
|
2014-08-28 07:52:35 +00:00
|
|
|
}
|
|
|
|
if (scaleFactorChanged) {
|
2014-09-19 05:06:31 +00:00
|
|
|
emit q->scaleChanged(current.scale);
|
2014-08-28 07:52:35 +00:00
|
|
|
}
|
|
|
|
if (transformFactorChanged) {
|
2014-09-19 05:06:31 +00:00
|
|
|
emit q->transformChanged(current.transform);
|
2014-08-28 07:52:35 +00:00
|
|
|
}
|
2014-09-19 05:06:31 +00:00
|
|
|
if (!current.damage.isEmpty()) {
|
|
|
|
emit q->damaged(current.damage);
|
2014-08-28 07:52:35 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-09-19 05:06:31 +00:00
|
|
|
void SurfaceInterface::Private::damage(const QRect &rect)
|
2014-08-28 07:52:35 +00:00
|
|
|
{
|
|
|
|
// TODO: documentation says we need to remove the parts outside of the surface
|
2014-09-19 05:06:31 +00:00
|
|
|
pending.damage = pending.damage.united(rect);
|
2014-08-28 07:52:35 +00:00
|
|
|
}
|
|
|
|
|
2014-09-19 05:06:31 +00:00
|
|
|
void SurfaceInterface::Private::setScale(qint32 scale)
|
2014-08-28 07:52:35 +00:00
|
|
|
{
|
2014-09-19 05:06:31 +00:00
|
|
|
pending.scale = scale;
|
2014-08-28 07:52:35 +00:00
|
|
|
}
|
|
|
|
|
2014-09-19 05:06:31 +00:00
|
|
|
void SurfaceInterface::Private::setTransform(OutputInterface::Transform transform)
|
2014-08-28 07:52:35 +00:00
|
|
|
{
|
2014-09-19 05:06:31 +00:00
|
|
|
pending.transform = transform;
|
2014-08-28 07:52:35 +00:00
|
|
|
}
|
|
|
|
|
2014-09-19 05:06:31 +00:00
|
|
|
void SurfaceInterface::Private::addFrameCallback(uint32_t callback)
|
2014-08-28 07:52:35 +00:00
|
|
|
{
|
2014-09-19 05:06:31 +00:00
|
|
|
wl_resource *r = wl_resource_create(client, &wl_callback_interface, 1, callback);
|
2014-08-28 07:52:35 +00:00
|
|
|
if (!r) {
|
2014-11-14 08:45:02 +00:00
|
|
|
wl_resource_post_no_memory(resource);
|
2014-08-28 07:52:35 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
wl_resource_set_implementation(r, nullptr, this, destroyFrameCallback);
|
2014-09-19 05:06:31 +00:00
|
|
|
pending.callbacks << r;
|
2014-08-28 07:52:35 +00:00
|
|
|
}
|
|
|
|
|
2014-09-19 05:06:31 +00:00
|
|
|
void SurfaceInterface::Private::attachBuffer(wl_resource *buffer, const QPoint &offset)
|
2014-08-28 12:22:53 +00:00
|
|
|
{
|
2014-09-19 05:06:31 +00:00
|
|
|
pending.offset = offset;
|
|
|
|
if (pending.buffer) {
|
|
|
|
delete pending.buffer;
|
2014-08-28 12:22:53 +00:00
|
|
|
}
|
2014-09-19 05:06:31 +00:00
|
|
|
pending.buffer = new BufferInterface(buffer, q);
|
2014-11-07 08:04:19 +00:00
|
|
|
QObject::connect(pending.buffer, &BufferInterface::aboutToBeDestroyed, q,
|
|
|
|
[this](BufferInterface *buffer) {
|
|
|
|
if (pending.buffer == buffer) {
|
|
|
|
pending.buffer = nullptr;
|
|
|
|
}
|
|
|
|
if (current.buffer == buffer) {
|
|
|
|
current.buffer->unref();
|
|
|
|
current.buffer = nullptr;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
);
|
2014-08-28 12:22:53 +00:00
|
|
|
}
|
|
|
|
|
2014-09-19 05:06:31 +00:00
|
|
|
void SurfaceInterface::Private::destroyFrameCallback(wl_resource *r)
|
2014-08-28 07:52:35 +00:00
|
|
|
{
|
2014-11-14 09:20:43 +00:00
|
|
|
auto s = cast<Private>(r);
|
2014-09-19 05:06:31 +00:00
|
|
|
s->current.callbacks.removeAll(r);
|
|
|
|
s->pending.callbacks.removeAll(r);
|
2014-08-28 07:52:35 +00:00
|
|
|
}
|
|
|
|
|
2014-09-19 05:06:31 +00:00
|
|
|
void SurfaceInterface::Private::destroyCallback(wl_client *client, wl_resource *resource)
|
2014-08-28 07:52:35 +00:00
|
|
|
{
|
|
|
|
Q_UNUSED(client)
|
2014-11-14 09:20:43 +00:00
|
|
|
cast<Private>(resource)->q->deleteLater();
|
2014-08-28 07:52:35 +00:00
|
|
|
}
|
|
|
|
|
2014-09-19 05:06:31 +00:00
|
|
|
void SurfaceInterface::Private::attachCallback(wl_client *client, wl_resource *resource, wl_resource *buffer, int32_t sx, int32_t sy)
|
2014-08-28 07:52:35 +00:00
|
|
|
{
|
|
|
|
Q_UNUSED(client)
|
2014-11-14 09:20:43 +00:00
|
|
|
cast<Private>(resource)->attachBuffer(buffer, QPoint(sx, sy));
|
2014-08-28 07:52:35 +00:00
|
|
|
}
|
|
|
|
|
2014-09-19 05:06:31 +00:00
|
|
|
void SurfaceInterface::Private::damageCallback(wl_client *client, wl_resource *resource, int32_t x, int32_t y, int32_t width, int32_t height)
|
2014-08-28 07:52:35 +00:00
|
|
|
{
|
|
|
|
Q_UNUSED(client)
|
2014-11-14 09:20:43 +00:00
|
|
|
cast<Private>(resource)->damage(QRect(x, y, width, height));
|
2014-08-28 07:52:35 +00:00
|
|
|
}
|
|
|
|
|
2014-09-19 05:06:31 +00:00
|
|
|
void SurfaceInterface::Private::frameCallaback(wl_client *client, wl_resource *resource, uint32_t callback)
|
2014-08-28 07:52:35 +00:00
|
|
|
{
|
2014-11-14 09:20:43 +00:00
|
|
|
auto s = cast<Private>(resource);
|
2014-09-19 05:06:31 +00:00
|
|
|
Q_ASSERT(client == s->client);
|
2014-08-28 07:52:35 +00:00
|
|
|
s->addFrameCallback(callback);
|
|
|
|
}
|
|
|
|
|
2014-09-19 05:06:31 +00:00
|
|
|
void SurfaceInterface::Private::opaqueRegionCallback(wl_client *client, wl_resource *resource, wl_resource *region)
|
2014-08-28 07:52:35 +00:00
|
|
|
{
|
2014-11-14 09:20:43 +00:00
|
|
|
auto s = cast<Private>(resource);
|
2014-10-16 12:59:01 +00:00
|
|
|
Q_ASSERT(client == s->client);
|
|
|
|
auto r = RegionInterface::get(region);
|
|
|
|
s->setOpaque(r ? r->region() : QRegion());
|
|
|
|
}
|
|
|
|
|
|
|
|
void SurfaceInterface::Private::setOpaque(const QRegion ®ion)
|
|
|
|
{
|
|
|
|
pending.opaqueIsSet = true;
|
|
|
|
pending.opaque = region;
|
2014-08-28 07:52:35 +00:00
|
|
|
}
|
|
|
|
|
2014-09-19 05:06:31 +00:00
|
|
|
void SurfaceInterface::Private::inputRegionCallback(wl_client *client, wl_resource *resource, wl_resource *region)
|
2014-08-28 07:52:35 +00:00
|
|
|
{
|
2014-11-14 09:20:43 +00:00
|
|
|
auto s = cast<Private>(resource);
|
2014-10-16 12:59:01 +00:00
|
|
|
Q_ASSERT(client == s->client);
|
|
|
|
auto r = RegionInterface::get(region);
|
|
|
|
s->setInput(r ? r->region() : QRegion(), !r);
|
|
|
|
}
|
|
|
|
|
|
|
|
void SurfaceInterface::Private::setInput(const QRegion ®ion, bool isInfinite)
|
|
|
|
{
|
|
|
|
pending.inputIsSet = true;
|
|
|
|
pending.inputIsInfinite = isInfinite;
|
|
|
|
pending.input = region;
|
2014-08-28 07:52:35 +00:00
|
|
|
}
|
|
|
|
|
2014-09-19 05:06:31 +00:00
|
|
|
void SurfaceInterface::Private::commitCallback(wl_client *client, wl_resource *resource)
|
2014-08-28 07:52:35 +00:00
|
|
|
{
|
|
|
|
Q_UNUSED(client)
|
2014-11-14 09:20:43 +00:00
|
|
|
cast<Private>(resource)->commit();
|
2014-08-28 07:52:35 +00:00
|
|
|
}
|
|
|
|
|
2014-09-19 05:06:31 +00:00
|
|
|
void SurfaceInterface::Private::bufferTransformCallback(wl_client *client, wl_resource *resource, int32_t transform)
|
2014-08-28 07:52:35 +00:00
|
|
|
{
|
|
|
|
Q_UNUSED(client)
|
2014-11-14 09:20:43 +00:00
|
|
|
cast<Private>(resource)->setTransform(OutputInterface::Transform(transform));
|
2014-08-28 07:52:35 +00:00
|
|
|
}
|
|
|
|
|
2014-09-19 05:06:31 +00:00
|
|
|
void SurfaceInterface::Private::bufferScaleCallback(wl_client *client, wl_resource *resource, int32_t scale)
|
2014-08-28 07:52:35 +00:00
|
|
|
{
|
|
|
|
Q_UNUSED(client)
|
2014-11-14 09:20:43 +00:00
|
|
|
cast<Private>(resource)->setScale(scale);
|
2014-09-19 05:06:31 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
QRegion SurfaceInterface::damage() const
|
|
|
|
{
|
2014-11-14 08:45:02 +00:00
|
|
|
Q_D();
|
2014-09-19 05:06:31 +00:00
|
|
|
return d->current.damage;
|
|
|
|
}
|
|
|
|
|
|
|
|
QRegion SurfaceInterface::opaque() const
|
|
|
|
{
|
2014-11-14 08:45:02 +00:00
|
|
|
Q_D();
|
2014-09-19 05:06:31 +00:00
|
|
|
return d->current.opaque;
|
|
|
|
}
|
|
|
|
|
|
|
|
QRegion SurfaceInterface::input() const
|
|
|
|
{
|
2014-11-14 08:45:02 +00:00
|
|
|
Q_D();
|
2014-09-19 05:06:31 +00:00
|
|
|
return d->current.input;
|
|
|
|
}
|
|
|
|
|
2014-10-16 12:59:01 +00:00
|
|
|
bool SurfaceInterface::inputIsInfitine() const
|
|
|
|
{
|
2014-11-14 08:45:02 +00:00
|
|
|
Q_D();
|
2014-10-16 12:59:01 +00:00
|
|
|
return d->current.inputIsInfinite;
|
|
|
|
}
|
|
|
|
|
2014-09-19 05:06:31 +00:00
|
|
|
qint32 SurfaceInterface::scale() const
|
|
|
|
{
|
2014-11-14 08:45:02 +00:00
|
|
|
Q_D();
|
2014-09-19 05:06:31 +00:00
|
|
|
return d->current.scale;
|
|
|
|
}
|
|
|
|
|
|
|
|
OutputInterface::Transform SurfaceInterface::transform() const
|
|
|
|
{
|
2014-11-14 08:45:02 +00:00
|
|
|
Q_D();
|
2014-09-19 05:06:31 +00:00
|
|
|
return d->current.transform;
|
|
|
|
}
|
|
|
|
|
|
|
|
BufferInterface *SurfaceInterface::buffer()
|
|
|
|
{
|
2014-11-14 08:45:02 +00:00
|
|
|
Q_D();
|
2014-09-19 05:06:31 +00:00
|
|
|
return d->current.buffer;
|
|
|
|
}
|
|
|
|
|
|
|
|
QPoint SurfaceInterface::offset() const
|
|
|
|
{
|
2014-11-14 08:45:02 +00:00
|
|
|
Q_D();
|
2014-09-19 05:06:31 +00:00
|
|
|
return d->current.offset;
|
|
|
|
}
|
|
|
|
|
|
|
|
SurfaceInterface *SurfaceInterface::get(wl_resource *native)
|
|
|
|
{
|
|
|
|
return Private::get(native);
|
2014-08-28 07:52:35 +00:00
|
|
|
}
|
|
|
|
|
2014-10-14 12:04:35 +00:00
|
|
|
QList< QPointer< SubSurfaceInterface > > SurfaceInterface::childSubSurfaces() const
|
|
|
|
{
|
2014-11-14 08:45:02 +00:00
|
|
|
Q_D();
|
2014-10-14 12:04:35 +00:00
|
|
|
return d->current.children;
|
|
|
|
}
|
|
|
|
|
|
|
|
QPointer< SubSurfaceInterface > SurfaceInterface::subSurface() const
|
|
|
|
{
|
2014-11-14 08:45:02 +00:00
|
|
|
Q_D();
|
2014-10-14 12:04:35 +00:00
|
|
|
return d->subSurface;
|
|
|
|
}
|
|
|
|
|
2014-11-14 08:45:02 +00:00
|
|
|
SurfaceInterface::Private *SurfaceInterface::d_func() const
|
|
|
|
{
|
|
|
|
return reinterpret_cast<Private*>(d.data());
|
|
|
|
}
|
|
|
|
|
2014-08-28 07:52:35 +00:00
|
|
|
}
|
|
|
|
}
|