[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

svn path=/trunk/; revision=66040
This commit is contained in:
David Quintana 2015-01-15 17:43:03 +00:00
parent 3e4d9f61d6
commit ae7cd5ec73
3 changed files with 34 additions and 16 deletions

View file

@ -338,8 +338,7 @@ HWND
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);

View file

@ -417,7 +417,7 @@ public:
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 @@ public:
NOTIFYICONDATA *iconData;
HWND parentHWND;
RECT windowRect;
BOOL ret = FALSE;
parentHWND = GetParent();
parentHWND = ::GetParent(parentHWND);
::GetClientRect(parentHWND, &windowRect);
@ -433,23 +434,30 @@ public:
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);
case NIM_MODIFY:
return Toolbar.UpdateButton(iconData);
case NIM_DELETE:
return Toolbar.RemoveButton(iconData);
default:
TRACE("NotifyMessage received with unknown code %d.\n", data->notify_code);
ret = Toolbar.AddButton(iconData);
break;
case NIM_MODIFY:
ret = Toolbar.UpdateButton(iconData);
break;
case NIM_DELETE:
ret = Toolbar.RemoveButton(iconData);
break;
default:
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 @@ public:
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 @@ HWND CreateTrayNotifyWnd(IN OUT ITrayWindow *Tray, BOOL bHideClock, CTrayNotifyW
}
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

View file

@ -1316,6 +1316,7 @@ ChangePos:
{
if (!GetClientRect(&rcClient))
{
ERR("Could not get client rect lastErr=%d\n", GetLastError());
return;
}
}
@ -1326,7 +1327,10 @@ ChangePos:
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 @@ ChangePos:
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 @@ ChangePos:
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 @@ ChangePos:
{
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;
}