unmerge default and ScrollType::Drag cases for calc scrollbars
before:
commit 8c4e8818fe9f5ac1f6cdf908299cc109d67f1e50
Author: Caolán McNamara <caolanm@redhat.com>
Date: Thu Aug 4 16:38:47 2022 +0100
nDelta overwritten on all branches except default
the default case was different to the Drag case, and tdf#152406
uncovers a problem using the Drag case for scroll wheel, so undo
the merge of default of Drag.
Change-Id: I7471191d5e1f50f74563e8bcbcb82127d94edf2d
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/149228
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
diff --git a/sc/source/ui/view/tabview.cxx b/sc/source/ui/view/tabview.cxx
index 9142393..dea6dbb 100644
--- a/sc/source/ui/view/tabview.cxx
+++ b/sc/source/ui/view/tabview.cxx
@@ -1170,7 +1170,6 @@ void ScTabView::ScrollHdl(ScrollAdaptor* pScroll)
if ( pScroll == aVScrollBottom.get() ) nDelta = aViewData.VisibleCellsY( SC_SPLIT_BOTTOM );
if (nDelta==0) nDelta=1;
break;
default: // added to avoid warnings
case ScrollType::Drag:
{
// only scroll in the correct direction, do not jitter around hidden ranges
@@ -1182,31 +1181,30 @@ void ScTabView::ScrollHdl(ScrollAdaptor* pScroll)
tools::Long nScrollPos = GetScrollBarPos( *pScroll ) + nScrollMin;
nDelta = nScrollPos - nViewPos;
// tdf#152406 Disable anti-jitter code for scroll wheel events
// After moving thousands of columns to the right via
// horizontal scroll wheel or trackpad swipe events, most
// vertical scroll wheel or trackpad swipe events will trigger
// the anti-jitter code because nScrollPos and nPrevDragPos
// will be equal and nDelta will be overriden and set to zero.
// So, only use the anti-jitter code for mouse drag events.
if ( eType == ScrollType::Drag )
if ( nScrollPos > nPrevDragPos )
{
if ( nScrollPos > nPrevDragPos )
{
if (nDelta<0) nDelta=0;
}
else if ( nScrollPos < nPrevDragPos )
{
if (nDelta>0) nDelta=0;
}
else
nDelta = 0;
if (nDelta<0) nDelta=0;
}
else if ( nScrollPos < nPrevDragPos )
{
if (nDelta>0) nDelta=0;
}
else
nDelta = 0;
nPrevDragPos = nScrollPos;
}
break;
default:
// Note tdf#152406 no anti-jitter code, unlike ScrollType::Drag,
// for scroll wheel events.
// After moving thousands of columns to the right via horizontal
// scroll wheel or trackpad swipe events, most vertical scroll
// wheel or trackpad swipe events would trigger the anti-jitter
// code because nScrollPos and nPrevDragPos would be equal and
// nDelta will be overriden and set to zero. So, only use the
// anti-jitter code for mouse drag events.
nDelta = GetScrollBarPos(*pScroll) - nViewPos;
break;
}
if (nDelta)