wayland: Drop SurfaceInterface::bufferScale property

There are no usages for it anymore. We may need another property to
specify the source box in the buffer in the future though.
master
Vlad Zahorodnii 1 year ago
parent 25dc2cefec
commit c31f5822fd

@ -641,82 +641,40 @@ void TestWaylandSurface::testScale()
QVERIFY(serverSurfaceCreated.wait());
SurfaceInterface *serverSurface = serverSurfaceCreated.first().first().value<KWaylandServer::SurfaceInterface *>();
QVERIFY(serverSurface);
QCOMPARE(serverSurface->bufferScale(), 1);
// let's change the scale factor
QSignalSpy bufferScaleChangedSpy(serverSurface, &SurfaceInterface::bufferScaleChanged);
// changing the scale implicitly changes the size
QSignalSpy sizeChangedSpy(serverSurface, &SurfaceInterface::sizeChanged);
s->setScale(2);
QCOMPARE(s->scale(), 2);
// needs a commit
QVERIFY(!bufferScaleChangedSpy.wait(100));
s->commit(KWayland::Client::Surface::CommitFlag::None);
QVERIFY(bufferScaleChangedSpy.wait());
QCOMPARE(bufferScaleChangedSpy.count(), 1);
QCOMPARE(bufferScaleChangedSpy.first().first().toInt(), 2);
QCOMPARE(serverSurface->bufferScale(), 2);
// even though we've changed the scale, if we don't have a buffer we
// don't have a size. If we don't have a size it can't have changed
QCOMPARE(sizeChangedSpy.count(), 0);
QCOMPARE(serverSurface->size(), QSize(0, 0));
// let's try changing to same factor, should not emit changed on server
s->setScale(2);
s->commit(KWayland::Client::Surface::CommitFlag::None);
QVERIFY(!bufferScaleChangedSpy.wait(100));
// but changing to a different value should still work
s->setScale(4);
s->commit(KWayland::Client::Surface::CommitFlag::None);
QVERIFY(bufferScaleChangedSpy.wait());
QCOMPARE(bufferScaleChangedSpy.count(), 2);
QCOMPARE(bufferScaleChangedSpy.first().first().toInt(), 2);
QCOMPARE(bufferScaleChangedSpy.last().first().toInt(), 4);
QCOMPARE(serverSurface->bufferScale(), 4);
bufferScaleChangedSpy.clear();
// attach a buffer of 100x100, our scale is 4, so this should be a size of 25x25
// attach a buffer of 100x100
QImage red(100, 100, QImage::Format_ARGB32_Premultiplied);
red.fill(QColor(255, 0, 0, 128));
QSharedPointer<KWayland::Client::Buffer> redBuffer = m_shm->createBuffer(red).toStrongRef();
QVERIFY(redBuffer);
s->attachBuffer(redBuffer.data());
s->damage(QRect(0, 0, 25, 25));
s->damageBuffer(QRect(0, 0, 100, 100));
s->commit(KWayland::Client::Surface::CommitFlag::None);
QVERIFY(sizeChangedSpy.wait());
QCOMPARE(sizeChangedSpy.count(), 1);
QCOMPARE(serverSurface->size(), QSize(25, 25));
sizeChangedSpy.clear();
bufferScaleChangedSpy.clear();
QCOMPARE(serverSurface->size(), QSize(100, 100));
// set the scale to 1, buffer is still 100x100 so size should change to 100x100
s->setScale(1);
// set the scale to 2, buffer is still 100x100 so size should change to 50x50
s->setScale(2);
s->commit(KWayland::Client::Surface::CommitFlag::None);
QVERIFY(sizeChangedSpy.wait());
QCOMPARE(sizeChangedSpy.count(), 1);
QCOMPARE(bufferScaleChangedSpy.count(), 1);
QCOMPARE(serverSurface->bufferScale(), 1);
QCOMPARE(serverSurface->size(), QSize(100, 100));
sizeChangedSpy.clear();
bufferScaleChangedSpy.clear();
QCOMPARE(sizeChangedSpy.count(), 2);
QCOMPARE(serverSurface->size(), QSize(50, 50));
// set scale and size in one commit, buffer is 50x50 at scale 2 so size should be 25x25
QImage blue(50, 50, QImage::Format_ARGB32_Premultiplied);
// set scale and size in one commit, buffer is 60x60 at scale 3 so size should be 20x20
QImage blue(60, 60, QImage::Format_ARGB32_Premultiplied);
red.fill(QColor(255, 0, 0, 128));
QSharedPointer<KWayland::Client::Buffer> blueBuffer = m_shm->createBuffer(blue).toStrongRef();
QVERIFY(blueBuffer);
s->attachBuffer(blueBuffer.data());
s->setScale(2);
s->setScale(3);
s->commit(KWayland::Client::Surface::CommitFlag::None);
QVERIFY(sizeChangedSpy.wait());
QCOMPARE(sizeChangedSpy.count(), 1);
QCOMPARE(bufferScaleChangedSpy.count(), 1);
QCOMPARE(serverSurface->bufferScale(), 2);
QCOMPARE(serverSurface->size(), QSize(25, 25));
QCOMPARE(sizeChangedSpy.count(), 3);
QCOMPARE(serverSurface->size(), QSize(20, 20));
}
void TestWaylandSurface::testUnmapOfNotMappedSurface()
@ -730,14 +688,13 @@ void TestWaylandSurface::testUnmapOfNotMappedSurface()
SurfaceInterface *serverSurface = serverSurfaceCreated.first().first().value<KWaylandServer::SurfaceInterface *>();
QSignalSpy unmappedSpy(serverSurface, &SurfaceInterface::unmapped);
QSignalSpy bufferScaleChanged(serverSurface, &SurfaceInterface::bufferScaleChanged);
QSignalSpy committedSpy(serverSurface, &SurfaceInterface::committed);
// let's map a null buffer and change scale to trigger a signal we can wait for
s->attachBuffer(KWayland::Client::Buffer::Ptr());
s->setScale(2);
s->commit(KWayland::Client::Surface::CommitFlag::None);
QVERIFY(bufferScaleChanged.wait());
QVERIFY(committedSpy.wait());
QVERIFY(unmappedSpy.isEmpty());
}

