Commit 56fb507a authored by David Edmundson's avatar David Edmundson

[wayland] Squash reconfigure methods

Summary:
We can handle the case of a null size inside
ShellClient::requestGeometry and that makes that method more robust.

With that we don't need to handle separate code paths in
the handler of RequestGeometryBlocker.

It's not an exact identical code path, but everything still works out.

If the geometry is unchanged, we'll save the positionAfterResize  but
when we apply it doSetGeometry will no-op.

There's also an assumption that toggling maximised will always send a
valid size, but that's true for the current state.

Test Plan: Ran unit tests

Reviewers: #kwin, zzag

Reviewed By: #kwin, zzag

Subscribers: kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D19331
parent a039f3ba
......@@ -1084,29 +1084,39 @@ bool ShellClient::requestGeometry(const QRect &rect)
m_blockedRequestGeometry = rect;
return false;
}
PendingConfigureRequest configureRequest;
configureRequest.positionAfterResize = rect.topLeft();
configureRequest.maximizeMode = m_requestedMaximizeMode;
const QSize size = rect.size() - QSize(borderLeft() + borderRight(), borderTop() + borderBottom());
QSize size;
if (rect.isValid()) {
size = rect.size() - QSize(borderLeft() + borderRight(), borderTop() + borderBottom());
} else {
size = QSize(0, 0);
}
m_requestedClientSize = size;
if (m_shellSurface) {
quint64 serialId = 0;
if (m_shellSurface && !size.isEmpty()) {
m_shellSurface->requestSize(size);
}
if (m_xdgShellSurface) {
configureRequest.serialId = m_xdgShellSurface->configure(xdgSurfaceStates(), size);
serialId = m_xdgShellSurface->configure(xdgSurfaceStates(), size);
}
if (m_xdgShellPopup) {
auto parent = transientFor();
if (parent) {
const QPoint globalClientContentPos = parent->geometry().topLeft() + parent->clientPos();
const QPoint relativeOffset = rect.topLeft() -globalClientContentPos;
configureRequest.serialId = m_xdgShellPopup->configure(QRect(relativeOffset, rect.size()));
const QPoint relativeOffset = rect.topLeft() - globalClientContentPos;
serialId = m_xdgShellPopup->configure(QRect(relativeOffset, rect.size()));
}
}
m_pendingConfigureRequests.append(configureRequest);
if (rect.isValid()) { //if there's no requested size, then there's implicity no positional information worth using
PendingConfigureRequest configureRequest;
configureRequest.serialId = serialId;
configureRequest.positionAfterResize = rect.topLeft();
configureRequest.maximizeMode = m_requestedMaximizeMode;
m_pendingConfigureRequests.append(configureRequest);
}
m_blockedRequestGeometry = QRect();
return true;
......
......@@ -269,11 +269,7 @@ private:
{
m_client->m_requestGeometryBlockCounter--;
if (m_client->m_requestGeometryBlockCounter == 0) {
if (m_client->m_blockedRequestGeometry.isValid()) {
m_client->requestGeometry(m_client->m_blockedRequestGeometry);
} else if (m_client->m_xdgShellSurface) {
m_client->m_xdgShellSurface->configure(m_client->xdgSurfaceStates());
}
m_client->requestGeometry(m_client->m_blockedRequestGeometry);
}
}
private:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment