summaryrefslogtreecommitdiff
path: root/src/plugins/shellintegration
diff options
context:
space:
mode:
authorIlya Fedin <fedin-ilja2010@ya.ru>2022-08-08 03:56:07 +0400
committerQt Cherry-pick Bot <cherrypick_bot@qt-project.org>2022-08-22 22:17:34 +0000
commit4ba9781843a7c469b650c9346b5e3a927130cb09 (patch)
treee46d265945f6141e725e09c708549a5d79f6f30c /src/plugins/shellintegration
parent5d73be49d850fe83c4fb514cbe02ee5f73001846 (diff)
downloadqtwayland-4ba9781843a7c469b650c9346b5e3a927130cb09.tar.gz
Client: add custom margins support to xdg popups
xdg_positioner operates in window content geometry (i.e. without shadows), so it's necessary to remove popup's and parent's shadow from position and size calculations. Change-Id: I997ba2c45ae341a09a8284226629e8107800e894 Reviewed-by: David Edmundson <davidedmundson@kde.org> (cherry picked from commit 2a4dc215756ff2f3fe966a689eea4cf4c7b11b7d) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
Diffstat (limited to 'src/plugins/shellintegration')
-rw-r--r--src/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp b/src/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp
index c4b1942b..415bcad2 100644
--- a/src/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp
+++ b/src/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp
@@ -407,8 +407,10 @@ void QWaylandXdgSurface::setPopup(QWaylandWindow *parent)
auto positioner = new QtWayland::xdg_positioner(m_shell->create_positioner());
// set_popup expects a position relative to the parent
- QPoint transientPos = m_window->geometry().topLeft(); // this is absolute
- transientPos -= parent->geometry().topLeft();
+ QPoint topLeftMargins = QPoint(m_window->customMargins().left(), m_window->customMargins().top());
+ QPoint parentMargins = QPoint(parent->customMargins().left(), parent->customMargins().top());
+ QPoint transientPos = m_window->geometry().topLeft() + topLeftMargins; // this is absolute
+ transientPos -= parent->geometry().topLeft() + parentMargins;
if (parent->decoration()) {
transientPos.setX(transientPos.x() + parent->decoration()->margins(QWaylandAbstractDecoration::ShadowsExcluded).left());
transientPos.setY(transientPos.y() + parent->decoration()->margins(QWaylandAbstractDecoration::ShadowsExcluded).top());
@@ -416,7 +418,7 @@ void QWaylandXdgSurface::setPopup(QWaylandWindow *parent)
positioner->set_anchor_rect(transientPos.x(), transientPos.y(), 1, 1);
positioner->set_anchor(QtWayland::xdg_positioner::anchor_top_left);
positioner->set_gravity(QtWayland::xdg_positioner::gravity_bottom_right);
- positioner->set_size(m_window->geometry().width(), m_window->geometry().height());
+ positioner->set_size(m_window->windowContentGeometry().width(), m_window->windowContentGeometry().height());
positioner->set_constraint_adjustment(QtWayland::xdg_positioner::constraint_adjustment_slide_x
| QtWayland::xdg_positioner::constraint_adjustment_slide_y
| QtWayland::xdg_positioner::constraint_adjustment_flip_x