[libinput] Pointer motion event compression

If we have multiple pointer motion events we compress it to just one.
This commit is contained in:
Martin Gräßlin 2015-09-02 11:36:36 +02:00
parent cebd723c2c
commit 123e361f55

View file

@ -219,7 +219,20 @@ void Connection::processEvents()
} }
case LIBINPUT_EVENT_POINTER_MOTION: { case LIBINPUT_EVENT_POINTER_MOTION: {
PointerEvent *pe = static_cast<PointerEvent*>(event.data()); PointerEvent *pe = static_cast<PointerEvent*>(event.data());
emit pointerMotion(pe->delta(), pe->time()); QPointF delta = pe->delta();
quint32 latestTime = pe->time();
auto it = m_eventQueue.begin();
while (it != m_eventQueue.end()) {
if ((*it)->type() == LIBINPUT_EVENT_POINTER_MOTION) {
QScopedPointer<PointerEvent> p(static_cast<PointerEvent*>(*it));
delta += p->delta();
latestTime = p->time();
it = m_eventQueue.erase(it);
} else {
break;
}
}
emit pointerMotion(delta, latestTime);
break; break;
} }
case LIBINPUT_EVENT_POINTER_MOTION_ABSOLUTE: { case LIBINPUT_EVENT_POINTER_MOTION_ABSOLUTE: {