/* SPDX-FileCopyrightText: 2021 Vlad Zahorodnii SPDX-License-Identifier: GPL-2.0-or-later */ #pragma once #include "scene/surfaceitem.h" #include namespace KWin { class GraphicsBuffer; class SubSurfaceInterface; class SurfaceInterface; class X11Window; /** * The SurfaceItemWayland class represents a Wayland surface in the scene. */ class KWIN_EXPORT SurfaceItemWayland : public SurfaceItem { Q_OBJECT public: explicit SurfaceItemWayland(SurfaceInterface *surface, Item *parent = nullptr); QList shape() const override; QRegion opaque() const override; ContentType contentType() const override; void setScanoutHint(DrmDevice *device, const QHash> &drmFormats) override; void freeze() override; SurfaceInterface *surface() const; private Q_SLOTS: void handleSurfaceCommitted(); void handleSurfaceSizeChanged(); void handleBufferSizeChanged(); void handleBufferSourceBoxChanged(); void handleBufferTransformChanged(); void handleChildSubSurfaceRemoved(SubSurfaceInterface *child); void handleChildSubSurfacesChanged(); void handleSubSurfacePositionChanged(); void handleSubSurfaceMappedChanged(); void handleColorDescriptionChanged(); void handlePresentationModeHintChanged(); void handleReleasePointChanged(); void handleAlphaMultiplierChanged(); protected: std::unique_ptr createPixmap() override; private: SurfaceItemWayland *getOrCreateSubSurfaceItem(SubSurfaceInterface *s); QPointer m_surface; struct ScanoutFeedback { DrmDevice *device = nullptr; QHash> formats; }; std::optional m_scanoutFeedback; std::unordered_map> m_subsurfaces; }; class KWIN_EXPORT SurfacePixmapWayland final : public SurfacePixmap { Q_OBJECT public: explicit SurfacePixmapWayland(SurfaceItemWayland *item, QObject *parent = nullptr); void create() override; void update() override; bool isValid() const override; private: SurfaceItemWayland *m_item; }; #if KWIN_BUILD_X11 /** * The SurfaceItemXwayland class represents an Xwayland surface in the scene. */ class KWIN_EXPORT SurfaceItemXwayland : public SurfaceItemWayland { Q_OBJECT public: explicit SurfaceItemXwayland(X11Window *window, Item *parent = nullptr); QRegion opaque() const override; QList shape() const override; private: X11Window *m_window; }; #endif } // namespace KWin