KWin
Loading...
Searching...
No Matches
surfaceitem_x11.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 <xcb/damage.h>
12#include <xcb/xfixes.h>
13
14namespace KWin
15{
16
17class X11Window;
18
22class KWIN_EXPORT SurfaceItemX11 : public SurfaceItem
23{
24 Q_OBJECT
25
26public:
27 explicit SurfaceItemX11(X11Window *window, Scene *scene, Item *parent = nullptr);
28 ~SurfaceItemX11() override;
29
30 X11Window *window() const;
31
32 void preprocess() override;
33
34 void processDamage();
35 bool fetchDamage();
36 void waitForDamage();
37 void forgetDamage();
38 void destroyDamage();
39
40 QList<QRectF> shape() const override;
41 QRegion opaque() const override;
42
43private Q_SLOTS:
44 void handleBufferGeometryChanged();
45 void handleShapeChanged();
46
47protected:
48 std::unique_ptr<SurfacePixmap> createPixmap() override;
49
50private:
51 X11Window *m_window;
52 xcb_damage_damage_t m_damageHandle = XCB_NONE;
53 xcb_xfixes_fetch_region_cookie_t m_damageCookie;
54 bool m_isDamaged = false;
55 bool m_havePendingDamageRegion = false;
56};
57
58class KWIN_EXPORT SurfacePixmapX11 final : public SurfacePixmap
59{
60 Q_OBJECT
61
62public:
63 explicit SurfacePixmapX11(SurfaceItemX11 *item, QObject *parent = nullptr);
64 ~SurfacePixmapX11() override;
65
66 xcb_pixmap_t pixmap() const;
67 xcb_visualid_t visual() const;
68
69 void create() override;
70 bool isValid() const override;
71
72private:
73 SurfaceItemX11 *m_item;
74 xcb_pixmap_t m_pixmap = XCB_PIXMAP_NONE;
75};
76
77} // namespace KWin