[0.4.8][EXPLORER] systray notification area - icon crosstalk on NIS_SHARED or NIS_HID...
authorJoachim Henze <Joachim.Henze@reactos.org>
Sat, 24 Oct 2020 19:11:20 +0000 (21:11 +0200)
committerJoachim Henze <Joachim.Henze@reactos.org>
Sat, 24 Oct 2020 19:11:20 +0000 (21:11 +0200)
Fixes a regression introduced by SVN r68893 == git 332652615adb97c3b328d558f5f3eb21a902afa1
Symptom "TightVNC Server may show a doubled icon and/or corrupts its neighbor icon in the systray"
Fix picked from 0.4.13-dev-481-g8d6c9e8
------------------
I allowed myself to also port the fix for some TRACE-loggings missing ending "\n".
That second regression was introduced during 0.4.8-dev'ing when substantial parts of this code
were moved from trayntfy.cpp into syspager.cpp.
releases/0.4.7 was not affected by that yet.
That 2nd fix was picked from 0.4.13-dev-480-g7796df3

base/shell/explorer/syspager.cpp

index 7be7eeb..875ab7f 100644 (file)
@@ -440,14 +440,14 @@ UINT WINAPI CIconWatcher::WatcherThread(_In_opt_ LPVOID lpParam)
         {
             // We've been kicked, we have updates to our list (or we're exiting the thread)
             if (This->m_Loop)
-                TRACE("Updating watched icon list");
+                TRACE("Updating watched icon list\n");
         }
         else if ((Status >= WAIT_OBJECT_0 + 1) && (Status < Size))
         {
             IconWatcherData *Icon;
             Icon = This->GetListEntry(NULL, WatchList[Status], false);
 
-            TRACE("Pid %lu owns a notification icon and has stopped without deleting it. We'll cleanup on its behalf", Icon->ProcessId);
+            TRACE("Pid %lu owns a notification icon and has stopped without deleting it. We'll cleanup on its behalf\n", Icon->ProcessId);
 
             TRAYNOTIFYDATAW tnid = {0};
             tnid.dwSignature = NI_NOTIFY_SIG;
@@ -733,6 +733,7 @@ BOOL CNotifyToolbar::AddButton(_In_ CONST NOTIFYICONDATA *iconData)
     tbBtn.dwData = (DWORD_PTR)notifyItem;
     tbBtn.iString = (INT_PTR) text;
     tbBtn.idCommand = GetButtonCount();
+    tbBtn.iBitmap = -1;
 
     if (iconData->uFlags & NIF_STATE)
     {
@@ -828,7 +829,7 @@ BOOL CNotifyToolbar::UpdateButton(_In_ CONST NOTIFYICONDATA *iconData)
     InternalIconData * notifyItem;
     TBBUTTONINFO tbbi = { 0 };
 
-    TRACE("Updating icon %d from hWnd %08x flags%s%s state%s%s",
+    TRACE("Updating icon %d from hWnd %08x flags%s%s state%s%s\n",
         iconData->uID, iconData->hWnd,
         (iconData->uFlags & NIF_ICON) ? " ICON" : "",
         (iconData->uFlags & NIF_STATE) ? " STATE" : "",
@@ -838,7 +839,7 @@ BOOL CNotifyToolbar::UpdateButton(_In_ CONST NOTIFYICONDATA *iconData)
     int index = FindItem(iconData->hWnd, iconData->uID, &notifyItem);
     if (index < 0)
     {
-        WARN("Icon %d from hWnd %08x DOES NOT EXIST!", iconData->uID, iconData->hWnd);
+        WARN("Icon %d from hWnd %08x DOES NOT EXIST!\n", iconData->uID, iconData->hWnd);
         return AddButton(iconData);
     }
 
@@ -937,7 +938,7 @@ BOOL CNotifyToolbar::RemoveButton(_In_ CONST NOTIFYICONDATA *iconData)
     int index = FindItem(iconData->hWnd, iconData->uID, &notifyItem);
     if (index < 0)
     {
-        TRACE("Icon %d from hWnd %08x ALREADY MISSING!", iconData->uID, iconData->hWnd);
+        TRACE("Icon %d from hWnd %08x ALREADY MISSING!\n", iconData->uID, iconData->hWnd);
 
         return FALSE;
     }
@@ -1087,7 +1088,6 @@ VOID CNotifyToolbar::SendMouseEvent(IN WORD wIndex, IN UINT uMsg, IN WPARAM wPar
 LRESULT CNotifyToolbar::OnMouseEvent(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
 {
     POINT pt = { GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam) };
-
     INT iBtn = HitTest(&pt);
 
     if (iBtn >= 0)
@@ -1207,6 +1207,7 @@ void CNotifyToolbar::Initialize(HWND hWndParent, CBalloonQueue * queue)
 const WCHAR szSysPagerWndClass[] = L"SysPager";
 
 CSysPagerWnd::CSysPagerWnd() {}
+
 CSysPagerWnd::~CSysPagerWnd() {}
 
 LRESULT CSysPagerWnd::OnEraseBackground(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)