Author: tfaber
Date: Mon Oct 12 10:05:39 2015
New Revision: 69508
URL:
http://svn.reactos.org/svn/reactos?rev=69508&view=rev
Log:
[EXPLORER]
- Correct tray icon image list handling. Patch by Joachim Henze
CORE-10257 #resolve
Modified:
trunk/reactos/base/shell/explorer/trayntfy.cpp
Modified: trunk/reactos/base/shell/explorer/trayntfy.cpp
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/shell/explorer/traynt…
==============================================================================
--- trunk/reactos/base/shell/explorer/trayntfy.cpp [iso-8859-1] (original)
+++ trunk/reactos/base/shell/explorer/trayntfy.cpp [iso-8859-1] Mon Oct 12 10:05:39 2015
@@ -163,14 +163,8 @@
if (iconData->uFlags & NIF_ICON)
{
- TBBUTTONINFO tbbiOld = { 0 };
- tbbiOld.cbSize = sizeof(tbbiOld);
- tbbiOld.dwMask = TBIF_BYINDEX | TBIF_IMAGE;
-
- GetButtonInfo(index, &tbbiOld);
-
tbbi.dwMask |= TBIF_IMAGE;
- tbbi.iImage = ImageList_ReplaceIcon(m_ImageList, tbbiOld.iImage,
iconData->hIcon);
+ tbbi.iImage = ImageList_ReplaceIcon(m_ImageList, index, iconData->hIcon);
}
if (iconData->uFlags & NIF_TIP)
@@ -215,22 +209,28 @@
if (index < 0)
return FALSE;
- TBBUTTONINFO tbbiOld = { 0 };
- tbbiOld.cbSize = sizeof(tbbiOld);
- tbbiOld.dwMask = TBIF_BYINDEX | TBIF_IMAGE;
-
- GetButtonInfo(index, &tbbiOld);
-
- ImageList_Remove(m_ImageList, tbbiOld.iImage);
-
- DeleteButton(index);
-
if (!(notifyItem->dwState & NIS_HIDDEN))
{
m_VisibleButtonCount--;
}
delete notifyItem;
+
+ ImageList_Remove(m_ImageList, index);
+
+ int count = GetButtonCount();
+
+ /* shift all buttons one index to the left -- starting one index right
+ from item to delete -- to preserve their correct icon and tip */
+ for (int i = index; i < count - 1; i++)
+ {
+ notifyItem = GetItemData(i + 1);
+ SetItemData(i, notifyItem);
+ UpdateButton(notifyItem);
+ }
+
+ /* Delete the right-most, now obsolete button */
+ DeleteButton(count - 1);
return TRUE;
}
@@ -322,7 +322,7 @@
LRESULT 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)