[libinput] Re-run touchscreen->output mapping when externally clearing output name

When setting a device's output name externally we assign the relevant output to the device

If we pass an empty name we set a null output, which causes a crash the next time the touchscreen is touched

Since passing an empty name semantically means 'Detect output automatically' rerun the mapping heuristic so we get a valid output
This commit is contained in:
Nicolas Fella 2022-11-08 15:43:56 +01:00
parent a054093580
commit 8986091878

View file

@ -277,6 +277,14 @@ void Connection::processEvents()
applyDeviceConfig(device);
applyScreenToDevice(device);
connect(device, &Device::outputNameChanged, this, [this, device] {
// If the output name changes from something to empty we need to
// re-run the assignment heuristic so that an output is assinged
if (device->outputName().isEmpty()) {
applyScreenToDevice(device);
}
});
Q_EMIT deviceAdded(device);
break;
}