@ -555,7 +555,6 @@ void SurfaceInterfacePrivate::applyState(SurfaceState *next)
{
const bool bufferChanged = next->bufferIsSet;
const bool opaqueRegionChanged = next->opaqueIsSet;
const bool scaleFactorChanged = next->bufferScaleIsSet && (current.bufferScale != next->bufferScale);
const bool transformChanged = next->bufferTransformIsSet && (current.bufferTransform != next->bufferTransform);
const bool shadowChanged = next->shadowIsSet;
const bool blurChanged = next->blurIsSet;
@ -652,9 +651,6 @@ void SurfaceInterfacePrivate::applyState(SurfaceState *next)
if (oldInputRegion != inputRegion) {
Q_EMIT q->inputChanged(inputRegion);
}
if (scaleFactorChanged) {
Q_EMIT q->bufferScaleChanged(current.bufferScale);
}
if (transformChanged) {
Q_EMIT q->bufferTransformChanged(current.bufferTransform);
}
@ -802,11 +798,6 @@ QRegion SurfaceInterface::input() const
return d->inputRegion;
}
qint32 SurfaceInterface::bufferScale() const
{
return d->current.bufferScale;
}
KWin::Output::Transform SurfaceInterface::bufferTransform() const
{
return d->current.bufferTransform;

@ -77,7 +77,6 @@ class KWIN_EXPORT SurfaceInterface : public QObject
* The current input region.
*/
Q_PROPERTY(QRegion input READ input NOTIFY inputChanged)
Q_PROPERTY(qint32 bufferScale READ bufferScale NOTIFY bufferScaleChanged)
Q_PROPERTY(KWin::Output::Transform bufferTransform READ bufferTransform NOTIFY bufferTransformChanged)
Q_PROPERTY(QSizeF size READ size NOTIFY sizeChanged)
public:
@ -146,7 +145,6 @@ public:
QRegion opaque() const;
QRegion input() const;
QRegion bufferDamage() const;
qint32 bufferScale() const;
/**
* Returns the buffer transform that had been applied to the buffer to compensate for
* output rotation.
@ -369,10 +367,6 @@ Q_SIGNALS:
void damaged(const QRegion &);
void opaqueChanged(const QRegion &);
void inputChanged(const QRegion &);
/**
* This signal is emitted when the scale of the attached buffer has changed.
*/
void bufferScaleChanged(qint32);
/**
* This signal is emitted when the buffer transform has changed.
*/

Loading…
Cancel
Save