Commit f820a318 authored by Aleix Pol Gonzalez's avatar Aleix Pol Gonzalez 🐧 Committed by Vlad Zahorodnii
Browse files

tablet: Ensure persistency of the outputName property

With this change, when the specified output is disconnected, it will
just behave as if none were selected but when it's connected again it
will pick it back up.

BUG: 456857


(cherry picked from commit 2c874fc3)
parent 8d883e84
Pipeline #237360 passed with stage
in 21 minutes and 36 seconds
......@@ -529,7 +529,7 @@ void Connection::applyScreenToDevice(Device *device)
{
#ifndef KWIN_BUILD_TESTING
QMutexLocker locker(&m_mutex);
if (!device->isTouch()) {
if (!device->isTouch() && !device->isTabletTool()) {
return;
}
......@@ -549,7 +549,7 @@ void Connection::applyScreenToDevice(Device *device)
}
}
}
if (!deviceOutput) {
if (!deviceOutput && device->isTouch()) {
// do we have an internal screen?
Output *internalOutput = nullptr;
for (Output *output : outputs) {
......
......@@ -628,8 +628,12 @@ void Device::setOrientation(Qt::ScreenOrientation orientation)
void Device::setOutputName(const QString &name)
{
#ifndef KWIN_BUILD_TESTING
if (name == m_outputName) {
return;
}
setOutput(nullptr);
if (name.isEmpty()) {
setOutput(nullptr);
return;
}
auto outputs = kwinApp()->platform()->outputs();
......@@ -642,6 +646,10 @@ void Device::setOutputName(const QString &name)
break;
}
}
m_outputName = name;
writeEntry(ConfigKey::OutputName, name);
Q_EMIT outputNameChanged();
#else
Q_UNUSED(name)
#endif
......@@ -654,19 +662,7 @@ Output *Device::output() const
void Device::setOutput(Output *output)
{
#ifndef KWIN_BUILD_TESTING
m_output = output;
if (m_output) {
m_outputName = output->name();
writeEntry(ConfigKey::OutputName, output->name());
} else {
m_outputName = QString();
writeEntry(ConfigKey::OutputName, QString());
}
Q_EMIT outputNameChanged();
#else
Q_UNUSED(output)
#endif
}
static libinput_led toLibinputLEDS(LEDs leds)
......
Supports Markdown
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