From 16c7650d760f2d0b9e2d0d826b820963dc3d018c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Gr=C3=A4=C3=9Flin?= Date: Fri, 18 Nov 2016 12:32:05 +0100 Subject: [PATCH] Fix AbstractClient::sizeForClientSize Summary: The method is supposed to return the AbstractClient's size for a given client size. That is the size including the window decoration. The default implementation returned the passed in client size without adjusting for the decoration. This resulted in ShellClient getting a wrong size especially when AbstractClient::adjustedClientSize (which calls sizeForClientSize) was called. The result of the incorrect size was for example a shrinking of the window when starting to resize a window. BUG: 370345 FIXED-IN: 5.8.4 Reviewers: #kwin, #plasma_on_wayland, broulik, subdiff Subscribers: plasma-devel, kwin Tags: #plasma_on_wayland, #kwin Differential Revision: https://phabricator.kde.org/D3414 --- abstract_client.cpp | 2 +- autotests/integration/shell_client_test.cpp | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/abstract_client.cpp b/abstract_client.cpp index 8eb6476012..79974c81b7 100644 --- a/abstract_client.cpp +++ b/abstract_client.cpp @@ -1146,7 +1146,7 @@ QSize AbstractClient::sizeForClientSize(const QSize &wsize, Sizemode mode, bool { Q_UNUSED(mode) Q_UNUSED(noframe) - return wsize; + return wsize + QSize(borderLeft() + borderRight(), borderTop() + borderBottom()); } void AbstractClient::addRepaintDuringGeometryUpdates() diff --git a/autotests/integration/shell_client_test.cpp b/autotests/integration/shell_client_test.cpp index 6aed3e385e..e05ab5590a 100644 --- a/autotests/integration/shell_client_test.cpp +++ b/autotests/integration/shell_client_test.cpp @@ -334,6 +334,7 @@ void TestShellClient::testFullscreen() QVERIFY(!c->isFullScreen()); QCOMPARE(c->clientSize(), QSize(100, 50)); QCOMPARE(c->isDecorated(), decoMode == ServerSideDecoration::Mode::Server); + QCOMPARE(c->sizeForClientSize(c->clientSize()), c->geometry().size()); QSignalSpy fullscreenChangedSpy(c, &ShellClient::fullScreenChanged); QVERIFY(fullscreenChangedSpy.isValid()); QSignalSpy geometryChangedSpy(c, &ShellClient::geometryChanged);