From 985601e0a41a84ffab51bc942824bd48bc8a6290 Mon Sep 17 00:00:00 2001 From: David Edmundson Date: Tue, 9 Apr 2019 11:13:38 +0100 Subject: [PATCH] [wayland] Queue XDG configure requests when resizing toplevel interactively Summary: When resizing a window particularly from the left side, we need to co-ordinate moving the window with when we get the resized buffer. The code in AbstractClient::handleMoveResize checks isWaitingForResizSync to make sure we never send more than one resize request at a time to keep that in sync. This makes sense on X and wl_shell_surface, but not on XDGShell where we can track which resize events have been handled by the client. ShellClient already keeps a stack of our pending configure requests and handles everything appropriately, we don't need to block. This results in a smoother dragging experience and avoids a potential deadlock currently seen when a client may not reply to a no-op configure request. CCBUG: 403376 Test Plan: Async ack handling is covered by existing unit tests Reviewers: #kwin, zzag Reviewed By: #kwin, zzag Subscribers: zzag, kwin Tags: #kwin Differential Revision: https://phabricator.kde.org/D20397 --- shell_client.cpp | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/shell_client.cpp b/shell_client.cpp index 1f46196983..c7487ce861 100644 --- a/shell_client.cpp +++ b/shell_client.cpp @@ -619,8 +619,10 @@ void ShellClient::setGeometry(int x, int y, int w, int h, ForceGeometry_t force) } // TODO: better merge with Client's implementation const QSize requestedClientSize = QSize(w, h) - QSize(borderLeft() + borderRight(), borderTop() + borderBottom()); - if (requestedClientSize == m_clientSize && !isWaitingForMoveResizeSync()) { - // size didn't change, update directly + + if (requestedClientSize == m_clientSize && !isWaitingForMoveResizeSync() && + (m_requestedClientSize.isEmpty() || requestedClientSize == m_requestedClientSize)) { + // size didn't change, and we don't need to explicitly request a new size doSetGeometry(QRect(x, y, w, h)); updateMaximizeMode(m_requestedMaximizeMode); } else { @@ -1656,7 +1658,10 @@ QPoint ShellClient::popupOffset(const QRect &anchorRect, const Qt::Edges anchorE bool ShellClient::isWaitingForMoveResizeSync() const { - return !m_pendingConfigureRequests.isEmpty(); + if (m_shellSurface) { + return !m_pendingConfigureRequests.isEmpty(); + } + return false; } void ShellClient::doResizeSync()