Author: dquintana Date: Thu Jan 15 17:43:03 2015 New Revision: 66040
URL: http://svn.reactos.org/svn/reactos?rev=66040&view=rev Log: [EXPLORER] * Fix the notify window not resizing itself when the number of icons changes. * Add error prints when AlignControls fails and exits early. * Rename the Shell_NotifyIcon handler methods to something more appropriate. CORE-9061 #resolve
Modified: trunk/reactos/base/shell/explorer/precomp.h trunk/reactos/base/shell/explorer/trayntfy.cpp trunk/reactos/base/shell/explorer/traywnd.cpp
Modified: trunk/reactos/base/shell/explorer/precomp.h URL: http://svn.reactos.org/svn/reactos/trunk/reactos/base/shell/explorer/precomp... ============================================================================== --- trunk/reactos/base/shell/explorer/precomp.h [iso-8859-1] (original) +++ trunk/reactos/base/shell/explorer/precomp.h [iso-8859-1] Thu Jan 15 17:43:03 2015 @@ -338,8 +338,7 @@ CreateTrayNotifyWnd(IN OUT ITrayWindow *TrayWindow, IN BOOL bHideClock, CTrayNotifyWnd** ppTrayNotify);
BOOL -TrayNotify_NotifyMsg(CTrayNotifyWnd* pTrayNotify, IN WPARAM wParam, -IN LPARAM lParam); +TrayNotify_NotifyIconCmd(CTrayNotifyWnd* pTrayNotify, IN WPARAM wParam, IN LPARAM lParam);
BOOL TrayNotify_GetClockRect(CTrayNotifyWnd* pTrayNotify, OUT PRECT rcClock);
Modified: trunk/reactos/base/shell/explorer/trayntfy.cpp URL: http://svn.reactos.org/svn/reactos/trunk/reactos/base/shell/explorer/trayntf... ============================================================================== --- trunk/reactos/base/shell/explorer/trayntfy.cpp [iso-8859-1] (original) +++ trunk/reactos/base/shell/explorer/trayntfy.cpp [iso-8859-1] Thu Jan 15 17:43:03 2015 @@ -417,7 +417,7 @@ return TRUE; }
- LRESULT NotifyMsg(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled) + LRESULT NotifyIconCmd(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled) { PCOPYDATASTRUCT cpData = (PCOPYDATASTRUCT) lParam; if (cpData->dwData == 1) @@ -426,6 +426,7 @@ NOTIFYICONDATA *iconData; HWND parentHWND; RECT windowRect; + BOOL ret = FALSE; parentHWND = GetParent(); parentHWND = ::GetParent(parentHWND); ::GetClientRect(parentHWND, &windowRect); @@ -433,23 +434,30 @@ data = (PSYS_PAGER_COPY_DATA) cpData->lpData; iconData = &data->nicon_data;
+ TRACE("NotifyIconCmd received. Code=%d\n", data->notify_code); switch (data->notify_code) { case NIM_ADD: - return Toolbar.AddButton(iconData); + ret = Toolbar.AddButton(iconData); + break; case NIM_MODIFY: - return Toolbar.UpdateButton(iconData); + ret = Toolbar.UpdateButton(iconData); + break; case NIM_DELETE: - return Toolbar.RemoveButton(iconData); + ret = Toolbar.RemoveButton(iconData); + break; default: - TRACE("NotifyMessage received with unknown code %d.\n", data->notify_code); - break; - } + TRACE("NotifyIconCmd received with unknown code %d.\n", data->notify_code); + return FALSE; + } + SendMessage(parentHWND, WM_SIZE, 0, MAKELONG(windowRect.right - windowRect.left, - windowRect.bottom - windowRect.top)); + windowRect.bottom - windowRect.top)); + + return ret; }
return TRUE; @@ -1449,11 +1457,11 @@ return DrawBackground(hdc); }
- LRESULT NotifyMsg(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled) + LRESULT NotifyIconCmd(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled) { if (m_pager) { - return m_pager->NotifyMsg(uMsg, wParam, lParam, bHandled); + return m_pager->NotifyIconCmd(uMsg, wParam, lParam, bHandled); }
return TRUE; @@ -1585,10 +1593,10 @@ }
BOOL -TrayNotify_NotifyMsg(CTrayNotifyWnd* pTrayNotify, WPARAM wParam, LPARAM lParam) +TrayNotify_NotifyIconCmd(CTrayNotifyWnd* pTrayNotify, WPARAM wParam, LPARAM lParam) { BOOL bDummy; - return pTrayNotify->NotifyMsg(0, wParam, lParam, bDummy); + return pTrayNotify->NotifyIconCmd(0, wParam, lParam, bDummy); }
BOOL
Modified: trunk/reactos/base/shell/explorer/traywnd.cpp URL: http://svn.reactos.org/svn/reactos/trunk/reactos/base/shell/explorer/traywnd... ============================================================================== --- trunk/reactos/base/shell/explorer/traywnd.cpp [iso-8859-1] (original) +++ trunk/reactos/base/shell/explorer/traywnd.cpp [iso-8859-1] Thu Jan 15 17:43:03 2015 @@ -1316,6 +1316,7 @@ { if (!GetClientRect(&rcClient)) { + ERR("Could not get client rect lastErr=%d\n", GetLastError()); return; } } @@ -1326,7 +1327,10 @@ the tray notification control */ dwp = BeginDeferWindowPos(3); if (dwp == NULL) + { + ERR("BeginDeferWindowPos failed. lastErr=%d\n", GetLastError()); return; + }
/* Limit the Start button width to the client width, if neccessary */ StartSize = m_StartButton.GetSize(); @@ -1345,7 +1349,10 @@ StartSize.cy, SWP_NOZORDER | SWP_NOACTIVATE); if (dwp == NULL) + { + ERR("DeferWindowPos for start button failed. lastErr=%d\n", GetLastError()); return; + } }
/* Determine the size that the tray notification window needs */ @@ -1381,7 +1388,10 @@ TraySize.cy, SWP_NOZORDER | SWP_NOACTIVATE); if (dwp == NULL) + { + ERR("DeferWindowPos for notification area failed. lastErr=%d\n", GetLastError()); return; + } }
/* Resize/Move the rebar control */ @@ -2188,7 +2198,8 @@ { if (m_TrayNotify) { - return TrayNotify_NotifyMsg(m_TrayNotifyInstance, wParam, lParam); + TRACE("WM_COPYDATA notify message received. Handling...\n"); + return TrayNotify_NotifyIconCmd(m_TrayNotifyInstance, wParam, lParam); } return TRUE; }