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
This commit is contained in:
parent
e45cc7a807
commit
2c874fc3e0
2 changed files with 11 additions and 15 deletions
|
@ -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)
|
||||
|
|
Loading…
Reference in a new issue