Client: do not take decoration shadows into account when placing popups

The anchor rectangle is relative to the window geometry, which according
to xdg-shell specs shouldn't include invisible portions like shadows.
This causes all popups be wrongly positioned when drop-shadows are used.

Pick-to: 6.4 6.3 6.2
Change-Id: Iac30ab264599f9898f3ddecd7f0c5f2aca824ad6
Reviewed-by: David Edmundson <davidedmundson@kde.org>
This commit is contained in:
Jan Grulich 2022-07-29 11:47:02 +02:00
parent 7aae0a115b
commit 95edea11f1

View File

@ -410,8 +410,8 @@ void QWaylandXdgSurface::setPopup(QWaylandWindow *parent)
QPoint transientPos = m_window->geometry().topLeft(); // this is absolute
transientPos -= parent->geometry().topLeft();
if (parent->decoration()) {
transientPos.setX(transientPos.x() + parent->decoration()->margins().left());
transientPos.setY(transientPos.y() + parent->decoration()->margins().top());
transientPos.setX(transientPos.x() + parent->decoration()->margins(QWaylandAbstractDecoration::ShadowsExcluded).left());
transientPos.setY(transientPos.y() + parent->decoration()->margins(QWaylandAbstractDecoration::ShadowsExcluded).top());
}
positioner->set_anchor_rect(transientPos.x(), transientPos.y(), 1, 1);
positioner->set_anchor(QtWayland::xdg_positioner::anchor_top_left);