X-Git-Url: https://git.reactos.org/?p=reactos.git;a=blobdiff_plain;f=base%2Fshell%2Fexplorer%2Fsyspager.cpp;h=32d4b45c6c1899d5cd2c986e6363b337f3de2127;hp=9ba0f2fc999779db1463403cef1dccdddc083fc9;hb=131678a025601690d655e35ad4b968c1b98297c7;hpb=4207397963f4adaa3c19104e075646a9c3b956e2 diff --git a/base/shell/explorer/syspager.cpp b/base/shell/explorer/syspager.cpp index 9ba0f2fc999..32d4b45c6c1 100644 --- a/base/shell/explorer/syspager.cpp +++ b/base/shell/explorer/syspager.cpp @@ -21,14 +21,6 @@ #include "precomp.h" -// Data comes from shell32/systray.cpp -> TrayNotifyCDS_Dummy -typedef struct _SYS_PAGER_COPY_DATA -{ - DWORD cookie; - DWORD notify_code; - NOTIFYICONDATA nicon_data; -} SYS_PAGER_COPY_DATA, *PSYS_PAGER_COPY_DATA; - struct InternalIconData : NOTIFYICONDATA { // Must keep a separate copy since the original is unioned with uTimeout. @@ -236,7 +228,7 @@ public: COM_INTERFACE_ENTRY_IID(IID_IOleWindow, IOleWindow) END_COM_MAP() - BOOL NotifyIcon(DWORD notify_code, _In_ CONST NOTIFYICONDATA *iconData); + BOOL NotifyIcon(DWORD dwMessage, _In_ CONST NOTIFYICONDATA *iconData); void GetSize(IN BOOL IsHorizontal, IN PSIZE size); DECLARE_WND_CLASS_EX(szSysPagerWndClass, CS_DBLCLKS, COLOR_3DFACE) @@ -454,22 +446,18 @@ UINT WINAPI CIconWatcher::WatcherThread(_In_opt_ LPVOID lpParam) TRACE("Pid %lu owns a notification icon and has stopped without deleting it. We'll cleanup on its behalf", Icon->ProcessId); - int len = FIELD_OFFSET(SYS_PAGER_COPY_DATA, nicon_data) + Icon->IconData.cbSize; - PSYS_PAGER_COPY_DATA pnotify_data = (PSYS_PAGER_COPY_DATA)new BYTE[len]; - pnotify_data->cookie = 1; - pnotify_data->notify_code = NIM_DELETE; - memcpy(&pnotify_data->nicon_data, &Icon->IconData, Icon->IconData.cbSize); + TRAYNOTIFYDATAW tnid = {0}; + tnid.dwSignature = NI_NOTIFY_SIG; + tnid.dwMessage = NIM_DELETE; + CopyMemory(&tnid.nid, &Icon->IconData, Icon->IconData.cbSize); COPYDATASTRUCT data; data.dwData = 1; - data.cbData = len; - data.lpData = pnotify_data; - - BOOL Success = FALSE; - ::SendMessage(This->m_hwndSysTray, WM_COPYDATA, (WPARAM)&Icon->IconData, (LPARAM)&data); - - delete pnotify_data; + data.cbData = sizeof(tnid); + data.lpData = &tnid; + BOOL Success = ::SendMessage(This->m_hwndSysTray, WM_COPYDATA, + (WPARAM)&Icon->IconData, (LPARAM)&data); if (!Success) { // If we failed to handle the delete message, forcibly remove it @@ -1263,14 +1251,14 @@ LRESULT CSysPagerWnd::OnDestroy(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& b return TRUE; } -BOOL CSysPagerWnd::NotifyIcon(DWORD notify_code, _In_ CONST NOTIFYICONDATA *iconData) +BOOL CSysPagerWnd::NotifyIcon(DWORD dwMessage, _In_ CONST NOTIFYICONDATA *iconData) { BOOL ret = FALSE; int VisibleButtonCount = Toolbar.GetVisibleButtonCount(); - TRACE("NotifyIcon received. Code=%d\n", notify_code); - switch (notify_code) + TRACE("NotifyIcon received. Code=%d\n", dwMessage); + switch (dwMessage) { case NIM_ADD: ret = Toolbar.AddButton(iconData); @@ -1295,7 +1283,7 @@ BOOL CSysPagerWnd::NotifyIcon(DWORD notify_code, _In_ CONST NOTIFYICONDATA *icon case NIM_SETVERSION: ret = Toolbar.SwitchVersion(iconData); default: - TRACE("NotifyIcon received with unknown code %d.\n", notify_code); + TRACE("NotifyIcon received with unknown code %d.\n", dwMessage); return FALSE; } @@ -1420,9 +1408,12 @@ LRESULT CSysPagerWnd::OnCopyData(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& PCOPYDATASTRUCT cpData = (PCOPYDATASTRUCT)lParam; if (cpData->dwData == 1) { - PSYS_PAGER_COPY_DATA pData = (PSYS_PAGER_COPY_DATA)cpData->lpData; - return NotifyIcon(pData->notify_code, &pData->nicon_data); + /* A taskbar NotifyIcon notification */ + PTRAYNOTIFYDATAW pData = (PTRAYNOTIFYDATAW)cpData->lpData; + if (pData->dwSignature == NI_NOTIFY_SIG) + return NotifyIcon(pData->dwMessage, &pData->nid); } + // TODO: Handle other types of taskbar notifications return FALSE; }