- MGR: Only notify the OS of a change in the notification area

if something has changed, otherwise don't update.
        
    clientgui/
        BOINCTaskBar.cpp, .h

svn path=/trunk/boinc/; revision=20535
This commit is contained in:
Rom Walton 2010-02-11 05:57:36 +00:00
parent 6e388fd050
commit a62189693a
3 changed files with 30 additions and 9 deletions

View File

@ -1138,4 +1138,10 @@ Rom 10 Feb 2010
clientgui/ clientgui/
AsyncRPC.cpp AsyncRPC.cpp
MainDocument.cpp MainDocument.cpp
Rom 10 Feb 2010
- MGR: Only notify the OS of a change in the notification area
if something has changed, otherwise don't update.
clientgui/
BOINCTaskBar.cpp, .h

View File

@ -87,6 +87,10 @@ CTaskBarIcon::CTaskBarIcon(wxString title, wxIcon* icon, wxIcon* iconDisconnecte
m_iconTaskBarNormal = *icon; m_iconTaskBarNormal = *icon;
m_iconTaskBarDisconnected = *iconDisconnected; m_iconTaskBarDisconnected = *iconDisconnected;
m_iconTaskBarSnooze = *iconSnooze; m_iconTaskBarSnooze = *iconSnooze;
m_iconCurrentIcon = *icon;
m_strCurrentMessage = wxEmptyString;
m_strDefaultTitle = title; m_strDefaultTitle = title;
m_bTaskbarInitiatedShutdown = false; m_bTaskbarInitiatedShutdown = false;
@ -134,6 +138,7 @@ void CTaskBarIcon::OnRefresh(CTaskbarEvent& WXUNUSED(event)) {
wxString strProjectName = wxEmptyString; wxString strProjectName = wxEmptyString;
wxString strBuffer = wxEmptyString; wxString strBuffer = wxEmptyString;
wxString strActiveTaskBuffer = wxEmptyString; wxString strActiveTaskBuffer = wxEmptyString;
wxIcon iconCurrent;
float fProgress = 0; float fProgress = 0;
bool bIsActive = false; bool bIsActive = false;
bool bIsExecuting = false; bool bIsExecuting = false;
@ -146,7 +151,7 @@ void CTaskBarIcon::OnRefresh(CTaskbarEvent& WXUNUSED(event)) {
if (!pDoc) return; if (!pDoc) return;
if (pDoc->IsConnected()) { if (pDoc->IsConnected()) {
m_iconCurrent = m_iconTaskBarNormal; iconCurrent = m_iconTaskBarNormal;
pDoc->GetConnectedComputerName(strMachineName); pDoc->GetConnectedComputerName(strMachineName);
@ -158,7 +163,7 @@ void CTaskBarIcon::OnRefresh(CTaskbarEvent& WXUNUSED(event)) {
pDoc->GetCoreClientStatus(status); pDoc->GetCoreClientStatus(status);
if (RUN_MODE_NEVER == status.task_mode) { if (RUN_MODE_NEVER == status.task_mode) {
m_iconCurrent = m_iconTaskBarSnooze; iconCurrent = m_iconTaskBarSnooze;
} }
if (status.task_suspend_reason && !(status.task_suspend_reason & SUSPEND_REASON_CPU_USAGE_LIMIT)) { if (status.task_suspend_reason && !(status.task_suspend_reason & SUSPEND_REASON_CPU_USAGE_LIMIT)) {
@ -226,24 +231,31 @@ void CTaskBarIcon::OnRefresh(CTaskbarEvent& WXUNUSED(event)) {
} }
} else if (pDoc->IsReconnecting()) { } else if (pDoc->IsReconnecting()) {
m_iconCurrent = m_iconTaskBarDisconnected; iconCurrent = m_iconTaskBarDisconnected;
strBuffer.Printf( strBuffer.Printf(
_("Reconnecting to client.") _("Reconnecting to client.")
); );
if (strMessage.Length() > 0) strMessage += wxT("\n");
strMessage += strBuffer; strMessage += strBuffer;
} else { } else {
m_iconCurrent = m_iconTaskBarDisconnected; iconCurrent = m_iconTaskBarDisconnected;
strBuffer.Printf( strBuffer.Printf(
_("Not connected to a client.") _("Not connected to a client.")
); );
if (strMessage.Length() > 0) strMessage += wxT("\n");
strMessage += strBuffer; strMessage += strBuffer;
} }
SetIcon(m_iconCurrent, strMessage); // Prevent flick on those platforms that do out of band
// updates to the UI.
if (!iconCurrent.IsSameAs(m_iconCurrentIcon) ||
(strMessage != m_strCurrentMessage))
{
m_iconCurrentIcon = iconCurrent;
m_strCurrentMessage = strMessage;
SetIcon(m_iconCurrentIcon, m_strCurrentMessage);
}
wxLogTrace(wxT("Function Start/End"), wxT("CTaskBarIcon::OnRefresh - Function End")); wxLogTrace(wxT("Function Start/End"), wxT("CTaskBarIcon::OnRefresh - Function End"));
} }

View File

@ -77,7 +77,10 @@ public:
wxIcon m_iconTaskBarNormal; wxIcon m_iconTaskBarNormal;
wxIcon m_iconTaskBarDisconnected; wxIcon m_iconTaskBarDisconnected;
wxIcon m_iconTaskBarSnooze; wxIcon m_iconTaskBarSnooze;
wxIcon m_iconCurrent;
wxIcon m_iconCurrentIcon;
wxString m_strCurrentMessage;
wxString m_strDefaultTitle; wxString m_strDefaultTitle;
bool m_bTaskbarInitiatedShutdown; bool m_bTaskbarInitiatedShutdown;