Commit f8760c97 authored by David Edmundson's avatar David Edmundson
Browse files

[surface] Fix buffer offset when attaching buffers to surfaces

Test Plan:
Unit test
Will be tested by hotspots in drag icons

Reviewers: #kwin

Subscribers: kde-frameworks-devel

Tags: #frameworks

Differential Revision: https://phabricator.kde.org/D27190
parent f1754ba8
......@@ -289,10 +289,11 @@ void TestWaylandSurface::testDamage()
QImage img(QSize(10, 10), QImage::Format_ARGB32_Premultiplied);
img.fill(Qt::black);
auto b = m_shm->createBuffer(img);
s->attachBuffer(b);
s->attachBuffer(b, QPoint(55, 55));
s->damage(QRect(0, 0, 10, 10));
s->commit(KWayland::Client::Surface::CommitFlag::None);
QVERIFY(damageSpy.wait());
QCOMPARE(serverSurface->offset(), QPoint(55, 55)); // offset is surface local so scale doesn't change this
QCOMPARE(serverSurface->damage(), QRegion(0, 0, 5, 5)); // scale is 2
QCOMPARE(damageSpy.first().first().value<QRegion>(), QRegion(0, 0, 5, 5));
QVERIFY(serverSurface->isMapped());
......
......@@ -374,6 +374,7 @@ void SurfaceInterface::Private::swapStates(State *source, State *target, bool em
// copy values
if (bufferChanged) {
target->buffer = buffer;
target->offset = source->offset;
target->damage = source->damage;
target->bufferDamage = source->bufferDamage;
target->bufferIsSet = source->bufferIsSet;
......
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