From 432787e0360711c4a360e85f9144e9736605b867 Mon Sep 17 00:00:00 2001 From: Vlad Zahorodnii Date: Mon, 3 Feb 2020 14:32:20 +0200 Subject: [PATCH] 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 --- xdgshellclient.cpp | 21 +++++++++------------ 1 file changed, 9 insertions(+), 12 deletions(-) diff --git a/xdgshellclient.cpp b/xdgshellclient.cpp index 262c711a86..9e08b3fa83 100644 --- a/xdgshellclient.cpp +++ b/xdgshellclient.cpp @@ -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);