Commit 1c521500 authored by Vlad Zahorodnii's avatar Vlad Zahorodnii
Browse files

x11: Fix shading with non-zero border

There was a geometry change that fixed mixing the next and current
geometries. While it did fix issues on wayland, it broke window shading
on x11 because of an obscure resize() call.

That obscure resize() had a side-effect that ensures m_clientGeometry
has the right value so the next time the window is unshaded,
implicitSize() will return a good value.

In order to make window size computation more robust, this change makes
X11Window compute the natural frame size based on cached size in
m_client, which shouldn't change when the window is shaded.

However, given how buggy window shading is and how difficult it is to
make it work right, I think that it's better to deprecate window shading
and remove it in some future release.

BUG: 450582
(cherry picked from commit 4790916f)
parent 3f110dff
Pipeline #206498 passed with stage
in 22 minutes and 15 seconds
......@@ -4225,15 +4225,6 @@ void Window::checkOffscreenPosition(QRect *geom, const QRect &screenArea)
}
}
/**
* Returns the natural size of the window, if the window is not shaded it's the same
* as size().
*/
QSize Window::implicitSize() const
{
return clientSizeToFrameSize(clientSize());
}
/**
* Constrains the client size @p size according to a set of the window's size hints.
*
......
......@@ -1142,7 +1142,6 @@ public:
virtual QSize constrainClientSize(const QSize &size, SizeMode mode = SizeModeAny) const;
QSize constrainFrameSize(const QSize &size, SizeMode mode = SizeModeAny) const;
QSize implicitSize() const;
/**
* Calculates the matching client position for the given frame position @p point.
......
......@@ -1154,7 +1154,7 @@ void X11Window::createDecoration(const QRect &oldgeom)
}
setDecoration(decoration);
moveResize(QRect(calculateGravitation(false), implicitSize()));
moveResize(QRect(calculateGravitation(false), clientSizeToFrameSize(clientSize())));
maybeCreateX11DecorationRenderer();
Q_EMIT geometryShapeChanged(this, oldgeom);
}
......@@ -1166,7 +1166,7 @@ void X11Window::destroyDecoration()
QPoint grav = calculateGravitation(true);
setDecoration(nullptr);
maybeDestroyX11DecorationRenderer();
moveResize(QRect(grav, implicitSize()));
moveResize(QRect(grav, clientSizeToFrameSize(clientSize())));
if (!isZombie()) {
Q_EMIT geometryShapeChanged(this, oldgeom);
}
......@@ -2669,6 +2669,15 @@ QRect X11Window::frameRectToBufferRect(const QRect &rect) const
return frameRectToClientRect(rect);
}
/**
* Returns the natural size of the window, if the window is not shaded it's the same
* as size().
*/
QSize X11Window::implicitSize() const
{
return clientSizeToFrameSize(m_client.geometry().size());
}
QMatrix4x4 X11Window::inputTransformation() const
{
QMatrix4x4 matrix;
......
......@@ -110,6 +110,7 @@ public:
QSize frameSizeToClientSize(const QSize &size) const override;
QSize clientSizeToFrameSize(const QSize &size) const override;
QRect frameRectToBufferRect(const QRect &rect) const;
QSize implicitSize() const;
QMatrix4x4 inputTransformation() const override;
......
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