Improve our reaction when primary changes
Ensure we sanitise the input so a client can't randomly crash KWin that way.
This commit is contained in:
parent
039b1d031e
commit
afd525ced0
1 changed files with 9 additions and 2 deletions
|
@ -158,8 +158,15 @@ void Platform::requestOutputsChange(KWaylandServer::OutputConfigurationV2Interfa
|
||||||
}
|
}
|
||||||
|
|
||||||
if (applyOutputChanges(cfg)) {
|
if (applyOutputChanges(cfg)) {
|
||||||
if (config->primaryChanged()) {
|
if (config->primaryChanged() || !primaryOutput()->isEnabled()) {
|
||||||
setPrimaryOutput(findOutput(config->primary()->uuid()));
|
auto requestedPrimaryOutput = findOutput(config->primary()->uuid());
|
||||||
|
if (requestedPrimaryOutput && requestedPrimaryOutput->isEnabled()) {
|
||||||
|
setPrimaryOutput(requestedPrimaryOutput);
|
||||||
|
} else {
|
||||||
|
auto defaultPrimaryOutput = enabledOutputs().constFirst();
|
||||||
|
qCWarning(KWIN_CORE) << "Requested invalid primary screen, using" << defaultPrimaryOutput;
|
||||||
|
setPrimaryOutput(defaultPrimaryOutput);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
Q_EMIT screens()->changed();
|
Q_EMIT screens()->changed();
|
||||||
config->setApplied();
|
config->setApplied();
|
||||||
|
|
Loading…
Reference in a new issue