Use WaitFor() in WaitForPaint::YieldUntilPainted()
No real changes, just refactor the existing code to call the new function instead of duplicating it.
This commit is contained in:
parent
1237322404
commit
dc6085a808
1 changed files with 3 additions and 16 deletions
|
|
@ -57,23 +57,10 @@ public:
|
||||||
// event to come and logs a warning if we didn't get it.
|
// event to come and logs a warning if we didn't get it.
|
||||||
void YieldUntilPainted(int timeoutInMS = 250)
|
void YieldUntilPainted(int timeoutInMS = 250)
|
||||||
{
|
{
|
||||||
wxStopWatch sw;
|
if ( WaitFor("repaint", [this]() { return m_painted; }, timeoutInMS) )
|
||||||
for ( ;; )
|
|
||||||
{
|
{
|
||||||
wxYield();
|
// Reset it in case YieldUntilPainted() is called again.
|
||||||
|
m_painted = false;
|
||||||
if ( m_painted )
|
|
||||||
{
|
|
||||||
// Reset it in case YieldUntilPainted() is called again.
|
|
||||||
m_painted = false;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ( sw.Time() > timeoutInMS )
|
|
||||||
{
|
|
||||||
WARN("Didn't get a paint event until timeout expiration");
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue