Properly render XWayland windows in SceneQPainter

Summary:
The buffer for a XWayland window is larger than the actual size. Thus
we need to use the clientSize as reference, not the buffer size.

BUG: 382748

Test Plan: Test passes

Reviewers: #kwin, #plasma

Subscribers: plasma-devel, kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D6952
icc-effect-5.14.5
Martin Flöser 2017-07-27 17:15:04 +02:00
parent afd52c188a
commit 20e314d151
2 changed files with 6 additions and 2 deletions

View File

@ -372,7 +372,6 @@ void SceneQPainterTest::testX11Window()
const QPoint startPos = client->pos() + client->clientPos();
auto image = scene->backend()->buffer();
QEXPECT_FAIL("", "BUG 382748", Continue);
QCOMPARE(image->copy(QRect(startPos, client->clientSize())), compareImage);
// and destroy the window again

View File

@ -310,7 +310,12 @@ void SceneQPainter::Window::performPaint(int mask, QRegion region, WindowPaintDa
// render content
const QRect target = QRect(toplevel->clientPos(), toplevel->clientSize());
const QRect src = QRect(toplevel->clientPos() + toplevel->clientContentPos(), pixmap->image().size());
QSize srcSize = pixmap->image().size();
if (pixmap->surface() && pixmap->surface()->scale() == 1 && srcSize != toplevel->clientSize()) {
// special case for XWayland windows
srcSize = toplevel->clientSize();
}
const QRect src = QRect(toplevel->clientPos() + toplevel->clientContentPos(), srcSize);
painter->drawImage(target, pixmap->image(), src);
// render subsurfaces