bcd9f1e958
Our logical co-ordinates for shape can be floating. The shape is used to determine final vertices on screen. The commit appears to introduce some new loops but they're mostly what QRegion would be doing internally so it shouldn't impact performance. For most cases we just have a single rectangle in our shape anyway. opaqueRegion is unchanged for now.
94 lines
2.3 KiB
C++
94 lines
2.3 KiB
C++
/*
|
|
SPDX-FileCopyrightText: 2021 Vlad Zahorodnii <vlad.zahorodnii@kde.org>
|
|
|
|
SPDX-License-Identifier: GPL-2.0-or-later
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
#include "surfaceitem.h"
|
|
|
|
namespace KWaylandServer
|
|
{
|
|
class ClientBuffer;
|
|
class SubSurfaceInterface;
|
|
class SurfaceInterface;
|
|
}
|
|
|
|
namespace KWin
|
|
{
|
|
|
|
/**
|
|
* The SurfaceItemWayland class represents a Wayland surface in the scene.
|
|
*/
|
|
class KWIN_EXPORT SurfaceItemWayland : public SurfaceItem
|
|
{
|
|
Q_OBJECT
|
|
|
|
public:
|
|
explicit SurfaceItemWayland(KWaylandServer::SurfaceInterface *surface,
|
|
Window *window, Item *parent = nullptr);
|
|
|
|
QVector<QRectF> shape() const override;
|
|
QRegion opaque() const override;
|
|
ContentType contentType() const override;
|
|
|
|
KWaylandServer::SurfaceInterface *surface() const;
|
|
|
|
private Q_SLOTS:
|
|
void handleSurfaceToBufferMatrixChanged();
|
|
void handleSurfaceCommitted();
|
|
void handleSurfaceSizeChanged();
|
|
|
|
void handleChildSubSurfaceRemoved(KWaylandServer::SubSurfaceInterface *child);
|
|
void handleChildSubSurfacesChanged();
|
|
void handleSubSurfacePositionChanged();
|
|
void handleSubSurfaceMappedChanged();
|
|
|
|
protected:
|
|
std::unique_ptr<SurfacePixmap> createPixmap() override;
|
|
|
|
private:
|
|
SurfaceItemWayland *getOrCreateSubSurfaceItem(KWaylandServer::SubSurfaceInterface *s);
|
|
|
|
QPointer<KWaylandServer::SurfaceInterface> m_surface;
|
|
QHash<KWaylandServer::SubSurfaceInterface *, SurfaceItemWayland *> m_subsurfaces;
|
|
};
|
|
|
|
class KWIN_EXPORT SurfacePixmapWayland final : public SurfacePixmap
|
|
{
|
|
Q_OBJECT
|
|
|
|
public:
|
|
explicit SurfacePixmapWayland(SurfaceItemWayland *item, QObject *parent = nullptr);
|
|
~SurfacePixmapWayland() override;
|
|
|
|
SurfaceItemWayland *item() const;
|
|
KWaylandServer::SurfaceInterface *surface() const;
|
|
KWaylandServer::ClientBuffer *buffer() const;
|
|
|
|
void create() override;
|
|
void update() override;
|
|
bool isValid() const override;
|
|
|
|
private:
|
|
void setBuffer(KWaylandServer::ClientBuffer *buffer);
|
|
|
|
SurfaceItemWayland *m_item;
|
|
KWaylandServer::ClientBuffer *m_buffer = nullptr;
|
|
};
|
|
|
|
/**
|
|
* The SurfaceItemXwayland class represents an Xwayland surface in the scene.
|
|
*/
|
|
class KWIN_EXPORT SurfaceItemXwayland : public SurfaceItemWayland
|
|
{
|
|
Q_OBJECT
|
|
|
|
public:
|
|
explicit SurfaceItemXwayland(Window *window, Item *parent = nullptr);
|
|
|
|
QVector<QRectF> shape() const override;
|
|
};
|
|
|
|
} // namespace KWin
|