Only commit XdgOutput::done if changed

Summary:
XdgOutput no-ops if one calls setLogicalSize(someSize)  and someSize
matches the last sent size

However, as we have an explicit done signal, we currently end up sending
this regardless.

This patches tracks if we've made any changes to commit in the done
event.

CCBUG: 400987

Reviewers: #kwin, romangg

Reviewed By: #kwin, romangg

Subscribers: romangg, kde-frameworks-devel

Tags: #frameworks

Differential Revision: https://phabricator.kde.org/D19255
This commit is contained in:
David Edmundson 2019-02-25 14:12:34 +00:00
parent 1cb96f6439
commit 58af3e8200

View file

@ -80,6 +80,7 @@ public:
void resourceDisconnected(XdgOutputV1Interface *resource); void resourceDisconnected(XdgOutputV1Interface *resource);
QPoint pos; QPoint pos;
QSize size; QSize size;
bool dirty = false;
bool doneOnce = false; bool doneOnce = false;
QList<XdgOutputV1Interface*> resources; QList<XdgOutputV1Interface*> resources;
}; };
@ -187,6 +188,7 @@ void XdgOutputInterface::setLogicalSize(const QSize &size)
return; return;
} }
d->size = size; d->size = size;
d->dirty = true;
for(auto resource: d->resources) { for(auto resource: d->resources) {
resource->setLogicalSize(size); resource->setLogicalSize(size);
} }
@ -203,6 +205,7 @@ void XdgOutputInterface::setLogicalPosition(const QPoint &pos)
return; return;
} }
d->pos = pos; d->pos = pos;
d->dirty = true;
for(auto resource: d->resources) { for(auto resource: d->resources) {
resource->setLogicalPosition(pos); resource->setLogicalPosition(pos);
} }
@ -216,6 +219,10 @@ QPoint XdgOutputInterface::logicalPosition() const
void XdgOutputInterface::done() void XdgOutputInterface::done()
{ {
d->doneOnce = true; d->doneOnce = true;
if (!d->dirty) {
return;
}
d->dirty = false;
for(auto resource: d->resources) { for(auto resource: d->resources) {
resource->done(); resource->done();
} }