scene: Introduce WorkspaceScene::overlayItem
The overlay item is the parent for all overlay contents above windows.
This commit is contained in:
parent
c153fc719a
commit
207bc1d9e6
2 changed files with 19 additions and 12 deletions
|
@ -86,6 +86,7 @@ namespace KWin
|
||||||
WorkspaceScene::WorkspaceScene(std::unique_ptr<ItemRenderer> renderer)
|
WorkspaceScene::WorkspaceScene(std::unique_ptr<ItemRenderer> renderer)
|
||||||
: Scene(std::move(renderer))
|
: Scene(std::move(renderer))
|
||||||
, m_containerItem(std::make_unique<Item>(this))
|
, m_containerItem(std::make_unique<Item>(this))
|
||||||
|
, m_overlayItem(std::make_unique<Item>(this))
|
||||||
{
|
{
|
||||||
setGeometry(workspace()->geometry());
|
setGeometry(workspace()->geometry());
|
||||||
connect(workspace(), &Workspace::geometryChanged, this, [this]() {
|
connect(workspace(), &Workspace::geometryChanged, this, [this]() {
|
||||||
|
@ -108,7 +109,7 @@ void WorkspaceScene::createDndIconItem()
|
||||||
if (!dragIcon) {
|
if (!dragIcon) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
m_dndIcon = std::make_unique<DragAndDropIconItem>(dragIcon, this);
|
m_dndIcon = std::make_unique<DragAndDropIconItem>(dragIcon, this, m_overlayItem.get());
|
||||||
if (waylandServer()->seat()->isDragPointer()) {
|
if (waylandServer()->seat()->isDragPointer()) {
|
||||||
auto updatePosition = [this]() {
|
auto updatePosition = [this]() {
|
||||||
const auto pointerPos = waylandServer()->seat()->pointerPos();
|
const auto pointerPos = waylandServer()->seat()->pointerPos();
|
||||||
|
@ -140,6 +141,11 @@ Item *WorkspaceScene::containerItem() const
|
||||||
return m_containerItem.get();
|
return m_containerItem.get();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Item *WorkspaceScene::overlayItem() const
|
||||||
|
{
|
||||||
|
return m_overlayItem.get();
|
||||||
|
}
|
||||||
|
|
||||||
static SurfaceItem *findTopMostSurface(SurfaceItem *item)
|
static SurfaceItem *findTopMostSurface(SurfaceItem *item)
|
||||||
{
|
{
|
||||||
const QList<Item *> children = item->childItems();
|
const QList<Item *> children = item->childItems();
|
||||||
|
@ -305,6 +311,7 @@ void WorkspaceScene::preparePaintGenericScreen()
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
resetRepaintsHelper(m_overlayItem.get(), painted_delegate);
|
||||||
m_paintContext.damage = infiniteRegion();
|
m_paintContext.damage = infiniteRegion();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -348,9 +355,7 @@ void WorkspaceScene::preparePaintSimpleScreen()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_dndIcon) {
|
accumulateRepaints(m_overlayItem.get(), painted_delegate, &m_paintContext.damage);
|
||||||
accumulateRepaints(m_dndIcon.get(), painted_delegate, &m_paintContext.damage);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void WorkspaceScene::postPaint()
|
void WorkspaceScene::postPaint()
|
||||||
|
@ -373,8 +378,15 @@ void WorkspaceScene::paint(const RenderTarget &renderTarget, const QRegion ®i
|
||||||
|
|
||||||
effects->paintScreen(renderTarget, viewport, m_paintContext.mask, region, painted_screen);
|
effects->paintScreen(renderTarget, viewport, m_paintContext.mask, region, painted_screen);
|
||||||
m_paintScreenCount = 0;
|
m_paintScreenCount = 0;
|
||||||
Q_EMIT frameRendered();
|
|
||||||
|
|
||||||
|
if (m_overlayItem) {
|
||||||
|
const QRegion repaint = region & m_overlayItem->mapToScene(m_overlayItem->boundingRect()).toRect();
|
||||||
|
if (!repaint.isEmpty()) {
|
||||||
|
m_renderer->renderItem(renderTarget, viewport, m_overlayItem.get(), 0, repaint, WindowPaintData{});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Q_EMIT frameRendered();
|
||||||
m_renderer->endFrame();
|
m_renderer->endFrame();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -431,13 +443,6 @@ void WorkspaceScene::paintSimpleScreen(const RenderTarget &renderTarget, const R
|
||||||
for (const Phase2Data &paintData : std::as_const(m_paintContext.phase2Data)) {
|
for (const Phase2Data &paintData : std::as_const(m_paintContext.phase2Data)) {
|
||||||
paintWindow(renderTarget, viewport, paintData.item, paintData.mask, paintData.region);
|
paintWindow(renderTarget, viewport, paintData.item, paintData.mask, paintData.region);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_dndIcon) {
|
|
||||||
const QRegion repaint = region & m_dndIcon->mapToScene(m_dndIcon->boundingRect()).toRect();
|
|
||||||
if (!repaint.isEmpty()) {
|
|
||||||
m_renderer->renderItem(renderTarget, viewport, m_dndIcon.get(), 0, repaint, WindowPaintData{});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void WorkspaceScene::createStackingOrder()
|
void WorkspaceScene::createStackingOrder()
|
||||||
|
|
|
@ -46,6 +46,7 @@ public:
|
||||||
void initialize();
|
void initialize();
|
||||||
|
|
||||||
Item *containerItem() const;
|
Item *containerItem() const;
|
||||||
|
Item *overlayItem() const;
|
||||||
|
|
||||||
SurfaceItem *scanoutCandidate() const override;
|
SurfaceItem *scanoutCandidate() const override;
|
||||||
QRegion prePaint(SceneDelegate *delegate) override;
|
QRegion prePaint(SceneDelegate *delegate) override;
|
||||||
|
@ -129,6 +130,7 @@ private:
|
||||||
int m_paintScreenCount = 0;
|
int m_paintScreenCount = 0;
|
||||||
PaintContext m_paintContext;
|
PaintContext m_paintContext;
|
||||||
std::unique_ptr<Item> m_containerItem;
|
std::unique_ptr<Item> m_containerItem;
|
||||||
|
std::unique_ptr<Item> m_overlayItem;
|
||||||
std::unique_ptr<DragAndDropIconItem> m_dndIcon;
|
std::unique_ptr<DragAndDropIconItem> m_dndIcon;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue