KWin
Loading...
Searching...
No Matches
surfaceitem_wayland.h
Go to the documentation of this file.
1/*
2 SPDX-FileCopyrightText: 2021 Vlad Zahorodnii <vlad.zahorodnii@kde.org>
3
4 SPDX-License-Identifier: GPL-2.0-or-later
5*/
6
7#pragma once
8
9#include "scene/surfaceitem.h"
10
11#include <unordered_map>
12
13namespace KWin
14{
15
16class GraphicsBuffer;
17class SubSurfaceInterface;
18class SurfaceInterface;
19class X11Window;
20
24class KWIN_EXPORT SurfaceItemWayland : public SurfaceItem
25{
26 Q_OBJECT
27
28public:
29 explicit SurfaceItemWayland(SurfaceInterface *surface, Scene *scene, Item *parent = nullptr);
30
31 QList<QRectF> shape() const override;
32 QRegion opaque() const override;
33 ContentType contentType() const override;
34 void freeze() override;
35
36 SurfaceInterface *surface() const;
37
38private Q_SLOTS:
39 void handleSurfaceCommitted();
40 void handleSurfaceSizeChanged();
41 void handleBufferSizeChanged();
42 void handleBufferSourceBoxChanged();
43 void handleBufferTransformChanged();
44
45 void handleChildSubSurfaceRemoved(SubSurfaceInterface *child);
46 void handleChildSubSurfacesChanged();
47 void handleSubSurfacePositionChanged();
48 void handleSubSurfaceMappedChanged();
49 void handleColorDescriptionChanged();
50 void handlePresentationModeHintChanged();
51
52protected:
53 std::unique_ptr<SurfacePixmap> createPixmap() override;
54
55private:
56 SurfaceItemWayland *getOrCreateSubSurfaceItem(SubSurfaceInterface *s);
57
58 QPointer<SurfaceInterface> m_surface;
59 std::unordered_map<SubSurfaceInterface *, std::unique_ptr<SurfaceItemWayland>> m_subsurfaces;
60};
61
62class KWIN_EXPORT SurfacePixmapWayland final : public SurfacePixmap
63{
64 Q_OBJECT
65
66public:
67 explicit SurfacePixmapWayland(SurfaceItemWayland *item, QObject *parent = nullptr);
68
69 void create() override;
70 void update() override;
71 bool isValid() const override;
72
73private:
74 SurfaceItemWayland *m_item;
75};
76
80class KWIN_EXPORT SurfaceItemXwayland : public SurfaceItemWayland
81{
82 Q_OBJECT
83
84public:
85 explicit SurfaceItemXwayland(X11Window *window, Scene *scene, Item *parent = nullptr);
86
87 QRegion opaque() const override;
88 QList<QRectF> shape() const override;
89
90private:
91 X11Window *m_window;
92};
93
94} // namespace KWin
Resource representing a wl_surface.
Definition surface.h:80
ContentType
Definition globals.h:284