Fix X11 touchpad scrolling in elastic views - #339
Conversation
Normalize smooth wheel input while preserving ordinary wheel behavior; retain fractional deltas and report the visible viewport to QScroller.
|
|
||
| constexpr auto kDefaultWheelScrollLines = 3; | ||
| constexpr auto kMagicScrollMultiplier = 2.5; | ||
| constexpr auto kX11SmoothScrollMultiplier = 5.; |
There was a problem hiding this comment.
Why exactly that multilplier?
There was a problem hiding this comment.
I had tested different, this one make it works acceptable enough.
| x11Touchpad = e->device() | ||
| && e->device()->type() == base::TouchDevice::TouchPad; | ||
| #endif // Qt >= 6.0.0 | ||
| const auto x11Smooth = !touch |
There was a problem hiding this comment.
Why the current capability check doesn't suffice?
| const auto x11Smooth = !touch | ||
| && ::Platform::IsX11() | ||
| && (pixelInput || !pixelDelta.isNull() || x11Touchpad); | ||
| if (x11Smooth && !angleDelta.isNull()) { |
There was a problem hiding this comment.
You're requiring both pixel delta and angle delta to be not null for the angle delta codepath?
| * kX11SmoothScrollMultiplier) | ||
| / float64(QWheelEvent::DefaultDeltasPerStep); | ||
| } | ||
| if (pixelInput || (x11Smooth && !pixelDelta.isNull())) { |
There was a problem hiding this comment.
You already checked pixelDelta in the x11Smooth check?
| } | ||
| if (pixelInput || (x11Smooth && !pixelDelta.isNull())) { | ||
| return (::Platform::IsX11() && !touch | ||
| ? QPointF(pixelDelta) |
There was a problem hiding this comment.
You're breaking scrolling with scaling for X11 users
| case QEvent::ScrollPrepare: { | ||
| QScrollPrepareEvent *se = static_cast<QScrollPrepareEvent *>(e); | ||
| se->setViewportSize(QSizeF(viewport()->size())); | ||
| se->setViewportSize(QSizeF(size())); |
| if (phase == Qt::ScrollBegin) { | ||
| _wheelDeltaRemainder = {}; | ||
| } | ||
| auto exactPixels = ScrollDeltaF(e, touch); |
|
And yes, it is really help. This patch is included into tdesktop in OpenBSD ports, and I do have some positive reports that scroll finally works. Not perfect, but better. |
While currently it doesn't work at all? |
|
Currently it works, but it is extreamly sensetive, and any scroll moves to many messages up/down and make usage nearly impossible. Scroll in contancts, not chat, was broken for a while, but in chats it was broken recently, like a month or two. |
|
Can you answer each question in review? I'm not sure all changes are necessary and right. |
|
@ilya-fedin I'll do it, but I need some time to recover context. |
Normalize smooth wheel input while preserving ordinary wheel behavior; retain fractional deltas and report the visible viewport to QScroller.