Commit ee0b4474 authored by Vlad Zahorodnii's avatar Vlad Zahorodnii
Browse files

Don't use "no border" property to determine if Deleted was decorated

With xdg-toplevel windows, the value of the "no border" property can be
sometimes out of sync with the fact whether the window is decorated. This
may result in Deleted windows being frameless.

In order to address that issue, we need to store the current value of
AbstractClient::isDecorated() during the construction of Deleted.


(cherry picked from commit ed5dfa16)
parent 849f102e
......@@ -27,7 +27,6 @@ Deleted::Deleted()
: Toplevel()
, delete_refcount(1)
, m_frame(XCB_WINDOW_NONE)
, no_border(true)
, m_layer(UnknownLayer)
, m_minimized(false)
, m_modal(false)
......@@ -42,6 +41,7 @@ Deleted::Deleted()
, m_wasGroupTransient(false)
, m_wasPopupWindow(false)
, m_wasOutline(false)
, m_wasDecorated(false)
{
}
......@@ -101,8 +101,8 @@ void Deleted::copyToDeleted(Toplevel* c)
if (WinInfo* cinfo = dynamic_cast< WinInfo* >(info))
cinfo->disable();
if (AbstractClient *client = dynamic_cast<AbstractClient*>(c)) {
no_border = client->noBorder();
if (!no_border) {
m_wasDecorated = client->isDecorated();
if (m_wasDecorated) {
client->layoutDecorationRects(decoration_left,
decoration_top,
decoration_right,
......@@ -195,6 +195,11 @@ QPoint Deleted::clientPos() const
return contentsRect.topLeft();
}
bool Deleted::wasDecorated() const
{
return m_wasDecorated;
}
void Deleted::layoutDecorationRects(QRect& left, QRect& top, QRect& right, QRect& bottom) const
{
left = decoration_left;
......
......@@ -46,9 +46,7 @@ public:
QRect transparentRect() const override;
bool isDeleted() const override;
xcb_window_t frameId() const override;
bool noBorder() const {
return no_border;
}
bool wasDecorated() const;
void layoutDecorationRects(QRect &left, QRect &top, QRect &right, QRect &bottom) const;
Layer layer() const override {
return m_layer;
......@@ -198,7 +196,6 @@ private:
xcb_window_t m_frame;
QVector <VirtualDesktop *> m_desktops;
bool no_border;
QRect decoration_left;
QRect decoration_right;
QRect decoration_top;
......@@ -224,6 +221,7 @@ private:
QList<Deleted *> m_transients;
bool m_wasPopupWindow;
bool m_wasOutline;
bool m_wasDecorated;
qreal m_bufferScale = 1;
};
......
......@@ -1164,10 +1164,6 @@ void OpenGLWindow::endRenderWindow()
GLTexture *OpenGLWindow::getDecorationTexture() const
{
if (AbstractClient *client = dynamic_cast<AbstractClient *>(toplevel)) {
if (client->noBorder()) {
return nullptr;
}
if (!client->isDecorated()) {
return nullptr;
}
......@@ -1177,7 +1173,7 @@ GLTexture *OpenGLWindow::getDecorationTexture() const
}
} else if (toplevel->isDeleted()) {
Deleted *deleted = static_cast<Deleted *>(toplevel);
if (!deleted->wasClient() || deleted->noBorder()) {
if (!deleted->wasDecorated()) {
return nullptr;
}
if (const SceneOpenGLDecorationRenderer *renderer = static_cast<const SceneOpenGLDecorationRenderer*>(deleted->decorationRenderer())) {
......
......@@ -303,24 +303,19 @@ void SceneQPainter::Window::renderWindowDecorations(QPainter *painter)
return;
}
bool noBorder = true;
const SceneQPainterDecorationRenderer *renderer = nullptr;
QRect dtr, dlr, drr, dbr;
if (client && !client->noBorder()) {
if (client->isDecorated()) {
if (SceneQPainterDecorationRenderer *r = static_cast<SceneQPainterDecorationRenderer *>(client->decoratedClient()->renderer())) {
r->render();
renderer = r;
}
if (client && client->isDecorated()) {
if (SceneQPainterDecorationRenderer *r = static_cast<SceneQPainterDecorationRenderer *>(client->decoratedClient()->renderer())) {
r->render();
renderer = r;
}
client->layoutDecorationRects(dlr, dtr, drr, dbr);
noBorder = false;
} else if (deleted && !deleted->noBorder()) {
noBorder = false;
} else if (deleted && deleted->wasDecorated()) {
deleted->layoutDecorationRects(dlr, dtr, drr, dbr);
renderer = static_cast<const SceneQPainterDecorationRenderer *>(deleted->decorationRenderer());
}
if (noBorder || !renderer) {
if (!renderer) {
return;
}
......
......@@ -290,8 +290,7 @@ void SceneXrender::Window::performPaint(int mask, const QRegion &_region, const
X11Client *client = dynamic_cast<X11Client *>(toplevel);
Deleted *deleted = dynamic_cast<Deleted*>(toplevel);
const QRect decorationRect = toplevel->rect();
if (((client && !client->noBorder()) || (deleted && !deleted->noBorder())) &&
true) {
if ((client && client->isDecorated()) || (deleted && deleted->wasDecorated())) {
// decorated client
transformed_shape = decorationRect;
if (toplevel->shape()) {
......@@ -360,7 +359,7 @@ void SceneXrender::Window::performPaint(int mask, const QRegion &_region, const
// This solves a number of glitches and on top of this
// it optimizes painting quite a bit
const bool blitInTempPixmap = xRenderOffscreen() || (data.crossFadeProgress() < 1.0 && !opaque) ||
(scaled && (wantShadow || (client && !client->noBorder()) || (deleted && !deleted->noBorder())));
(scaled && (wantShadow || (client && client->isDecorated()) || (deleted && deleted->wasDecorated())));
xcb_render_picture_t renderTarget = m_scene->xrenderBufferPicture();
if (blitInTempPixmap) {
......@@ -405,22 +404,17 @@ void SceneXrender::Window::performPaint(int mask, const QRegion &_region, const
xcb_render_picture_t bottom = XCB_RENDER_PICTURE_NONE;
QRect dtr, dlr, drr, dbr;
const SceneXRenderDecorationRenderer *renderer = nullptr;
if (client) {
if (client && !client->noBorder()) {
if (client->isDecorated()) {
SceneXRenderDecorationRenderer *r = static_cast<SceneXRenderDecorationRenderer*>(client->decoratedClient()->renderer());
if (r) {
r->render();
renderer = r;
}
}
noBorder = client->noBorder();
client->layoutDecorationRects(dlr, dtr, drr, dbr);
if (client && client->isDecorated()) {
SceneXRenderDecorationRenderer *r = static_cast<SceneXRenderDecorationRenderer*>(client->decoratedClient()->renderer());
if (r) {
r->render();
renderer = r;
}
}
if (deleted && !deleted->noBorder()) {
noBorder = false;
client->layoutDecorationRects(dlr, dtr, drr, dbr);
} else if (deleted && deleted->wasDecorated()) {
renderer = static_cast<const SceneXRenderDecorationRenderer*>(deleted->decorationRenderer());
noBorder = deleted->noBorder();
noBorder = false;
deleted->layoutDecorationRects(dlr, dtr, drr, dbr);
}
if (renderer) {
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment