Use Q_ASSERT in XdgShellClient::transientPlacement()

Summary: This simplifies CFG.

Test Plan: Compiles.

Reviewers: #kwin, davidedmundson

Reviewed By: #kwin, davidedmundson

Subscribers: kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D27124
This commit is contained in:
Vlad Zahorodnii 2020-02-03 14:32:20 +02:00
parent 85c099936e
commit 432787e036

View file

@ -1632,6 +1632,8 @@ bool XdgShellClient::hasTransientPlacementHint() const
QRect XdgShellClient::transientPlacement(const QRect &bounds) const
{
Q_ASSERT(m_xdgShellPopup);
QRect anchorRect;
Qt::Edges anchorEdge;
Qt::Edges gravity;
@ -1660,20 +1662,15 @@ QRect XdgShellClient::transientPlacement(const QRect &bounds) const
return true;
};
if (m_xdgShellPopup) {
anchorRect = m_xdgShellPopup->anchorRect();
anchorEdge = m_xdgShellPopup->anchorEdge();
gravity = m_xdgShellPopup->gravity();
offset = m_xdgShellPopup->anchorOffset();
constraintAdjustments = m_xdgShellPopup->constraintAdjustments();
if (!size.isValid()) {
size = m_xdgShellPopup->initialSize();
}
} else {
Q_UNREACHABLE();
anchorRect = m_xdgShellPopup->anchorRect();
anchorEdge = m_xdgShellPopup->anchorEdge();
gravity = m_xdgShellPopup->gravity();
offset = m_xdgShellPopup->anchorOffset();
constraintAdjustments = m_xdgShellPopup->constraintAdjustments();
if (!size.isValid()) {
size = m_xdgShellPopup->initialSize();
}
//initial position
popupPosition = QRect(popupOffset(anchorRect, anchorEdge, gravity, size) + offset + parentClientPos, size);