summaryrefslogtreecommitdiff
path: root/vcl/source/control/prgsbar.cxx
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.com>2019-06-13 10:06:04 +0200
committerMiklos Vajna <vmiklos@collabora.com>2019-06-13 11:37:32 +0200
commitf7157f04fab298423e2c4f6a7e5f8e361164b15f (patch)
tree9cdca8278d37fd2ec6b1ac1d1451cd5133c0c507 /vcl/source/control/prgsbar.cxx
parent78b4c7ae30926d1c908c4d67f7ebc6b0565ea200 (diff)
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@collabora.com> Tested-by: Jenkins
Diffstat (limited to 'vcl/source/control/prgsbar.cxx')
-rw-r--r--vcl/source/control/prgsbar.cxx12
1 files changed, 12 insertions, 0 deletions
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();
+ }
}
}