Make AbstractClient::layoutDecorationRects() virtual

This fixes closed windows losing decorations.
This commit is contained in:
Vlad Zahorodnii 2022-04-18 11:39:44 +03:00
parent 328f51ce10
commit 2540e80277
4 changed files with 4 additions and 14 deletions

View file

@ -1276,7 +1276,7 @@ public:
void setDecoratedClient(QPointer<Decoration::DecoratedClientImpl> client);
bool decorationHasAlpha() const;
void triggerDecorationRepaint();
void layoutDecorationRects(QRect &left, QRect &top, QRect &right, QRect &bottom) const;
virtual void layoutDecorationRects(QRect &left, QRect &top, QRect &right, QRect &bottom) const;
void processDecorationMove(const QPoint &localPos, const QPoint &globalPos);
bool processDecorationButtonPress(QMouseEvent *event, bool ignoreMenu = false);
void processDecorationButtonRelease(QMouseEvent *event);

View file

@ -244,11 +244,7 @@ WindowQuadList DecorationItem::buildQuads() const
const qreal devicePixelRatio = m_renderer->effectiveDevicePixelRatio();
const int texturePad = DecorationRenderer::TexturePad;
if (const AbstractClient *client = qobject_cast<const AbstractClient *>(m_window)) {
client->layoutDecorationRects(left, top, right, bottom);
} else if (const Deleted *deleted = qobject_cast<const Deleted *>(m_window)) {
deleted->layoutDecorationRects(left, top, right, bottom);
}
m_window->layoutDecorationRects(left, top, right, bottom);
const int topHeight = std::ceil(top.height() * devicePixelRatio);
const int bottomHeight = std::ceil(bottom.height() * devicePixelRatio);

View file

@ -32,7 +32,7 @@ public:
QPoint clientPos() const override;
bool isDeleted() const override;
xcb_window_t frameId() const override;
void layoutDecorationRects(QRect &left, QRect &top, QRect &right, QRect &bottom) const;
void layoutDecorationRects(QRect &left, QRect &top, QRect &right, QRect &bottom) const override;
Layer layer() const override
{
return m_layer;

View file

@ -246,13 +246,7 @@ void SceneQPainter::Window::renderDecorationItem(QPainter *painter, DecorationIt
{
const auto renderer = static_cast<const SceneQPainterDecorationRenderer *>(decorationItem->renderer());
QRect dtr, dlr, drr, dbr;
if (auto client = static_cast<AbstractClient *>(toplevel->isClient() ? toplevel : nullptr)) {
client->layoutDecorationRects(dlr, dtr, drr, dbr);
} else if (auto deleted = static_cast<Deleted *>(toplevel->isDeleted() ? toplevel : nullptr)) {
deleted->layoutDecorationRects(dlr, dtr, drr, dbr);
} else {
return;
}
toplevel->layoutDecorationRects(dlr, dtr, drr, dbr);
painter->drawImage(dtr, renderer->image(SceneQPainterDecorationRenderer::DecorationPart::Top));
painter->drawImage(dlr, renderer->image(SceneQPainterDecorationRenderer::DecorationPart::Left));