Minor optimizations in wxProgressDialog

Don't bother performing the updates if nothing was requested.

And ensure that nothing is requested even more often than it already was
by not requesting an update if the new value is the same as the old one.
This commit is contained in:
Vadim Zeitlin 2017-10-29 23:09:56 +01:00
parent 317470a39a
commit 1c62ebdcd7

View File

@ -459,10 +459,13 @@ bool wxProgressDialog::Update(int value, const wxString& newmsg, bool *skip)
{
wxCriticalSectionLocker locker(m_sharedData->m_cs);
if ( value != m_sharedData->m_value )
{
m_sharedData->m_value = value;
m_sharedData->m_notifications |= wxSPDD_VALUE_CHANGED;
}
if ( !newmsg.empty() )
if ( !newmsg.empty() && newmsg != m_message )
{
m_message = newmsg;
m_sharedData->m_message = newmsg;
@ -532,7 +535,7 @@ bool wxProgressDialog::Pulse(const wxString& newmsg, bool *skip)
m_sharedData->m_notifications |= wxSPDD_PBMARQUEE_CHANGED;
}
if ( !newmsg.empty() )
if ( !newmsg.empty() && newmsg != m_message )
{
m_message = newmsg;
m_sharedData->m_message = newmsg;
@ -1197,6 +1200,8 @@ wxProgressDialogTaskRunner::TaskDialogCallbackProc
break;
case TDN_TIMER:
// Don't perform updates if nothing needs to be done.
if ( sharedData->m_notifications )
PerformNotificationUpdates(hwnd, sharedData);
/*