wayland: Properly update subsurfaces in cached transaction

Cached transaction will be merged with parent transaction when the
parent surface is committed, it's not included in the transaction graph.
This commit is contained in:
Vlad Zahorodnii 2023-10-06 11:55:36 +03:00
parent 7e99ab9438
commit 8d3b4a21c8

View file

@ -63,6 +63,12 @@ void SurfaceInterfacePrivate::addChild(SubSurfaceInterface *child)
current->subsurface.above.append(child); current->subsurface.above.append(child);
pending->subsurface.above.append(child); pending->subsurface.above.append(child);
if (subsurface.transaction) {
subsurface.transaction->amend(q, [child](SurfaceState *state) {
state->subsurface.above.append(child);
});
}
for (auto transaction = firstTransaction; transaction; transaction = transaction->next(q)) { for (auto transaction = firstTransaction; transaction; transaction = transaction->next(q)) {
transaction->amend(q, [child](SurfaceState *state) { transaction->amend(q, [child](SurfaceState *state) {
state->subsurface.above.append(child); state->subsurface.above.append(child);
@ -90,6 +96,13 @@ void SurfaceInterfacePrivate::removeChild(SubSurfaceInterface *child)
pending->subsurface.below.removeAll(child); pending->subsurface.below.removeAll(child);
pending->subsurface.above.removeAll(child); pending->subsurface.above.removeAll(child);
if (subsurface.transaction) {
subsurface.transaction->amend(q, [child](SurfaceState *state) {
state->subsurface.below.removeOne(child);
state->subsurface.above.removeOne(child);
});
}
for (auto transaction = firstTransaction; transaction; transaction = transaction->next(q)) { for (auto transaction = firstTransaction; transaction; transaction = transaction->next(q)) {
transaction->amend(q, [child](SurfaceState *state) { transaction->amend(q, [child](SurfaceState *state) {
state->subsurface.below.removeOne(child); state->subsurface.below.removeOne(child);