Commit a4aa09ef authored by Fabian Vogt's avatar Fabian Vogt

Honour the preferred mode flag in the kwayland backend

Summary: BUG: 386900

Test Plan:
Ran plasma on wayland in virtio, instead of switching to 4096x2160@60
it stays at the right resolution of 1024x768@60 on startup and kscreen-doctor
shows that it's indeed set as the preferred mode.

Reviewers: #plasma, sebas, graesslin

Reviewed By: #plasma, graesslin

Subscribers: plasma-devel

Tags: #plasma

Differential Revision: https://phabricator.kde.org/D8828
parent e6109ab9
......@@ -151,6 +151,7 @@ void testWaylandBackend::verifyOutputs()
QVERIFY(output->geometry() != QRectF());
QVERIFY(output->sizeMm() != QSize());
QVERIFY(output->edid() != 0);
QVERIFY(output->preferredModes().size() == 1);
QCOMPARE(output->rotation(), Output::None);
QVERIFY(!ids.contains(output->id()));
ids << output->id();
......
......@@ -131,6 +131,7 @@ void WaylandOutput::updateKScreenOutput(KScreen::OutputPtr &output)
output->setPos(m_output->globalPosition());
output->setRotation(m_rotationMap[m_output->transform()]);
KScreen::ModeList modeList;
QStringList preferredModeIds;
m_modeIdMap.clear();
QString currentModeId = QStringLiteral("-1");
Q_FOREACH (const KWayland::Client::OutputDevice::Mode &m, m_output->modes()) {
......@@ -152,6 +153,9 @@ void WaylandOutput::updateKScreenOutput(KScreen::OutputPtr &output)
if (m.flags.testFlag(KWayland::Client::OutputDevice::Mode::Flag::Current)) {
currentModeId = modeid;
}
if (m.flags.testFlag(KWayland::Client::OutputDevice::Mode::Flag::Preferred)) {
preferredModeIds << modeid;
}
// Update the kscreen => kwayland mode id translation map
m_modeIdMap.insert(modeid, m.id);
// Add to the modelist which gets set on the output
......@@ -162,6 +166,7 @@ void WaylandOutput::updateKScreenOutput(KScreen::OutputPtr &output)
}
output->setCurrentModeId(currentModeId);
output->setPreferredModes(preferredModeIds);
output->setModes(modeList);
output->setScale(m_output->scale());
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment