Client: get correct window content geometry

Window content geometry should not include invisible portions of the
decorations, like shadows. This is stated in xdg-shell specificification
and in the description for this method.

Change-Id: I444fe9e28f0f175d2051be5c704efa7658bd45fb
Reviewed-by: David Edmundson <davidedmundson@kde.org>
This commit is contained in:
Jan Grulich 2021-02-23 08:42:16 +01:00
parent e101ffce1d
commit a02c408afc

View File

@ -369,7 +369,7 @@ void QWaylandWindow::setGeometry(const QRect &rect)
sendExposeEvent(exposeGeometry);
if (mShellSurface && isExposed())
mShellSurface->setWindowGeometry(windowContentGeometry());
mShellSurface->setWindowGeometry(QRect(QPoint(), surfaceSize()));
if (isOpaque() && mMask.isEmpty())
setOpaqueArea(rect);
@ -697,7 +697,12 @@ QSize QWaylandWindow::surfaceSize() const
*/
QRect QWaylandWindow::windowContentGeometry() const
{
return QRect(QPoint(), surfaceSize());
QMargins shadowMargins;
if (mWindowDecoration)
shadowMargins = mWindowDecoration->margins(QWaylandAbstractDecoration::ShadowsOnly);
return QRect(QPoint(shadowMargins.left(), shadowMargins.right()), surfaceSize().shrunkBy(shadowMargins));
}
/*!