47113e09b8
Currently, dealing with sub-surfaces is very difficult due to the scene design being heavily influenced by X11 requirements. The goal of this change is to re-work scene abstractions to make improving the wayland support easier. The Item class is based on the QQuickItem class. My hope is that one day we will be able to transition to QtQuick for painting scene, but in meanwhile it makes more sense to have a minimalistic internal item class. The WindowItem class represents a window. The SurfaceItem class represents the contents of either an X11, or a Wayland, or an internal surface. The DecorationItem and the ShadowItem class represent the server-side deco and drop-shadow, respectively. At the moment, the SurfaceItem is bound to the scene window, but the long term plan is to break that connection so we could re-use the SurfaceItem for things such as software cursors and drag-and-drop additional icons. One of the responsibilities of the Item is to schedule repaints as needed. Ideally, there shouldn't be any addRepaint() calls in the core code. The Item class schedules repaints on geometry updates. In the future, it also has to request an update if its opacity or visibility changes.
47 lines
1 KiB
C++
47 lines
1 KiB
C++
/*
|
|
SPDX-FileCopyrightText: 2021 Vlad Zahorodnii <vlad.zahorodnii@kde.org>
|
|
|
|
SPDX-License-Identifier: GPL-2.0-or-later
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
#include "surfaceitem.h"
|
|
|
|
namespace KWin
|
|
{
|
|
|
|
/**
|
|
* The SurfaceItemX11 class represents an X11 surface in the scene.
|
|
*/
|
|
class KWIN_EXPORT SurfaceItemX11 : public SurfaceItem
|
|
{
|
|
Q_OBJECT
|
|
|
|
public:
|
|
explicit SurfaceItemX11(Scene::Window *window, Item *parent = nullptr);
|
|
~SurfaceItemX11() override;
|
|
|
|
void processDamage();
|
|
bool fetchDamage();
|
|
void waitForDamage();
|
|
void destroyDamage();
|
|
|
|
QPointF mapToBuffer(const QPointF &point) const override;
|
|
QRegion shape() const override;
|
|
QRegion opaque() const override;
|
|
|
|
private Q_SLOTS:
|
|
void handleBufferGeometryChanged(Toplevel *toplevel, const QRect &old);
|
|
|
|
protected:
|
|
WindowPixmap *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;
|
|
};
|
|
|
|
} // namespace KWaylandServer
|