[Libreoffice-commits] core.git: vcl/source
Miklos Vajna (via logerrit)
logerrit at kemper.freedesktop.org
Thu Jun 13 09:38:09 UTC 2019
vcl/source/control/prgsbar.cxx | 12 ++++++++++++
1 file changed, 12 insertions(+)
New commits:
commit f7157f04fab298423e2c4f6a7e5f8e361164b15f
Author: Miklos Vajna <vmiklos at collabora.com>
AuthorDate: Thu Jun 13 10:06:04 2019 +0200
Commit: Miklos Vajna <vmiklos at collabora.com>
CommitDate: Thu Jun 13 11:37:32 2019 +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.
Change-Id: I86475fb899f16b72ebefe9d3056c92cedeff4439
Reviewed-on: https://gerrit.libreoffice.org/73941
Reviewed-by: Miklos Vajna <vmiklos at collabora.com>
Tested-by: Jenkins
diff --git a/vcl/source/control/prgsbar.cxx b/vcl/source/control/prgsbar.cxx
index 376ed91cfcdd..2531423a922f 100644
--- a/vcl/source/control/prgsbar.cxx
+++ b/vcl/source/control/prgsbar.cxx
@@ -22,6 +22,8 @@
#include <vcl/prgsbar.hxx>
#include <vcl/settings.hxx>
#include <sal/log.hxx>
+#include <vcl/svapp.hxx>
+#include <vcl/idle.hxx>
#define PROGRESSBAR_OFFSET 3
#define PROGRESSBAR_WIN_OFFSET 2
@@ -174,6 +176,16 @@ void ProgressBar::SetValue( sal_uInt16 nNewPercent )
{
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