diff --git a/src/backends/libinput/connection.cpp b/src/backends/libinput/connection.cpp index 2ba725e6a1..5ee27b492e 100644 --- a/src/backends/libinput/connection.cpp +++ b/src/backends/libinput/connection.cpp @@ -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) { diff --git a/src/backends/libinput/device.cpp b/src/backends/libinput/device.cpp index c1093db42b..a5ae78f0c5 100644 --- a/src/backends/libinput/device.cpp +++ b/src/backends/libinput/device.cpp @@ -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)