D27110: Fix scrollbar sometimes reappearing when set to 'hidden' and scrolling using the touchpad
Ferdinand Bachmann
noreply at phabricator.kde.org
Sat May 2 00:14:55 BST 2020
yrlf added a comment.
I have looked at this a bit more today, in order to help people reproduce this:
- the bug only appears on Wayland, not on X11 or XWayland
when looking at the differences between the QWheelEvents between X11 and Wayland, I noticed that the Qt::ScrollPhase of the events is different!
- Mouse scrolling on Wayland: phase is always 0 (phase not supported)
- Touchpad scrolling on Wayland: phase is 1, then 2, then 3 (beginscroll, updatescroll, endscroll)
- Mouse scrolling on X11: phase is always 0
- Touchpad scrolling on X11: phase is always 0
This is most likely what triggers the scrollbar becoming visible, because of this code in `qscrollbar.cpp` in Qt 5.14
void QScrollBar::wheelEvent(QWheelEvent *event)
{
event->ignore();
bool horizontal = qAbs(event->angleDelta().x()) > qAbs(event->angleDelta().y());
// The vertical wheel can be used to scroll a horizontal scrollbar, but only if
// there is no simultaneous horizontal wheel movement. This is to avoid chaotic
// scrolling on touchpads.
if (!horizontal && event->angleDelta().x() != 0 && orientation() == Qt::Horizontal)
return;
// scrollbar is a special case - in vertical mode it reaches minimum
// value in the upper position, however QSlider's minimum value is on
// the bottom. So we need to invert the value, but since the scrollbar is
// inverted by default, we need to invert the delta value only for the
// horizontal orientation.
int delta = horizontal ? -event->angleDelta().x() : event->angleDelta().y();
Q_D(QScrollBar);
if (d->scrollByDelta(horizontal ? Qt::Horizontal : Qt::Vertical, event->modifiers(), delta))
event->accept();
if (event->phase() == Qt::ScrollBegin)
d->setTransient(false);
else if (event->phase() == Qt::ScrollEnd)
d->setTransient(true);
}
note the check of `event->phase()` near the bottom. `d->setTransient(false)` subsequently calls `q-show()`, which makes the scrollbar visible.
REPOSITORY
R319 Konsole
REVISION DETAIL
https://phabricator.kde.org/D27110
To: yrlf, #konsole, hindenburg, tcanabrava
Cc: konsole-devel, cent, EspadaV8, fbampaloukas, thsurrel, ngraham, maximilianocuria, hindenburg
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/konsole-devel/attachments/20200501/adbb8fa1/attachment.html>
More information about the konsole-devel
mailing list