[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); CreateTrayNotifyWnd(IN OUT ITrayWindow *TrayWindow, IN BOOL bHideClock, CTrayNotifyWnd** ppTrayNotify);
BOOL BOOL
TrayNotify_NotifyMsg(CTrayNotifyWnd* pTrayNotify, IN WPARAM wParam, TrayNotify_NotifyIconCmd(CTrayNotifyWnd* pTrayNotify, IN WPARAM wParam, IN LPARAM lParam);
IN LPARAM lParam);
BOOL BOOL
TrayNotify_GetClockRect(CTrayNotifyWnd* pTrayNotify, OUT PRECT rcClock); TrayNotify_GetClockRect(CTrayNotifyWnd* pTrayNotify, OUT PRECT rcClock);

View file

@ -417,7 +417,7 @@ public:
return TRUE; 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; PCOPYDATASTRUCT cpData = (PCOPYDATASTRUCT) lParam;
if (cpData->dwData == 1) if (cpData->dwData == 1)
@ -426,6 +426,7 @@ public:
NOTIFYICONDATA *iconData; NOTIFYICONDATA *iconData;
HWND parentHWND; HWND parentHWND;
RECT windowRect; RECT windowRect;
BOOL ret = FALSE;
parentHWND = GetParent(); parentHWND = GetParent();
parentHWND = ::GetParent(parentHWND); parentHWND = ::GetParent(parentHWND);
::GetClientRect(parentHWND, &windowRect); ::GetClientRect(parentHWND, &windowRect);
@ -433,23 +434,30 @@ public:
data = (PSYS_PAGER_COPY_DATA) cpData->lpData; data = (PSYS_PAGER_COPY_DATA) cpData->lpData;
iconData = &data->nicon_data; iconData = &data->nicon_data;
TRACE("NotifyIconCmd received. Code=%d\n", data->notify_code);
switch (data->notify_code) switch (data->notify_code)
{ {
case NIM_ADD: case NIM_ADD:
return Toolbar.AddButton(iconData); ret = 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);
break; 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, SendMessage(parentHWND,
WM_SIZE, WM_SIZE,
0, 0,
MAKELONG(windowRect.right - windowRect.left, MAKELONG(windowRect.right - windowRect.left,
windowRect.bottom - windowRect.top)); windowRect.bottom - windowRect.top));
return ret;
} }
return TRUE; return TRUE;
@ -1449,11 +1457,11 @@ public:
return DrawBackground(hdc); 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) if (m_pager)
{ {
return m_pager->NotifyMsg(uMsg, wParam, lParam, bHandled); return m_pager->NotifyIconCmd(uMsg, wParam, lParam, bHandled);
} }
return TRUE; return TRUE;
@ -1585,10 +1593,10 @@ HWND CreateTrayNotifyWnd(IN OUT ITrayWindow *Tray, BOOL bHideClock, CTrayNotifyW
} }
BOOL BOOL
TrayNotify_NotifyMsg(CTrayNotifyWnd* pTrayNotify, WPARAM wParam, LPARAM lParam) TrayNotify_NotifyIconCmd(CTrayNotifyWnd* pTrayNotify, WPARAM wParam, LPARAM lParam)
{ {
BOOL bDummy; BOOL bDummy;
return pTrayNotify->NotifyMsg(0, wParam, lParam, bDummy); return pTrayNotify->NotifyIconCmd(0, wParam, lParam, bDummy);
} }
BOOL BOOL

View file

@ -1316,6 +1316,7 @@ ChangePos:
{ {
if (!GetClientRect(&rcClient)) if (!GetClientRect(&rcClient))
{ {
ERR("Could not get client rect lastErr=%d\n", GetLastError());
return; return;
} }
} }
@ -1326,7 +1327,10 @@ ChangePos:
the tray notification control */ the tray notification control */
dwp = BeginDeferWindowPos(3); dwp = BeginDeferWindowPos(3);
if (dwp == NULL) if (dwp == NULL)
{
ERR("BeginDeferWindowPos failed. lastErr=%d\n", GetLastError());
return; return;
}
/* Limit the Start button width to the client width, if neccessary */ /* Limit the Start button width to the client width, if neccessary */
StartSize = m_StartButton.GetSize(); StartSize = m_StartButton.GetSize();
@ -1345,7 +1349,10 @@ ChangePos:
StartSize.cy, StartSize.cy,
SWP_NOZORDER | SWP_NOACTIVATE); SWP_NOZORDER | SWP_NOACTIVATE);
if (dwp == NULL) if (dwp == NULL)
{
ERR("DeferWindowPos for start button failed. lastErr=%d\n", GetLastError());
return; return;
}
} }
/* Determine the size that the tray notification window needs */ /* Determine the size that the tray notification window needs */
@ -1381,7 +1388,10 @@ ChangePos:
TraySize.cy, TraySize.cy,
SWP_NOZORDER | SWP_NOACTIVATE); SWP_NOZORDER | SWP_NOACTIVATE);
if (dwp == NULL) if (dwp == NULL)
{
ERR("DeferWindowPos for notification area failed. lastErr=%d\n", GetLastError());
return; return;
}
} }
/* Resize/Move the rebar control */ /* Resize/Move the rebar control */
@ -2188,7 +2198,8 @@ ChangePos:
{ {
if (m_TrayNotify) 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; return TRUE;
} }