Skip to content

Fix X11 touchpad scrolling in elastic views - #339

Open
catap wants to merge 1 commit into
desktop-app:masterfrom
catap:x11-scroll
Open

Fix X11 touchpad scrolling in elastic views#339
catap wants to merge 1 commit into
desktop-app:masterfrom
catap:x11-scroll

Conversation

@catap

@catap catap commented Aug 14, 2026

Copy link
Copy Markdown

Normalize smooth wheel input while preserving ordinary wheel behavior; retain fractional deltas and report the visible viewport to QScroller.

Normalize smooth wheel input while preserving ordinary wheel behavior;
retain fractional deltas and report the visible viewport to QScroller.
@CLAassistant

CLAassistant commented Aug 14, 2026

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

Comment thread ui/ui_utility.cpp

constexpr auto kDefaultWheelScrollLines = 3;
constexpr auto kMagicScrollMultiplier = 2.5;
constexpr auto kX11SmoothScrollMultiplier = 5.;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why exactly that multilplier?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I had tested different, this one make it works acceptable enough.

Comment thread ui/ui_utility.cpp
x11Touchpad = e->device()
&& e->device()->type() == base::TouchDevice::TouchPad;
#endif // Qt >= 6.0.0
const auto x11Smooth = !touch

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why the current capability check doesn't suffice?

Comment thread ui/ui_utility.cpp
const auto x11Smooth = !touch
&& ::Platform::IsX11()
&& (pixelInput || !pixelDelta.isNull() || x11Touchpad);
if (x11Smooth && !angleDelta.isNull()) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You're requiring both pixel delta and angle delta to be not null for the angle delta codepath?

Comment thread ui/ui_utility.cpp
* kX11SmoothScrollMultiplier)
/ float64(QWheelEvent::DefaultDeltasPerStep);
}
if (pixelInput || (x11Smooth && !pixelDelta.isNull())) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You already checked pixelDelta in the x11Smooth check?

Comment thread ui/ui_utility.cpp
}
if (pixelInput || (x11Smooth && !pixelDelta.isNull())) {
return (::Platform::IsX11() && !touch
? QPointF(pixelDelta)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You're breaking scrolling with scaling for X11 users

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually I use it with DPI ~270

case QEvent::ScrollPrepare: {
QScrollPrepareEvent *se = static_cast<QScrollPrepareEvent *>(e);
se->setViewportSize(QSizeF(viewport()->size()));
se->setViewportSize(QSizeF(size()));

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why this change?

if (phase == Qt::ScrollBegin) {
_wheelDeltaRemainder = {};
}
auto exactPixels = ScrollDeltaF(e, touch);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does it really help?

@catap

catap commented Aug 21, 2026

Copy link
Copy Markdown
Author

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.

@ilya-fedin

Copy link
Copy Markdown
Contributor

that scroll finally works

While currently it doesn't work at all?

@catap

catap commented Aug 22, 2026

Copy link
Copy Markdown
Author

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.

@ilya-fedin

Copy link
Copy Markdown
Contributor

Can you answer each question in review? I'm not sure all changes are necessary and right.

@catap

catap commented Aug 22, 2026

Copy link
Copy Markdown
Author

@ilya-fedin I'll do it, but I need some time to recover context.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants