diff --git a/xdgshellclient.h b/xdgshellclient.h --- a/xdgshellclient.h +++ b/xdgshellclient.h @@ -189,6 +189,9 @@ QRect determineBufferGeometry() const; static void deleteClient(XdgShellClient *c); + QRect adjustMoveGeometry(const QRect &rect) const; + QRect adjustResizeGeometry(const QRect &rect) const; + KWayland::Server::XdgShellSurfaceInterface *m_xdgShellSurface; KWayland::Server::XdgShellPopupInterface *m_xdgShellPopup; diff --git a/xdgshellclient.cpp b/xdgshellclient.cpp --- a/xdgshellclient.cpp +++ b/xdgshellclient.cpp @@ -1136,7 +1136,14 @@ } //else serialId < m_lastAckedConfigureRequest and the state is now irrelevant and can be ignored } - doSetGeometry(QRect(position, m_windowGeometry.size() + QSize(borderLeft() + borderRight(), borderTop() + borderBottom()))); + QRect geometry = QRect(position, adjustedSize()); + if (isMove()) { + geometry = adjustMoveGeometry(geometry); + } + if (isResize()) { + geometry = adjustResizeGeometry(geometry); + } + doSetGeometry(geometry); updateMaximizeMode(maximizeMode); } @@ -1985,4 +1992,46 @@ return m_xdgShellSurface; } +QRect XdgShellClient::adjustMoveGeometry(const QRect &rect) const +{ + QRect geometry = rect; + geometry.moveTopLeft(moveResizeGeometry().topLeft()); + return geometry; +} + +QRect XdgShellClient::adjustResizeGeometry(const QRect &rect) const +{ + QRect geometry = rect; + + // We need to adjust frame geometry because configure events carry the maximum window geometry + // size. A client that has aspect ratio can attach a buffer with smaller size than the one in + // a configure event. + switch (moveResizePointerMode()) { + case PositionTopLeft: + geometry.moveRight(moveResizeGeometry().right()); + geometry.moveBottom(moveResizeGeometry().bottom()); + break; + case PositionTop: + case PositionTopRight: + geometry.moveLeft(moveResizeGeometry().left()); + geometry.moveBottom(moveResizeGeometry().bottom()); + break; + case PositionRight: + case PositionBottomRight: + case PositionBottom: + geometry.moveLeft(moveResizeGeometry().left()); + geometry.moveTop(moveResizeGeometry().top()); + break; + case PositionBottomLeft: + case PositionLeft: + geometry.moveRight(moveResizeGeometry().right()); + geometry.moveTop(moveResizeGeometry().top()); + break; + case PositionCenter: + Q_UNREACHABLE(); + } + + return geometry; +} + }