[Libreoffice-commits] core.git: Branch 'distro/lhm/libreoffice-6-1+backports' - vcl/source

Miklos Vajna (via logerrit) logerrit at kemper.freedesktop.org
Thu Jun 4 23:09:59 UTC 2020


 vcl/source/control/prgsbar.cxx |   12 ++++++++++++
 1 file changed, 12 insertions(+)

New commits:
commit de7148f3a7c9ac5eb0f15e5ddc1d15aef8882fea
Author:     Miklos Vajna <vmiklos at collabora.com>
AuthorDate: Thu Jun 13 10:06:04 2019 +0200
Commit:     Thorsten Behrens <Thorsten.Behrens at CIB.de>
CommitDate: Fri Jun 5 01:09:30 2020 +0200

    tdf#95173 vcl: fix not drawn progressbar widget from UNO
    
    Commit e6c2951f1957224aa0e7dc97b33b0450c41f92f7 (delegate RenderContext,
    invalidate - prgsbar, scrbar, 2015-04-29) switched ProgressBar::SetValue() from
    direct partial paint to invalidate + paint later, which means setting a
    progressbar value, then using an external sleep (such as Python's time.sleep())
    no longer results in an updated progressbar.
    
    Solve the problem by explicitly processing all events with at least
    TaskPriority::REPAINT priority after the invalidate in ProgressBar::SetValue(),
    which is similar to what the Wait implementation in the basic runtime does.
    
    (cherry picked from commit f7157f04fab298423e2c4f6a7e5f8e361164b15f)
    
    Change-Id: I86475fb899f16b72ebefe9d3056c92cedeff4439
    Reviewed-on: https://gerrit.libreoffice.org/73952
    Tested-by: Jenkins
    Reviewed-by: Miklos Vajna <vmiklos at collabora.com>
    (cherry picked from commit 66bfaa01486891627b0748c4ba7b8d86e0fdc439)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/95491
    Tested-by: Thorsten Behrens <Thorsten.Behrens at CIB.de>
    Reviewed-by: Thorsten Behrens <Thorsten.Behrens at CIB.de>

diff --git a/vcl/source/control/prgsbar.cxx b/vcl/source/control/prgsbar.cxx
index ac21e7c98ca3..3d440fa7be08 100644
--- a/vcl/source/control/prgsbar.cxx
+++ b/vcl/source/control/prgsbar.cxx
@@ -20,6 +20,8 @@
 #include <vcl/status.hxx>
 #include <vcl/prgsbar.hxx>
 #include <vcl/settings.hxx>
+#include <vcl/svapp.hxx>
+#include <vcl/idle.hxx>
 
 #define PROGRESSBAR_OFFSET          3
 #define PROGRESSBAR_WIN_OFFSET      2
@@ -181,6 +183,16 @@ void ProgressBar::SetValue( sal_uInt16 nNewPercent )
         mnPreviousPercent = mnPercent;
         mnPercent = nNewPercent;
         Invalidate();
+
+        // Make sure the progressbar is actually painted even if the caller is busy with its task,
+        // so the main loop would not be invoked.
+        Idle aIdle("ProgressBar::SetValue aIdle");
+        aIdle.SetPriority(TaskPriority::POST_PAINT);
+        aIdle.Start();
+        while (aIdle.IsActive())
+        {
+            Application::Yield();
+        }
     }
 }
 


More information about the Libreoffice-commits mailing list