Commit 86d39af6 authored by Vlad Zahorodnii's avatar Vlad Zahorodnii
Browse files

Move surface state struct in KWaylandServer namespace

This way, it's less characters to type. In order to support delayed
surface commits, compositor extensions need to piggyback their state on
the state of the wl_surface. In other words, SurfaceState is going to
be used not only by SurfaceInterface, but the viewporter extension, the
xdg-shell extension, etc.
parent dde500c3
......@@ -423,7 +423,7 @@ bool SurfaceInterface::hasFrameCallbacks() const
return !d->current.frameCallbacks.isEmpty();
}
QMatrix4x4 SurfaceInterfacePrivate::buildSurfaceToBufferMatrix(const State *state)
QMatrix4x4 SurfaceInterfacePrivate::buildSurfaceToBufferMatrix(const SurfaceState *state)
{
// The order of transforms is reversed, i.e. the viewport transform is the first one.
......@@ -481,7 +481,7 @@ QMatrix4x4 SurfaceInterfacePrivate::buildSurfaceToBufferMatrix(const State *stat
return surfaceToBufferMatrix;
}
void SurfaceInterfacePrivate::swapStates(State *source, State *target, bool emitChanged)
void SurfaceInterfacePrivate::swapStates(SurfaceState *source, SurfaceState *target, bool emitChanged)
{
const bool bufferChanged = source->bufferIsSet;
const bool opaqueRegionChanged = source->opaqueIsSet;
......@@ -573,7 +573,7 @@ void SurfaceInterfacePrivate::swapStates(State *source, State *target, bool emit
confinedPointerPrivate->commit();
}
*source = State{};
*source = SurfaceState{};
source->children = target->children;
if (!emitChanged) {
......
......@@ -34,42 +34,43 @@ protected:
void callback_destroy_resource(Resource *resource) override;
};
struct SurfaceState
{
QRegion damage = QRegion();
QRegion bufferDamage = QRegion();
QRegion opaque = QRegion();
QRegion input = infiniteRegion();
QRectF sourceGeometry = QRectF();
QSize destinationSize = QSize();
QSize size = QSize();
bool sourceGeometryIsSet = false;
bool destinationSizeIsSet = false;
bool inputIsSet = false;
bool opaqueIsSet = false;
bool bufferIsSet = false;
bool shadowIsSet = false;
bool blurIsSet = false;
bool contrastIsSet = false;
bool slideIsSet = false;
bool childrenChanged = false;
bool bufferScaleIsSet = false;
bool bufferTransformIsSet = false;
qint32 bufferScale = 1;
OutputInterface::Transform bufferTransform = OutputInterface::Transform::Normal;
QList<KWaylandFrameCallback *> frameCallbacks;
QPoint offset = QPoint();
BufferInterface *buffer = nullptr;
// stacking order: bottom (first) -> top (last)
QList<SubSurfaceInterface *> children;
QPointer<ShadowInterface> shadow;
QPointer<BlurInterface> blur;
QPointer<ContrastInterface> contrast;
QPointer<SlideInterface> slide;
};
class SurfaceInterfacePrivate : public QtWaylandServer::wl_surface
{
public:
struct State {
QRegion damage = QRegion();
QRegion bufferDamage = QRegion();
QRegion opaque = QRegion();
QRegion input = infiniteRegion();
QRectF sourceGeometry = QRectF();
QSize destinationSize = QSize();
QSize size = QSize();
bool sourceGeometryIsSet = false;
bool destinationSizeIsSet = false;
bool inputIsSet = false;
bool opaqueIsSet = false;
bool bufferIsSet = false;
bool shadowIsSet = false;
bool blurIsSet = false;
bool contrastIsSet = false;
bool slideIsSet = false;
bool childrenChanged = false;
bool bufferScaleIsSet = false;
bool bufferTransformIsSet = false;
qint32 bufferScale = 1;
OutputInterface::Transform bufferTransform = OutputInterface::Transform::Normal;
QList<KWaylandFrameCallback *> frameCallbacks;
QPoint offset = QPoint();
BufferInterface *buffer = nullptr;
// stacking order: bottom (first) -> top (last)
QList<SubSurfaceInterface *> children;
QPointer<ShadowInterface> shadow;
QPointer<BlurInterface> blur;
QPointer<ContrastInterface> contrast;
QPointer<SlideInterface> slide;
};
static SurfaceInterfacePrivate *get(SurfaceInterface *surface) { return surface->d.data(); }
explicit SurfaceInterfacePrivate(SurfaceInterface *q);
......@@ -88,16 +89,15 @@ public:
void installIdleInhibitor(IdleInhibitorV1Interface *inhibitor);
void commit();
QMatrix4x4 buildSurfaceToBufferMatrix(const State *state);
void swapStates(State *source, State *target, bool emitChanged);
QMatrix4x4 buildSurfaceToBufferMatrix(const SurfaceState *state);
void swapStates(SurfaceState *source, SurfaceState *target, bool emitChanged);
CompositorInterface *compositor;
SurfaceInterface *q;
SurfaceRole *role = nullptr;
State current;
State pending;
State cached;
SurfaceState current;
SurfaceState pending;
SurfaceState cached;
SubSurfaceInterface *subSurface = nullptr;
QMatrix4x4 surfaceToBufferMatrix;
QMatrix4x4 bufferToSurfaceMatrix;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment