From be538312417a60f4fbdfcc81b93744af72aa9df3 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Tue, 18 Jun 2013 22:03:24 +0000 Subject: various icon issues git-svn-id: http://svn.miranda-ng.org/main/trunk@5031 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/FingerprintNG/src/fingerprint.cpp | 9 ++++----- src/modules/srmm/statusicon.cpp | 13 ++++++++++++- 2 files changed, 16 insertions(+), 6 deletions(-) diff --git a/plugins/FingerprintNG/src/fingerprint.cpp b/plugins/FingerprintNG/src/fingerprint.cpp index 6d17d5f99d..30f6655b4c 100644 --- a/plugins/FingerprintNG/src/fingerprint.cpp +++ b/plugins/FingerprintNG/src/fingerprint.cpp @@ -149,7 +149,7 @@ static void SetSrmmIcon(HANDLE hContact, LPTSTR ptszMirver) sid.tszTooltip = ptszMirver; if ( lstrlen(ptszMirver)) - sid.hIcon = sid.hIconDisabled = (HICON)ServiceGetClientIconW((WPARAM)ptszMirver, TRUE); + sid.hIcon = (HICON)ServiceGetClientIconW((WPARAM)ptszMirver, TRUE); else sid.flags |= MBF_HIDDEN; @@ -486,10 +486,8 @@ HICON __fastcall CreateIconFromIndexes(short base, short overlay, short overlay2 hIcon = icMain; - if (overlayMask) { - hIcon = CreateJoinedIcon(hIcon, icOverlay); - hTmp = hIcon; - } + if (overlayMask) + hTmp = hIcon = CreateJoinedIcon(hIcon, icOverlay); if (overlay2Mask) { hIcon = CreateJoinedIcon(hIcon, icOverlay2); @@ -500,6 +498,7 @@ HICON __fastcall CreateIconFromIndexes(short base, short overlay, short overlay2 if (overlay3Mask) { hIcon = CreateJoinedIcon(hIcon, icOverlay3); if (hTmp) DestroyIcon(hTmp); + hTmp = hIcon; } if (overlay4Mask) { diff --git a/src/modules/srmm/statusicon.cpp b/src/modules/srmm/statusicon.cpp index 0915df7d46..4be925e5eb 100644 --- a/src/modules/srmm/statusicon.cpp +++ b/src/modules/srmm/statusicon.cpp @@ -27,6 +27,10 @@ struct StatusIconChild : public MZeroedObject { ~StatusIconChild() { + if (hIcon) + DestroyIcon(hIcon); + if (hIconDisabled) + DestroyIcon(hIconDisabled); mir_free(tszTooltip); } @@ -96,6 +100,10 @@ INT_PTR ModifyStatusIcon(WPARAM wParam, LPARAM lParam) pc->hContact = hContact; p->arChildren.insert(pc); } + else { + if (pc->hIcon) + DestroyIcon(pc->hIcon); + } pc->flags = sid->flags; pc->hIcon = sid->hIcon; @@ -165,7 +173,10 @@ static INT_PTR GetNthIcon(WPARAM wParam, LPARAM lParam) memcpy(&res, &p, sizeof(res)); if (pc) { if (pc->hIcon) res.hIcon = pc->hIcon; - if (pc->hIconDisabled) res.hIconDisabled = pc->hIconDisabled; + if (pc->hIconDisabled) + res.hIconDisabled = pc->hIconDisabled; + else if (pc->hIcon) + res.hIconDisabled = pc->hIcon; if (pc->tszTooltip) res.tszTooltip = pc->tszTooltip; res.flags = pc->flags; } -- cgit v1.2.3