Commit 3c231940 authored by Xaver Hugl's avatar Xaver Hugl Committed by Aleix Pol Gonzalez

Process TOUCH_CANCEL events from libinput individually

This fixes a bug where cancelled touch sequences get ignored
which results in stuck touch focus.
parent a4fb852a
......@@ -2326,7 +2326,7 @@ void InputRedirection::setupLibInput()
connect(conn, &LibInput::Connection::touchDown, m_touch, &TouchInputRedirection::processDown);
connect(conn, &LibInput::Connection::touchUp, m_touch, &TouchInputRedirection::processUp);
connect(conn, &LibInput::Connection::touchMotion, m_touch, &TouchInputRedirection::processMotion);
connect(conn, &LibInput::Connection::touchCanceled, m_touch, &TouchInputRedirection::cancel);
connect(conn, &LibInput::Connection::touchCanceled, m_touch, &TouchInputRedirection::processCancel);
connect(conn, &LibInput::Connection::touchFrame, m_touch, &TouchInputRedirection::frame);
auto handleSwitchEvent = [this] (SwitchEvent::State state, quint32 time, quint64 timeMicroseconds, LibInput::Device *device) {
SwitchEvent event(state, time, timeMicroseconds, device);
......
......@@ -201,6 +201,12 @@ void TouchInputRedirection::processMotion(qint32 id, const QPointF &pos, quint32
m_windowUpdatedInCycle = false;
}
void TouchInputRedirection::processCancel()
{
m_touches--;
cancel();
}
void TouchInputRedirection::cancel()
{
if (!inited()) {
......
......@@ -46,6 +46,7 @@ public:
void processDown(qint32 id, const QPointF &pos, quint32 time, LibInput::Device *device = nullptr);
void processUp(qint32 id, quint32 time, LibInput::Device *device = nullptr);
void processMotion(qint32 id, const QPointF &pos, quint32 time, LibInput::Device *device = nullptr);
void processCancel();
void cancel();
void frame();
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment