From 89860918785590d93ea7e197ffb94700f78b3c35 Mon Sep 17 00:00:00 2001 From: Nicolas Fella Date: Tue, 8 Nov 2022 15:43:56 +0100 Subject: [PATCH] [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 --- src/backends/libinput/connection.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/backends/libinput/connection.cpp b/src/backends/libinput/connection.cpp index 78139499a8..0efbd4bb9d 100644 --- a/src/backends/libinput/connection.cpp +++ b/src/backends/libinput/connection.cpp @@ -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; }