Commit 7fee359c authored by Dmitry Kazakov's avatar Dmitry Kazakov

Fix lost scroll events when tablet is in the proximity

If there is a really heavy flow of events, the OS will start compressing
wheel events into bigger deltas. So we should do multiple zoom actions,
not one. It might fix the problem on Windows, but it will *not* fix the
problem on Linux, because on Linux XCB just drops all the MOTION events
for the mouse-wheel subdevice and sends DEVICE_CHANGED events instead.
And there is no easy way to generate QWheelEvent from DEVICE_CHANGED
event.

CCBUG:410940
parent 0cc84daa
......@@ -61,6 +61,7 @@
#include "kis_extended_modifiers_mapper.h"
#include "kis_input_manager_p.h"
#include "kis_algebra_2d.h"
template <typename T>
uint qHash(QPointer<T> value) {
......@@ -433,15 +434,21 @@ bool KisInputManager::eventFilterImpl(QEvent * event)
}
}
if (qAbs(d->accumulatedScrollDelta) >= QWheelEvent::DefaultDeltasPerStep) {
bool wasScrolled = false;
while (qAbs(d->accumulatedScrollDelta) >= QWheelEvent::DefaultDeltasPerStep) {
//Make sure the input actions know we are active.
KisAbstractInputAction::setInputManager(this);
retval = d->matcher.wheelEvent(action, wheelEvent);
d->accumulatedScrollDelta = 0;
d->accumulatedScrollDelta -= KisAlgebra2D::signPZ(d->accumulatedScrollDelta);
wasScrolled = true;
}
else {
retval = true;
if (wasScrolled) {
d->accumulatedScrollDelta = 0;
}
retval = !wasScrolled;
break;
}
case QEvent::Enter:
......
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