2014-10-14 12:04:35 +00:00
|
|
|
/********************************************************************
|
|
|
|
Copyright 2014 Martin Gräßlin <mgraesslin@kde.org>
|
|
|
|
|
|
|
|
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.
|
|
|
|
|
|
|
|
This library is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
Lesser General Public License for more details.
|
|
|
|
|
|
|
|
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/>.
|
|
|
|
*********************************************************************/
|
|
|
|
#ifndef WAYLAND_SERVER_SURFACE_INTERFACE_P_H
|
|
|
|
#define WAYLAND_SERVER_SURFACE_INTERFACE_P_H
|
|
|
|
|
|
|
|
#include "surface_interface.h"
|
2014-11-14 08:45:02 +00:00
|
|
|
#include "resource_p.h"
|
2014-10-14 12:04:35 +00:00
|
|
|
// Wayland
|
|
|
|
#include <wayland-server.h>
|
|
|
|
|
|
|
|
namespace KWayland
|
|
|
|
{
|
|
|
|
namespace Server
|
|
|
|
{
|
|
|
|
|
2014-11-14 08:45:02 +00:00
|
|
|
class SurfaceInterface::Private : public Resource::Private
|
2014-10-14 12:04:35 +00:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
struct State {
|
|
|
|
QRegion damage = QRegion();
|
|
|
|
QRegion opaque = QRegion();
|
|
|
|
QRegion input = QRegion();
|
2014-10-16 12:59:01 +00:00
|
|
|
bool inputIsSet = false;
|
|
|
|
bool opaqueIsSet = false;
|
2014-11-28 07:33:32 +00:00
|
|
|
bool bufferIsSet = false;
|
2015-07-15 09:07:50 +00:00
|
|
|
bool shadowIsSet = false;
|
2015-08-26 12:42:58 +00:00
|
|
|
bool blurIsSet = false;
|
2015-09-02 16:13:25 +00:00
|
|
|
bool contrastIsSet = false;
|
2015-09-09 11:04:11 +00:00
|
|
|
bool slideIsSet = false;
|
2014-10-16 12:59:01 +00:00
|
|
|
bool inputIsInfinite = true;
|
2016-03-18 08:57:46 +00:00
|
|
|
bool childrenChanged = false;
|
|
|
|
bool scaleIsSet = false;
|
|
|
|
bool transformIsSet = false;
|
2014-10-14 12:04:35 +00:00
|
|
|
qint32 scale = 1;
|
|
|
|
OutputInterface::Transform transform = OutputInterface::Transform::Normal;
|
|
|
|
QList<wl_resource*> callbacks = QList<wl_resource*>();
|
|
|
|
QPoint offset = QPoint();
|
|
|
|
BufferInterface *buffer = nullptr;
|
|
|
|
// stacking order: bottom (first) -> top (last)
|
|
|
|
QList<QPointer<SubSurfaceInterface>> children;
|
2015-07-15 09:07:50 +00:00
|
|
|
QPointer<ShadowInterface> shadow;
|
2015-08-26 12:42:58 +00:00
|
|
|
QPointer<BlurInterface> blur;
|
2015-09-02 16:13:25 +00:00
|
|
|
QPointer<ContrastInterface> contrast;
|
2015-09-09 11:04:11 +00:00
|
|
|
QPointer<SlideInterface> slide;
|
2014-10-14 12:04:35 +00:00
|
|
|
};
|
2014-11-20 15:40:14 +00:00
|
|
|
Private(SurfaceInterface *q, CompositorInterface *c, wl_resource *parentResource);
|
2014-10-14 12:04:35 +00:00
|
|
|
~Private();
|
|
|
|
|
|
|
|
void destroy();
|
|
|
|
|
|
|
|
void addChild(QPointer<SubSurfaceInterface> subsurface);
|
|
|
|
void removeChild(QPointer<SubSurfaceInterface> subsurface);
|
|
|
|
bool raiseChild(QPointer<SubSurfaceInterface> subsurface, SurfaceInterface *sibling);
|
|
|
|
bool lowerChild(QPointer<SubSurfaceInterface> subsurface, SurfaceInterface *sibling);
|
2015-07-15 09:07:50 +00:00
|
|
|
void setShadow(const QPointer<ShadowInterface> &shadow);
|
2015-08-26 12:42:58 +00:00
|
|
|
void setBlur(const QPointer<BlurInterface> &blur);
|
2015-09-02 16:13:25 +00:00
|
|
|
void setContrast(const QPointer<ContrastInterface> &contrast);
|
2015-09-09 11:04:11 +00:00
|
|
|
void setSlide(const QPointer<SlideInterface> &slide);
|
2014-10-14 12:04:35 +00:00
|
|
|
|
2016-03-18 08:57:46 +00:00
|
|
|
void commitSubSurface();
|
|
|
|
void commit();
|
|
|
|
|
2014-10-14 12:04:35 +00:00
|
|
|
State current;
|
|
|
|
State pending;
|
2016-03-18 08:57:46 +00:00
|
|
|
State subSurfacePending;
|
2014-10-14 12:04:35 +00:00
|
|
|
QPointer<SubSurfaceInterface> subSurface;
|
|
|
|
|
2016-03-29 13:54:18 +00:00
|
|
|
// workaround for https://bugreports.qt.io/browse/QTBUG-52192
|
|
|
|
// A subsurface needs to be considered mapped even if it doesn't have a buffer attached
|
|
|
|
// Otherwise Qt's sub-surfaces will never be visible and the client will freeze due to
|
|
|
|
// waiting on the frame callback of the never visible surface
|
|
|
|
bool subSurfaceIsMapped = true;
|
|
|
|
|
2014-10-14 12:04:35 +00:00
|
|
|
private:
|
2014-11-14 09:55:06 +00:00
|
|
|
SurfaceInterface *q_func() {
|
|
|
|
return reinterpret_cast<SurfaceInterface *>(q);
|
|
|
|
}
|
2016-03-18 08:57:46 +00:00
|
|
|
void swapStates(State *source, State *target, bool emitChanged);
|
2014-10-14 12:04:35 +00:00
|
|
|
void damage(const QRect &rect);
|
|
|
|
void setScale(qint32 scale);
|
|
|
|
void setTransform(OutputInterface::Transform transform);
|
|
|
|
void addFrameCallback(uint32_t callback);
|
|
|
|
void attachBuffer(wl_resource *buffer, const QPoint &offset);
|
2014-10-16 12:59:01 +00:00
|
|
|
void setOpaque(const QRegion ®ion);
|
|
|
|
void setInput(const QRegion ®ion, bool isInfinite);
|
2014-10-14 12:04:35 +00:00
|
|
|
|
|
|
|
static void destroyFrameCallback(wl_resource *r);
|
|
|
|
|
|
|
|
static void destroyCallback(wl_client *client, wl_resource *resource);
|
|
|
|
static void attachCallback(wl_client *client, wl_resource *resource, wl_resource *buffer, int32_t sx, int32_t sy);
|
|
|
|
static void damageCallback(wl_client *client, wl_resource *resource, int32_t x, int32_t y, int32_t width, int32_t height);
|
|
|
|
static void frameCallaback(wl_client *client, wl_resource *resource, uint32_t callback);
|
|
|
|
static void opaqueRegionCallback(wl_client *client, wl_resource *resource, wl_resource *region);
|
|
|
|
static void inputRegionCallback(wl_client *client, wl_resource *resource, wl_resource *region);
|
|
|
|
static void commitCallback(wl_client *client, wl_resource *resource);
|
|
|
|
// since version 2
|
|
|
|
static void bufferTransformCallback(wl_client *client, wl_resource *resource, int32_t transform);
|
|
|
|
// since version 3
|
|
|
|
static void bufferScaleCallback(wl_client *client, wl_resource *resource, int32_t scale);
|
|
|
|
|
|
|
|
static const struct wl_surface_interface s_interface;
|
|
|
|
};
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|