bcd9f1e958
Our logical co-ordinates for shape can be floating. The shape is used to determine final vertices on screen. The commit appears to introduce some new loops but they're mostly what QRegion would be doing internally so it shouldn't impact performance. For most cases we just have a single rectangle in our shape anyway. opaqueRegion is unchanged for now.
71 lines
1.5 KiB
C++
71 lines
1.5 KiB
C++
/*
|
|
SPDX-FileCopyrightText: 2021 Vlad Zahorodnii <vlad.zahorodnii@kde.org>
|
|
|
|
SPDX-License-Identifier: GPL-2.0-or-later
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
#include "surfaceitem.h"
|
|
|
|
#include <xcb/damage.h>
|
|
#include <xcb/xfixes.h>
|
|
|
|
namespace KWin
|
|
{
|
|
|
|
/**
|
|
* The SurfaceItemX11 class represents an X11 surface in the scene.
|
|
*/
|
|
class KWIN_EXPORT SurfaceItemX11 : public SurfaceItem
|
|
{
|
|
Q_OBJECT
|
|
|
|
public:
|
|
explicit SurfaceItemX11(Window *window, Item *parent = nullptr);
|
|
~SurfaceItemX11() override;
|
|
|
|
void preprocess() override;
|
|
|
|
void processDamage();
|
|
bool fetchDamage();
|
|
void waitForDamage();
|
|
void destroyDamage();
|
|
|
|
QVector<QRectF> shape() const override;
|
|
QRegion opaque() const override;
|
|
|
|
private Q_SLOTS:
|
|
void handleBufferGeometryChanged(Window *window, const QRectF &old);
|
|
void handleGeometryShapeChanged();
|
|
|
|
protected:
|
|
std::unique_ptr<SurfacePixmap> createPixmap() override;
|
|
|
|
private:
|
|
xcb_damage_damage_t m_damageHandle = XCB_NONE;
|
|
xcb_xfixes_fetch_region_cookie_t m_damageCookie;
|
|
bool m_isDamaged = false;
|
|
bool m_havePendingDamageRegion = false;
|
|
};
|
|
|
|
class KWIN_EXPORT SurfacePixmapX11 final : public SurfacePixmap
|
|
{
|
|
Q_OBJECT
|
|
|
|
public:
|
|
explicit SurfacePixmapX11(SurfaceItemX11 *item, QObject *parent = nullptr);
|
|
~SurfacePixmapX11() override;
|
|
|
|
xcb_pixmap_t pixmap() const;
|
|
xcb_visualid_t visual() const;
|
|
|
|
void create() override;
|
|
bool isValid() const override;
|
|
|
|
private:
|
|
SurfaceItemX11 *m_item;
|
|
xcb_pixmap_t m_pixmap = XCB_PIXMAP_NONE;
|
|
};
|
|
|
|
} // namespace KWaylandServer
|