Changeset View
Changeset View
Standalone View
Standalone View
xdgshellclient.cpp
Show First 20 Lines • Show All 1626 Lines • ▼ Show 20 Line(s) | |||||
1627 | 1627 | | |||
1628 | bool XdgShellClient::hasTransientPlacementHint() const | 1628 | bool XdgShellClient::hasTransientPlacementHint() const | ||
1629 | { | 1629 | { | ||
1630 | return isTransient() && transientFor() && m_xdgShellPopup; | 1630 | return isTransient() && transientFor() && m_xdgShellPopup; | ||
1631 | } | 1631 | } | ||
1632 | 1632 | | |||
1633 | QRect XdgShellClient::transientPlacement(const QRect &bounds) const | 1633 | QRect XdgShellClient::transientPlacement(const QRect &bounds) const | ||
1634 | { | 1634 | { | ||
1635 | Q_ASSERT(m_xdgShellPopup); | ||||
1636 | | ||||
1635 | QRect anchorRect; | 1637 | QRect anchorRect; | ||
1636 | Qt::Edges anchorEdge; | 1638 | Qt::Edges anchorEdge; | ||
1637 | Qt::Edges gravity; | 1639 | Qt::Edges gravity; | ||
1638 | QPoint offset; | 1640 | QPoint offset; | ||
1639 | PositionerConstraints constraintAdjustments; | 1641 | PositionerConstraints constraintAdjustments; | ||
1640 | QSize size = frameGeometry().size(); | 1642 | QSize size = frameGeometry().size(); | ||
1641 | 1643 | | |||
1642 | const QPoint parentClientPos = transientFor()->pos() + transientFor()->clientPos(); | 1644 | const QPoint parentClientPos = transientFor()->pos() + transientFor()->clientPos(); | ||
Show All 12 Lines | 1655 | if (edges & Qt::RightEdge && target.right() > bounds.right()) { | |||
1655 | return false; | 1657 | return false; | ||
1656 | } | 1658 | } | ||
1657 | if (edges & Qt::BottomEdge && target.bottom() > bounds.bottom()) { | 1659 | if (edges & Qt::BottomEdge && target.bottom() > bounds.bottom()) { | ||
1658 | return false; | 1660 | return false; | ||
1659 | } | 1661 | } | ||
1660 | return true; | 1662 | return true; | ||
1661 | }; | 1663 | }; | ||
1662 | 1664 | | |||
1663 | if (m_xdgShellPopup) { | | |||
1664 | anchorRect = m_xdgShellPopup->anchorRect(); | 1665 | anchorRect = m_xdgShellPopup->anchorRect(); | ||
1665 | anchorEdge = m_xdgShellPopup->anchorEdge(); | 1666 | anchorEdge = m_xdgShellPopup->anchorEdge(); | ||
1666 | gravity = m_xdgShellPopup->gravity(); | 1667 | gravity = m_xdgShellPopup->gravity(); | ||
1667 | offset = m_xdgShellPopup->anchorOffset(); | 1668 | offset = m_xdgShellPopup->anchorOffset(); | ||
1668 | constraintAdjustments = m_xdgShellPopup->constraintAdjustments(); | 1669 | constraintAdjustments = m_xdgShellPopup->constraintAdjustments(); | ||
1669 | if (!size.isValid()) { | 1670 | if (!size.isValid()) { | ||
1670 | size = m_xdgShellPopup->initialSize(); | 1671 | size = m_xdgShellPopup->initialSize(); | ||
1671 | } | 1672 | } | ||
1672 | } else { | | |||
1673 | Q_UNREACHABLE(); | | |||
1674 | } | | |||
1675 | | ||||
1676 | 1673 | | |||
1677 | //initial position | 1674 | //initial position | ||
1678 | popupPosition = QRect(popupOffset(anchorRect, anchorEdge, gravity, size) + offset + parentClientPos, size); | 1675 | popupPosition = QRect(popupOffset(anchorRect, anchorEdge, gravity, size) + offset + parentClientPos, size); | ||
1679 | 1676 | | |||
1680 | //if that fits, we don't need to do anything | 1677 | //if that fits, we don't need to do anything | ||
1681 | if (inBounds(popupPosition)) { | 1678 | if (inBounds(popupPosition)) { | ||
1682 | return popupPosition; | 1679 | return popupPosition; | ||
1683 | } | 1680 | } | ||
▲ Show 20 Lines • Show All 390 Lines • Show Last 20 Lines |