File indexing completed on 2024-05-19 05:32:21

0001 /*
0002     SPDX-FileCopyrightText: 2021 Vlad Zahorodnii <vlad.zahorodnii@kde.org>
0003 
0004     SPDX-License-Identifier: GPL-2.0-or-later
0005 */
0006 
0007 #pragma once
0008 
0009 #include "scene/surfaceitem.h"
0010 
0011 namespace KWin
0012 {
0013 
0014 class InternalWindow;
0015 
0016 /**
0017  * The SurfaceItemInternal class represents an internal surface in the scene.
0018  */
0019 class KWIN_EXPORT SurfaceItemInternal : public SurfaceItem
0020 {
0021     Q_OBJECT
0022 
0023 public:
0024     explicit SurfaceItemInternal(InternalWindow *window, Scene *scene, Item *parent = nullptr);
0025 
0026     InternalWindow *window() const;
0027 
0028     QList<QRectF> shape() const override;
0029 
0030 private Q_SLOTS:
0031     void handleBufferGeometryChanged();
0032 
0033 protected:
0034     std::unique_ptr<SurfacePixmap> createPixmap() override;
0035 
0036 private:
0037     InternalWindow *m_window;
0038 };
0039 
0040 class KWIN_EXPORT SurfacePixmapInternal final : public SurfacePixmap
0041 {
0042     Q_OBJECT
0043 
0044 public:
0045     explicit SurfacePixmapInternal(SurfaceItemInternal *item, QObject *parent = nullptr);
0046 
0047     void create() override;
0048     void update() override;
0049     bool isValid() const override;
0050 
0051 private:
0052     SurfaceItemInternal *m_item;
0053 };
0054 
0055 } // namespace KWin