libinput: Ignore touch events without outputs

A touch device could have no output object assigned due to the screen
being disabled, queued events or malconfiguration.

Using output would crash. Touch up is guarded so that we have matching
pairs.

BUG: 463385
This commit is contained in:
David Edmundson 2022-12-27 10:21:31 +00:00 committed by Vlad Zahorodnii
parent f094b3693c
commit 0167b7d7b0

View file

@ -380,6 +380,10 @@ void Connection::processEvents()
#ifndef KWIN_BUILD_TESTING
TouchEvent *te = static_cast<TouchEvent *>(event.get());
const auto *output = te->device()->output();
if (!output) {
qCWarning(KWIN_LIBINPUT) << "Touch down received for device with no output assigned";
break;
}
const QPointF globalPos = devicePointToGlobalPosition(te->absolutePos(output->modeSize()), output);
Q_EMIT te->device()->touchDown(te->id(), globalPos, te->time(), te->device());
break;
@ -387,6 +391,10 @@ void Connection::processEvents()
}
case LIBINPUT_EVENT_TOUCH_UP: {
TouchEvent *te = static_cast<TouchEvent *>(event.get());
const auto *output = te->device()->output();
if (!output) {
break;
}
Q_EMIT te->device()->touchUp(te->id(), te->time(), te->device());
break;
}
@ -394,6 +402,9 @@ void Connection::processEvents()
#ifndef KWIN_BUILD_TESTING
TouchEvent *te = static_cast<TouchEvent *>(event.get());
const auto *output = te->device()->output();
if (!output) {
break;
}
const QPointF globalPos = devicePointToGlobalPosition(te->absolutePos(output->modeSize()), output);
Q_EMIT te->device()->touchMotion(te->id(), globalPos, te->time(), te->device());
break;