include/vcl/InterimItemWindow.hxx        |    2 ++
 sc/source/ui/view/tabview.cxx            |   14 ++++++++++++++
 vcl/source/control/InterimItemWindow.cxx |    5 +++++
 3 files changed, 21 insertions(+)

New commits:
commit 8339bb40b22e9426a05eb1d122cc8ef12ab7a229
Author:     Patrick Luby <plub...@libreoffice.org>
AuthorDate: Fri Dec 22 09:34:24 2023 -0500
Commit:     Patrick Luby <plub...@libreoffice.org>
CommitDate: Fri Dec 22 21:28:21 2023 +0100

    Related: tdf#155266 Eliminate delayed scrollbar redrawing when swiping
    
    By default, the layout idle timer in the InterimWindowItem
    class is set to TaskPriority::RESIZE. That is too high of
    a priority as it appears that other timers are drawing
    after the scrollbar has been redrawn.
    
    As a result, when swiping, the content moves fluidly but
    the scrollbar thumb does not move until after swiping
    stops or pauses. Then, after a short lag, the scrollbar
    thumb finally "jumps" to the expected position.
    
    So, to fix this scrollbar "stickiness" when swiping,
    setting the priority to TaskPriority::POST_PAINT causes
    the scrollbar to be redrawn after any competing timers.
    
    Change-Id: I8c0772fc40ddc690ee59c6267c1c50971f4ff238
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/161184
    Tested-by: Jenkins
    Reviewed-by: Michael Weghorn <m.wegh...@posteo.de>
    Reviewed-by: Patrick Luby <plub...@libreoffice.org>

diff --git a/include/vcl/InterimItemWindow.hxx 
b/include/vcl/InterimItemWindow.hxx
index 8f7efc64e6e7..ba4aa4c3133e 100644
--- a/include/vcl/InterimItemWindow.hxx
+++ b/include/vcl/InterimItemWindow.hxx
@@ -34,6 +34,8 @@ public:
     virtual void Draw(OutputDevice* pDevice, const Point& rPos,
                       SystemTextColorFlags nFlags) override;
 
+    void SetPriority(TaskPriority nPriority);
+
 protected:
     // bAllowCycleFocusOut of true allows focus to be moved out of the Control
     // via tab key into a parent window or sibling window, false means focus
diff --git a/sc/source/ui/view/tabview.cxx b/sc/source/ui/view/tabview.cxx
index 44c74c5455a7..fd9e88d18f31 100644
--- a/sc/source/ui/view/tabview.cxx
+++ b/sc/source/ui/view/tabview.cxx
@@ -232,6 +232,20 @@ void ScTabView::InitScrollBar(ScrollAdaptor& rScrollBar, 
tools::Long nMaxVal, co
     rScrollBar.SetMouseReleaseHdl(LINK(this, ScTabView, EndScrollHdl));
 
     rScrollBar.EnableRTL( aViewData.GetDocument().IsLayoutRTL( 
aViewData.GetTabNo() ) );
+
+    // Related: tdf#155266 Eliminate delayed scrollbar redrawing when swiping
+    // By default, the layout idle timer in the InterimWindowItem class
+    // is set to TaskPriority::RESIZE. That is too high of a priority as
+    // it appears that other timers are drawing after the scrollbar has been
+    // redrawn.
+    // As a result, when swiping, the content moves fluidly but the scrollbar
+    // thumb does not move until after swiping stops or pauses. Then, after a
+    // short lag, the scrollbar thumb finally "jumps" to the expected
+    // position.
+    // So, to fix this scrollbar "stickiness" when swiping, setting the
+    // priority to TaskPriority::POST_PAINT causes the scrollbar to be
+    // redrawn after any competing timers.
+    rScrollBar.SetPriority(TaskPriority::POST_PAINT);
 }
 
 //  Scroll-Timer
diff --git a/vcl/source/control/InterimItemWindow.cxx 
b/vcl/source/control/InterimItemWindow.cxx
index 41d1466f70c4..697f78759933 100644
--- a/vcl/source/control/InterimItemWindow.cxx
+++ b/vcl/source/control/InterimItemWindow.cxx
@@ -187,6 +187,11 @@ void InterimItemWindow::Draw(OutputDevice* pDevice, const 
Point& rPos,
     m_xContainer->draw(*pDevice, rPos, GetSizePixel());
 }
 
+void InterimItemWindow::SetPriority(TaskPriority nPriority)
+{
+    m_aLayoutIdle.SetPriority(nPriority);
+}
+
 void InterimItemWindow::ImplPaintToDevice(::OutputDevice* pTargetOutDev, const 
Point& rPos)
 {
     Draw(pTargetOutDev, rPos, SystemTextColorFlags::NONE);

Reply via email to