plugins/x11: Emit outputAdded and outputRemoved

Currently, these two signals are emitted primarily only on Wayland, but
in order to have consistent core API, it's better to emit them on X11 too.
This commit is contained in:
Vlad Zahorodnii 2020-12-02 20:10:51 +02:00
parent 389407805c
commit 2d5482b013
2 changed files with 9 additions and 2 deletions

View file

@ -431,13 +431,17 @@ void X11StandalonePlatform::doUpdateOutputs()
o->setRefreshRate(60000);
o->setName(QStringLiteral("Xinerama"));
m_outputs << o;
emit outputAdded(o);
};
// TODO: instead of resetting all outputs, check if new output is added/removed
// or still available and leave still available outputs in m_outputs
// untouched (like in DRM backend)
qDeleteAll(m_outputs);
m_outputs.clear();
while (!m_outputs.isEmpty()) {
X11Output *output = m_outputs.takeLast();
emit outputRemoved(output);
delete output;
}
if (!Xcb::Extensions::self()->isRandrAvailable()) {
fallback();
@ -523,6 +527,7 @@ void X11StandalonePlatform::doUpdateOutputs()
}
m_outputs << o;
emit outputAdded(o);
}
}

View file

@ -177,6 +177,7 @@ void X11WindowedBackend::createOutputs()
logicalWidthSum += logicalWidth;
m_outputs << output;
emit outputAdded(output);
}
updateWindowTitle();
@ -381,6 +382,7 @@ void X11WindowedBackend::handleClientMessage(xcb_client_message_event_t *event)
x += (*it)->geometry().width();
}
emit outputRemoved(removedOutput);
delete removedOutput;
QMetaObject::invokeMethod(screens(), "updateCount");
}