Introduce Platform::{outputEnabled,outputDisabled} signals
These signals can be useful if you want to know what output exactly has been disabled or enabled. The outputEnabled signal is emitted after the outputAdded signal, and the outputDisabled signal is emitted before the outputRemoved signal.
This commit is contained in:
parent
1b31f5279a
commit
5943eea4c9
7 changed files with 29 additions and 1 deletions
13
platform.h
13
platform.h
|
@ -507,6 +507,19 @@ Q_SIGNALS:
|
|||
* This signal is emitted when an output has been disconnected.
|
||||
*/
|
||||
void outputRemoved(AbstractOutput *output);
|
||||
/**
|
||||
* This signal is emitted when the @a output has become activated and it is ready for
|
||||
* compositing.
|
||||
*/
|
||||
void outputEnabled(AbstractOutput *output);
|
||||
/**
|
||||
* This signal is emitted when the @a output has been deactivated and it is no longer
|
||||
* being composited. The outputDisabled() signal is guaranteed to be emitted before the
|
||||
* output is removed.
|
||||
*
|
||||
* @see outputEnabled, outputRemoved
|
||||
*/
|
||||
void outputDisabled(AbstractOutput *output);
|
||||
|
||||
protected:
|
||||
explicit Platform(QObject *parent = nullptr);
|
||||
|
|
|
@ -342,13 +342,16 @@ void DrmBackend::addOutput(DrmOutput *o)
|
|||
m_enabledOutputs.append(o);
|
||||
emit o->gpu()->outputEnabled(o);
|
||||
emit outputAdded(o);
|
||||
emit outputEnabled(o);
|
||||
}
|
||||
|
||||
void DrmBackend::removeOutput(DrmOutput *o)
|
||||
{
|
||||
emit o->gpu()->outputDisabled(o);
|
||||
if (m_enabledOutputs.removeOne(o)) {
|
||||
emit outputDisabled(o);
|
||||
}
|
||||
m_outputs.removeOne(o);
|
||||
m_enabledOutputs.removeOne(o);
|
||||
emit outputRemoved(o);
|
||||
}
|
||||
|
||||
|
@ -470,11 +473,13 @@ void DrmBackend::enableOutput(DrmOutput *output, bool enable)
|
|||
Q_ASSERT(!m_enabledOutputs.contains(output));
|
||||
m_enabledOutputs << output;
|
||||
emit output->gpu()->outputEnabled(output);
|
||||
emit outputEnabled(output);
|
||||
} else {
|
||||
Q_ASSERT(m_enabledOutputs.contains(output));
|
||||
m_enabledOutputs.removeOne(output);
|
||||
Q_ASSERT(!m_enabledOutputs.contains(output));
|
||||
emit output->gpu()->outputDisabled(output);
|
||||
emit outputDisabled(output);
|
||||
}
|
||||
updateOutputsEnabled();
|
||||
checkOutputsAreOn();
|
||||
|
|
|
@ -146,6 +146,7 @@ bool FramebufferBackend::handleScreenInfo()
|
|||
output->init(QSize(varinfo.xres, varinfo.yres), QSize(varinfo.width, varinfo.height));
|
||||
m_outputs << output;
|
||||
emit outputAdded(output);
|
||||
emit outputEnabled(output);
|
||||
|
||||
m_id = QByteArray(fixinfo.id);
|
||||
m_red = {varinfo.red.offset, varinfo.red.length};
|
||||
|
|
|
@ -218,6 +218,7 @@ void HwcomposerBackend::init()
|
|||
}
|
||||
|
||||
emit outputAdded(m_output.data());
|
||||
emit outputEnabled(m_output.data());
|
||||
|
||||
if (m_lights) {
|
||||
using namespace KWaylandServer;
|
||||
|
|
|
@ -61,6 +61,7 @@ void VirtualBackend::init()
|
|||
dummyOutput->init(QPoint(0, 0), initialWindowSize());
|
||||
m_outputs << dummyOutput ;
|
||||
emit outputAdded(dummyOutput);
|
||||
emit outputEnabled(dummyOutput);
|
||||
}
|
||||
|
||||
setSoftwareCursorForced(true);
|
||||
|
@ -114,6 +115,7 @@ void VirtualBackend::setVirtualOutputs(int count, QVector<QRect> geometries, QVe
|
|||
|
||||
while (!m_outputs.isEmpty()) {
|
||||
VirtualOutput *output = m_outputs.takeLast();
|
||||
emit outputDisabled(output);
|
||||
emit outputRemoved(output);
|
||||
delete output;
|
||||
}
|
||||
|
@ -133,6 +135,7 @@ void VirtualBackend::setVirtualOutputs(int count, QVector<QRect> geometries, QVe
|
|||
}
|
||||
m_outputs.append(vo);
|
||||
emit outputAdded(vo);
|
||||
emit outputEnabled(vo);
|
||||
}
|
||||
|
||||
emit virtualOutputsSet(countChanged);
|
||||
|
|
|
@ -442,6 +442,7 @@ void X11StandalonePlatform::doUpdateOutputs()
|
|||
o->setName(QStringLiteral("Xinerama"));
|
||||
m_outputs << o;
|
||||
emit outputAdded(o);
|
||||
emit outputEnabled(o);
|
||||
};
|
||||
|
||||
// TODO: instead of resetting all outputs, check if new output is added/removed
|
||||
|
@ -449,6 +450,7 @@ void X11StandalonePlatform::doUpdateOutputs()
|
|||
// untouched (like in DRM backend)
|
||||
while (!m_outputs.isEmpty()) {
|
||||
X11Output *output = m_outputs.takeLast();
|
||||
emit outputDisabled(output);
|
||||
emit outputRemoved(output);
|
||||
delete output;
|
||||
}
|
||||
|
@ -538,6 +540,7 @@ void X11StandalonePlatform::doUpdateOutputs()
|
|||
|
||||
m_outputs << o;
|
||||
emit outputAdded(o);
|
||||
emit outputEnabled(o);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -177,6 +177,7 @@ void X11WindowedBackend::createOutputs()
|
|||
logicalWidthSum += logicalWidth;
|
||||
m_outputs << output;
|
||||
emit outputAdded(output);
|
||||
emit outputEnabled(output);
|
||||
}
|
||||
|
||||
updateWindowTitle();
|
||||
|
@ -381,6 +382,7 @@ void X11WindowedBackend::handleClientMessage(xcb_client_message_event_t *event)
|
|||
x += (*it)->geometry().width();
|
||||
}
|
||||
|
||||
emit outputDisabled(removedOutput);
|
||||
emit outputRemoved(removedOutput);
|
||||
delete removedOutput;
|
||||
QMetaObject::invokeMethod(screens(), "updateCount");
|
||||
|
|
Loading…
Reference in a new issue