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:
parent
f094b3693c
commit
0167b7d7b0
1 changed files with 11 additions and 0 deletions
|
@ -380,6 +380,10 @@ void Connection::processEvents()
|
||||||
#ifndef KWIN_BUILD_TESTING
|
#ifndef KWIN_BUILD_TESTING
|
||||||
TouchEvent *te = static_cast<TouchEvent *>(event.get());
|
TouchEvent *te = static_cast<TouchEvent *>(event.get());
|
||||||
const auto *output = te->device()->output();
|
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);
|
const QPointF globalPos = devicePointToGlobalPosition(te->absolutePos(output->modeSize()), output);
|
||||||
Q_EMIT te->device()->touchDown(te->id(), globalPos, te->time(), te->device());
|
Q_EMIT te->device()->touchDown(te->id(), globalPos, te->time(), te->device());
|
||||||
break;
|
break;
|
||||||
|
@ -387,6 +391,10 @@ void Connection::processEvents()
|
||||||
}
|
}
|
||||||
case LIBINPUT_EVENT_TOUCH_UP: {
|
case LIBINPUT_EVENT_TOUCH_UP: {
|
||||||
TouchEvent *te = static_cast<TouchEvent *>(event.get());
|
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());
|
Q_EMIT te->device()->touchUp(te->id(), te->time(), te->device());
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -394,6 +402,9 @@ void Connection::processEvents()
|
||||||
#ifndef KWIN_BUILD_TESTING
|
#ifndef KWIN_BUILD_TESTING
|
||||||
TouchEvent *te = static_cast<TouchEvent *>(event.get());
|
TouchEvent *te = static_cast<TouchEvent *>(event.get());
|
||||||
const auto *output = te->device()->output();
|
const auto *output = te->device()->output();
|
||||||
|
if (!output) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
const QPointF globalPos = devicePointToGlobalPosition(te->absolutePos(output->modeSize()), output);
|
const QPointF globalPos = devicePointToGlobalPosition(te->absolutePos(output->modeSize()), output);
|
||||||
Q_EMIT te->device()->touchMotion(te->id(), globalPos, te->time(), te->device());
|
Q_EMIT te->device()->touchMotion(te->id(), globalPos, te->time(), te->device());
|
||||||
break;
|
break;
|
||||||
|
|
Loading…
Reference in a new issue