[server] Introduce mapped() signal
Summary: In KWin, we need to know when a sub-surface becomes mapped or unmapped so we can generate or filter out window quads for the sub-surface. Reviewers: #kwin, davidedmundson, apol Reviewed By: #kwin, davidedmundson, apol Differential Revision: https://phabricator.kde.org/D29256
This commit is contained in:
parent
9ef8ce53ce
commit
7c7d9a117b
3 changed files with 15 additions and 1 deletions
|
@ -400,9 +400,12 @@ void TestWaylandSurface::testAttachBuffer()
|
|||
s->commit(KWayland::Client::Surface::CommitFlag::None);
|
||||
QSignalSpy damageSpy(serverSurface, SIGNAL(damaged(QRegion)));
|
||||
QVERIFY(damageSpy.isValid());
|
||||
QSignalSpy mappedSpy(serverSurface, SIGNAL(mapped()));
|
||||
QVERIFY(mappedSpy.isValid());
|
||||
QSignalSpy unmappedSpy(serverSurface, SIGNAL(unmapped()));
|
||||
QVERIFY(unmappedSpy.isValid());
|
||||
QVERIFY(damageSpy.wait());
|
||||
QCOMPARE(mappedSpy.count(), 1);
|
||||
QVERIFY(unmappedSpy.isEmpty());
|
||||
|
||||
// now the ServerSurface should have the black image attached as a buffer
|
||||
|
@ -418,6 +421,7 @@ void TestWaylandSurface::testAttachBuffer()
|
|||
s->commit(KWayland::Client::Surface::CommitFlag::None);
|
||||
damageSpy.clear();
|
||||
QVERIFY(damageSpy.wait());
|
||||
QCOMPARE(mappedSpy.count(), 1);
|
||||
QVERIFY(unmappedSpy.isEmpty());
|
||||
KWaylandServer::BufferInterface *buffer2 = serverSurface->buffer();
|
||||
buffer2->ref();
|
||||
|
@ -445,6 +449,7 @@ void TestWaylandSurface::testAttachBuffer()
|
|||
s->commit();
|
||||
damageSpy.clear();
|
||||
QVERIFY(damageSpy.wait());
|
||||
QCOMPARE(mappedSpy.count(), 1);
|
||||
QVERIFY(unmappedSpy.isEmpty());
|
||||
QVERIFY(!buffer2->isReferenced());
|
||||
delete buffer2;
|
||||
|
@ -485,6 +490,7 @@ void TestWaylandSurface::testAttachBuffer()
|
|||
QCOMPARE(serverSurface->input(), QRegion(0, 0, 24, 24));
|
||||
QCOMPARE(serverSurface->buffer(), buffer3);
|
||||
QVERIFY(damageSpy.isEmpty());
|
||||
QCOMPARE(mappedSpy.count(), 1);
|
||||
QVERIFY(unmappedSpy.isEmpty());
|
||||
QVERIFY(serverSurface->isMapped());
|
||||
|
||||
|
@ -496,7 +502,7 @@ void TestWaylandSurface::testAttachBuffer()
|
|||
s->damage(QRect(0, 0, 10, 10));
|
||||
s->commit(KWayland::Client::Surface::CommitFlag::None);
|
||||
QVERIFY(unmappedSpy.wait());
|
||||
QVERIFY(!unmappedSpy.isEmpty());
|
||||
QCOMPARE(mappedSpy.count(), 1);
|
||||
QCOMPARE(unmappedSpy.count(), 1);
|
||||
QVERIFY(damageSpy.isEmpty());
|
||||
QVERIFY(!serverSurface->isMapped());
|
||||
|
|
|
@ -328,6 +328,7 @@ void SurfaceInterface::Private::swapStates(State *source, State *target, bool em
|
|||
const bool contrastChanged = source->contrastIsSet;
|
||||
const bool slideChanged = source->slideIsSet;
|
||||
const bool childrenChanged = source->childrenChanged;
|
||||
const bool visibilityChanged = bufferChanged && (bool(source->buffer) != bool(target->buffer));
|
||||
bool sizeChanged = false;
|
||||
auto buffer = target->buffer;
|
||||
if (bufferChanged) {
|
||||
|
@ -457,6 +458,9 @@ void SurfaceInterface::Private::swapStates(State *source, State *target, bool em
|
|||
target->damage = windowRegion.intersected(target->damage.united(bufferDamage));
|
||||
if (emitChanged) {
|
||||
subSurfaceIsMapped = true;
|
||||
if (visibilityChanged) {
|
||||
emit q->mapped();
|
||||
}
|
||||
trackedDamage = trackedDamage.united(target->damage);
|
||||
emit q->damaged(target->damage);
|
||||
// workaround for https://bugreports.qt.io/browse/QTBUG-52092
|
||||
|
|
|
@ -299,6 +299,10 @@ Q_SIGNALS:
|
|||
void inputChanged(const QRegion&);
|
||||
void scaleChanged(qint32);
|
||||
void transformChanged(KWaylandServer::OutputInterface::Transform);
|
||||
/**
|
||||
* Emitted when the Surface becomes visible, i.e. a non-null buffer has been attached.
|
||||
**/
|
||||
void mapped();
|
||||
/**
|
||||
* Emitted when the Surface removes its content
|
||||
**/
|
||||
|
|
Loading…
Reference in a new issue