2021-02-04 09:07:20 +00:00
|
|
|
/*
|
|
|
|
SPDX-FileCopyrightText: 2021 Vlad Zahorodnii <vlad.zahorodnii@kde.org>
|
|
|
|
|
|
|
|
SPDX-License-Identifier: GPL-2.0-or-later
|
|
|
|
*/
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include "surfaceitem.h"
|
|
|
|
|
2021-05-18 09:24:40 +00:00
|
|
|
namespace KWaylandServer
|
|
|
|
{
|
2021-07-20 19:37:03 +00:00
|
|
|
class ClientBuffer;
|
2021-05-18 09:24:40 +00:00
|
|
|
class SubSurfaceInterface;
|
|
|
|
class SurfaceInterface;
|
|
|
|
}
|
|
|
|
|
2021-02-04 09:07:20 +00:00
|
|
|
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,
|
2022-04-18 07:42:11 +00:00
|
|
|
AbstractClient *window, Item *parent = nullptr);
|
2021-02-04 09:07:20 +00:00
|
|
|
|
|
|
|
QRegion shape() const override;
|
|
|
|
QRegion opaque() const override;
|
|
|
|
|
|
|
|
KWaylandServer::SurfaceInterface *surface() const;
|
|
|
|
|
|
|
|
private Q_SLOTS:
|
2021-07-21 19:25:42 +00:00
|
|
|
void handleSurfaceToBufferMatrixChanged();
|
2021-02-04 09:07:20 +00:00
|
|
|
void handleSurfaceCommitted();
|
|
|
|
void handleSurfaceSizeChanged();
|
|
|
|
|
|
|
|
void handleChildSubSurfaceRemoved(KWaylandServer::SubSurfaceInterface *child);
|
|
|
|
void handleChildSubSurfacesChanged();
|
|
|
|
void handleSubSurfacePositionChanged();
|
2021-07-28 17:08:48 +00:00
|
|
|
void handleSubSurfaceMappedChanged();
|
2021-02-04 09:07:20 +00:00
|
|
|
|
|
|
|
protected:
|
2021-04-09 07:06:04 +00:00
|
|
|
SurfacePixmap *createPixmap() override;
|
2021-02-04 09:07:20 +00:00
|
|
|
|
|
|
|
private:
|
2021-06-19 14:01:12 +00:00
|
|
|
SurfaceItemWayland *getOrCreateSubSurfaceItem(KWaylandServer::SubSurfaceInterface *s);
|
|
|
|
|
2021-02-04 09:07:20 +00:00
|
|
|
QPointer<KWaylandServer::SurfaceInterface> m_surface;
|
|
|
|
QHash<KWaylandServer::SubSurfaceInterface *, SurfaceItemWayland *> m_subsurfaces;
|
|
|
|
};
|
|
|
|
|
2021-04-09 07:06:04 +00:00
|
|
|
class KWIN_EXPORT SurfacePixmapWayland final : public SurfacePixmap
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
public:
|
|
|
|
explicit SurfacePixmapWayland(SurfaceItemWayland *item, QObject *parent = nullptr);
|
|
|
|
~SurfacePixmapWayland() override;
|
|
|
|
|
2021-07-21 19:25:42 +00:00
|
|
|
SurfaceItemWayland *item() const;
|
2021-04-09 07:06:04 +00:00
|
|
|
KWaylandServer::SurfaceInterface *surface() const;
|
2021-07-20 19:37:03 +00:00
|
|
|
KWaylandServer::ClientBuffer *buffer() const;
|
2021-04-09 07:06:04 +00:00
|
|
|
|
|
|
|
void create() override;
|
|
|
|
void update() override;
|
|
|
|
bool isValid() const override;
|
|
|
|
|
|
|
|
private:
|
2021-07-20 19:37:03 +00:00
|
|
|
void setBuffer(KWaylandServer::ClientBuffer *buffer);
|
2021-04-09 07:06:04 +00:00
|
|
|
|
|
|
|
SurfaceItemWayland *m_item;
|
2021-07-20 19:37:03 +00:00
|
|
|
KWaylandServer::ClientBuffer *m_buffer = nullptr;
|
2021-04-09 07:06:04 +00:00
|
|
|
};
|
|
|
|
|
2021-02-04 09:07:20 +00:00
|
|
|
/**
|
|
|
|
* The SurfaceItemXwayland class represents an Xwayland surface in the scene.
|
|
|
|
*/
|
|
|
|
class KWIN_EXPORT SurfaceItemXwayland : public SurfaceItemWayland
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
public:
|
2022-04-18 07:42:11 +00:00
|
|
|
explicit SurfaceItemXwayland(AbstractClient *window, Item *parent = nullptr);
|
2021-02-04 09:07:20 +00:00
|
|
|
|
|
|
|
QRegion shape() const override;
|
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace KWin
|